Apptainer build Process: Added def file, README, required debian packages

This commit is contained in:
Rahul Raj D N 2025-05-01 20:18:46 -04:00
parent 332e8eeaf9
commit 8baf9e4876
7 changed files with 172 additions and 0 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
/.vscode /.vscode
*.cache *.cache
*.code-workspace *.code-workspace
miscs/apptainer/vortex_fpga.sif

View file

@ -63,6 +63,12 @@ $ source /opt/xilinx/xrt/setup.sh
$ source /tools/reconfig/xilinx/Vitis/2023.1/settings64.sh $ source /tools/reconfig/xilinx/Vitis/2023.1/settings64.sh
``` ```
If you are using an apptainer,
```
$ export LD_LIBRARY_PATH=/opt/boost-1.66/lib/:/opt/openssl-1.1/lib/:$LD_LIBRARY_PATH
```
### Check Installed FPGA Platforms ### Check Installed FPGA Platforms
`platforminfo -l` which tells us the correct name of the platform installed on the current fpga node. It should be used for the `PLATFORM` variable below. Otherwise, if there is an error then there was an issue with the previous two commands. `platforminfo -l` which tells us the correct name of the platform installed on the current fpga node. It should be used for the `PLATFORM` variable below. Otherwise, if there is an error then there was an issue with the previous two commands.

39
miscs/apptainer/README.md Normal file
View file

@ -0,0 +1,39 @@
# Apptainer Build Process
Use the Slurm scheduler to request an interactive job on Flubber9
```
salloc -p rg-fpga --nodes=1 --ntasks-per-node=64 --mem=16G --nodelist flubber9 --time=01:00:00
```
Go to `apptainer` directory
```
$ pwd
vortex/miscs/apptainer
$ apptainer build --no-https vortex_fpga.sif vortex_fpga.def
```
To start the apptainer,
```
$ apptainer shell --fakeroot --cleanenv --writable-tmpfs --bind /opt/xilinx/:/opt/xilinx/ --bind /netscratch/rn84/devnull:/dev/null --bind /dev/bus/usb,/sys/bus/pci --bind /projects:/projects --bind /tools:/tools --bind /netscratch:/netscratch vortex_fpga.sif
```
Inside the Apptainer,
```
Apptainer> lsusb
should show devices connected to machine on which you are running this command
```
```
Apptainer> source /opt/xilinx/xrt/setup.sh
Apptainer> source /tools/reconfig/xilinx/Vitis/2023.1/settings64.sh
Apptainer> platforminfo -l
```

Binary file not shown.

View file

@ -0,0 +1,29 @@
#!/bin/bash
set -e # Exit on error
echo "Installing Boost and OpenSSL from .deb packages"
# Extract and install Boost
echo "Extracting Boost..."
ar -x boost-package.deb
ls
mkdir -p /tmp/boost-extract
tar --zstd --no-same-owner -xvf data.tar.zst -C /tmp/boost-extract
ls -l /tmp/boost-extract/
cp -r /tmp/boost-extract/opt/boost-1.66/ /opt/
ls -l /opt/boost-1.66/
rm -rf data.tar
# Extract and install OpenSSL
echo "Extracting OpenSSL..."
ar -x openssl-package.deb
mkdir -p /tmp/openssl-extract
tar --zstd --no-same-owner -xvf data.tar.zst -C /tmp/openssl-extract
ls -l /tmp/openssl-extract/
cp -r /tmp/openssl-extract/opt/openssl-1.1/ /opt/
ls -l /opt/openssl-1.1/
rm -rf data.tar
echo "Boost and OpenSSL installation complete!"

Binary file not shown.

View file

@ -0,0 +1,97 @@
Bootstrap: docker
From: ubuntu:22.04
%files
install_boost_openssl.sh .
openssl-package.deb .
boost-package.deb .
%post
echo "Setting up the environment..."
touch /var/log/apt/term.log
if [ -f /var/log/apt/term.log ]; then
chown root:adm /var/log/apt/term.log || true
fi
# Set environment variable to avoid interactive prompts during installation
export DEBIAN_FRONTEND=noninteractive
echo 'APT::Sandbox::User "root";' > /etc/apt/apt.conf.d/no-sandbox
mkdir -p /netscratch
# Update and install base dependencies
apt-get update
apt-get install -y libc6 fakeroot
# Fix dependency issues
apt-get install -f -y || true
dpkg --configure -a || true
# Reinstall problematic packages
apt-get remove --purge -y dbus fontconfig-config || true
apt-get install -y dbus fontconfig-config || true
rm -f /var/lib/dpkg/lock-frontend
rm -f /var/lib/dpkg/lock
rm -f /var/cache/apt/archives/lock
# mount -o remount,rw /usr
# mount -o remount,rw /var
chown -R root:root /usr/lib/dbus-1.0/dbus-daemon-launch-helper || true
# Install necessary packages
apt-get install -y fontconfig libfontconfig1 libpangoft2-1.0-0 libbluray2 \
libpangocairo-1.0-0 libavformat58 libpango-1.0-0 \
openjdk-11-jre-headless libcairo2 librsvg2-2 librsvg2-common \
openjdk-11-jre-zero libtheora0 libavcodec58 libcairo-gobject2 \
ca-certificates-java libchromaprint1 software-properties-common perl-modules bzip2 \
unzip zlib1g-dev libtinfo5 g++ usbutils gawk bison gcc make wget tar python3.9 locales zstd uuid-dev git || true
ln -s /usr/bin/python3 /usr/bin/python
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
# Run dpkg to ensure everything is properly configured
dpkg --configure -a || true
# Clean up apt cache
apt-get clean
rm -rf /var/lib/apt/lists/*
echo "Setting up the environment..."
# Copy the installation script into the container
cp install_boost_openssl.sh /tmp/
# Execute the script
chmod +x /tmp/install_boost_openssl.sh
/tmp/install_boost_openssl.sh
# Clean up
rm -f /tmp/install_boost_openssl.sh
%environment
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export HOME=/home/developer
%runscript
exec /bin/bash
%labels
Author Rahul
Version 1.0
%test
echo "Container test successful!"
locale
lsusb || echo "lsusb not available"
ls -l /dev/null