NVIDIA NGC
NVIDIA NGC is a hub for GPU-optimized software for deep learning, machine learning, and high-performance computing.
Account Setup
Create an NGC account at catalog.ngc.nvidia.com
Navigate to Setup in your account menu
Generate an API key
Configuration
Add to your ~/.bash_profile:
export APPTAINER_DOCKER_USERNAME='$oauthtoken'
export APPTAINER_DOCKER_PASSWORD='YOUR_NGC_API_KEY'
export APPTAINER_CACHEDIR=/resnick/scratch/$USER
Create scratch directory and reload:
mkdir -p /resnick/scratch/$USER
source ~/.bash_profile
Pulling Containers
Load Apptainer and pull images:
module load apptainer/1.1.9-gcc-11.3.1-mbji4yi
apptainer pull tensorflow-20.02-tf1-py3.sif \
docker://nvcr.io/nvidia/tensorflow:20.02-tf1-py3
Running Containers
Interactive GPU Session
srun --pty -t 01:00:00 -n 7 -N 1 --gres gpu:1 /bin/bash -l
Execute Container
apptainer exec --bind /resnick/scratch/$USER --nv \
tensorflow-20.02-tf1-py3.sif python train.py
NGC CLI Tool
module load ngc/1.4.0
ngc config set
# Enter your API key when prompted
List available images:
ngc registry image list
Example SLURM Script
#!/bin/bash
#SBATCH --job-name=ngc_test
#SBATCH --partition=gpu
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --gres=gpu:p100:1
#SBATCH --time=00:30:00
module load apptainer/1.1.9-gcc-11.3.1-mbji4yi
apptainer exec --nv tensorflow-20.02-tf1-py3.sif \
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
Popular NGC Containers
Container |
Use Case |
|---|---|
|
TensorFlow with GPU support |
|
PyTorch with GPU support |
|
Base CUDA development |
|
Model inference server |
Browse all containers at catalog.ngc.nvidia.com