Execution

On an Ubuntu machine

Note

Replace

docker run --privileged --gpus all

with

podman run --security-opt=label=disable --device=nvidia.com/gpu=all

if you are using Podman.

Make sure to remove the above flags if you are not using a GPU.

Note

By default, the Podman containers are either built with the local timezone or to the UTC. To change the timezone of the container, add --tz=local flag to the execution command above.

Run a python script

Note

Replace task=mlp with task=mlp_cpu if you don’t have a GPU. You might also need to remove the --gpus all flag.

# Example of a simple MNIST training run
docker run --privileged --gpus all --rm -e CNEUROMAX_PATH=${CNEUROMAX_PATH} \
           -e PYTHONPATH=${PYTHONPATH}:${CNEUROMAX_PATH} \
           -v ${CNEUROMAX_PATH}:${CNEUROMAX_PATH} -v /dev/shm:/dev/shm \
           -w ${CNEUROMAX_PATH} cneuromod/cneuromax:latest \
           python -m cneuromax project=classify_mnist task=mlp

Run a notebook

From your own machine create a SSH tunnel to the running machine.

# Example
ssh MY_USER@123.456.7.8 -NL 8888:localhost:8888

Run the lab.

docker run --rm -e CNEUROMAX_PATH=${CNEUROMAX_PATH} \
           -e PYTHONPATH=${PYTHONPATH}:${CNEUROMAX_PATH} \
           -v ${CNEUROMAX_PATH}:${CNEUROMAX_PATH} \
           -w ${CNEUROMAX_PATH} cneuromod/cneuromax:latest \
           jupyter-lab --allow-root --ip 0.0.0.0 --port 8888

On a Slurm cluster

Note

Suggestion: Open a tmux session to run the following commands.

Run a python script

Note

The following command was designed for the Béluga cluster. It will most likely need refining on other clusters.

# Example of a simple MNIST training run
module load apptainer && cd ${CNEUROMAX_PATH} && export PYTHONPATH=${PYTHONPATH}:${CNEUROMAX_PATH} && \
    export APPTAINERENV_APPEND_PATH=/opt/software/slurm/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/apptainer/1.1.8/bin && \
    apptainer exec --no-home -B /etc/passwd -B /etc/slurm/ -B /opt/software/slurm -B /usr/lib64/libmunge.so.2 \
                   -B /cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/apptainer/1.1.8/bin/apptainer \
                   -B /var/run/munge/ --env LD_LIBRARY_PATH=/opt/software/slurm/lib64/slurm  -B $CNEUROMAX_PATH $SCRATCH/cneuromax.sif \
                   python -m cneuromax project=classify_mnist task=mlp_beluga

Run Jupyter-lab

From your own machine create a SSH tunnel to the compute node.

# Fill in the appropriate values
sshuttle --dns -Nr USER@ADDRESS:8888

Run the lab.

# Fill in the appropriate values
salloc --account=ACCOUNT bash -c "module load apptainer && \
    cd ${CNEUROMAX_PATH} && \
    apptainer exec --nv -v ${CNEUROMAX_PATH}:${CNEUROMAX_PATH} \
    ${SCRATCH}/cneuromax.sif jupyter-lab --allow-root --ip $(hostname -f) --port 8888"