Jupyter lab port forward of Nvidia modulus#

# Load modules
module load apptainer/1.0.3
module load modulus/22.09
cd /scratch/$USER

Run the job#

salloc --account=scw1901 --gres=gpu:1 --nodes=1 --partition=accel_ai
srun --pty /bin/bash

Fire the container#

Here we launch the container in an interactive shell. We the pwd i.e. the scratch partition to /data and the /tmp for apptainer’s working. --contain ensures no volume bind and cleanenv ensures not env variables exports. Here we manually export the GPU number with the help of CUDA_VISIBLE_DEVICES env variable.

apptainer shell --nv --contain --cleanenv --bind "$(pwd)":/data,/tmp:/tmp --env CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES $MODULUS_IMG
cd /data
jupyter-lab --port 8888

ssh tunneling#

ssh -N -L 8888:scs2041:8888 s.1915438@sunbird.swansea.ac.uk

Copy the address#

COPY http://hostname:8888/?token=a40edc30b1cde5a8c94a03188f1edcf099a5acc3ac617018
PASTE http://localhost:8888/?token=a40edc30b1cde5a8c94a03188f1edcf099a5acc3ac617018

Test the container#

Make sure that you can import the modulus and the pysdf.sdf modules.

s.1915438@scs2001:/data$ python
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10)
>>> import modulus
>>> import pysdf.sdf
>>>