Setting up a GPU-accelerated environment can be challenging due to driver dependencies, version conflicts, and other complexities. Apptainer simplifies this process by encapsulating all these details
There are multiple ways to install and run TensorFlow. Our recommended approach is via NGC containers. The containers are available via NGC Registry. In this example we will pull TensorFlow NGC container
Build the container:
This will take some time, and once it completes you should see a .simg file.
For your convenience, the pre-built container images are located in directory:
/oscar/runtime/software/external/ngc-containers/tensorflow.d/x86_64/
You can choose either to build your own or use one of the pre-downloaded images.
Working with Apptainer images requires lots of storage space. By default Apptainer will use ~/.apptainer as a cache directory which can cause you to go over your Home quota.
Once the container is ready, request an interactive session with a GPU
Run a container wih GPU support
the --nv flag is important. As it enables the NVIDA sub-system
Or, if you're executing a specific command inside the container:
Make sure your Tensorflow image is able to detect GPUs
If you need to install more custom packages, the containers itself are non-writable but we can use the --user
flag to install packages inside .local
Example:
Here is how you can submit a SLURM job script by using the srun command to run your container. Here is a basic example: