Skip to content

Latest commit

 

History

History
347 lines (306 loc) · 15.1 KB

nvidia_container_toolkit.org

File metadata and controls

347 lines (306 loc) · 15.1 KB

Interesting links:

Link to download anaconda python:

https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh

Main nvidia container toolkit link:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

Location:

pwd

ENV Setup:

APT stuff:

Update

apt-get 'update'

Install Nvidia container toolkit:

apt-get install -y \
    'aria2' \
    'cpio' \
    'docker.io' \
    'nvidia-container-toolkit' \
    'nvidia-container-toolkit-base' \
    'zstd' \
;

Download anaconda:

cd "$('dirname' '--' "${0}")"
mkdir -pv -- './nvidia_docker_image'
cd './nvidia_docker_image'
ls 'Anaconda3-2023.07-2-Linux-x86_64.sh' || aria2c -c -x16 -j16 'https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh'

Setup docker:

Restart docker daemon:

systemctl 'restart' 'docker'

Search for images:

docker 'search' 'cuda'

Pull cuda 11.7 image:

docker 'pull' 'nvidia/cuda:11.7.1-devel-ubuntu22.04'

Nvidia CTK Related:

Check version:

nvidia-ctk '--version'

Generate configs:

nvidia-ctk 'cdi' 'generate' '--output=/etc/cdi/nvidia.yaml'
nvidia-ctk 'cdi' 'generate' '--output=/var/run/cdi/nvidia.yaml'

Check generated file:

grep '  name:' '/etc/cdi/nvidia.yaml'

Configure for docker:

nvidia-ctk 'runtime' 'configure' '--runtime=docker'

The main dockerfile:

FROM nvidia/cuda:11.7.1-devel-ubuntu22.04
RUN apt-get update
RUN apt-get install -y fish fizsh build-essential aria2 cpio git-lfs squashfs-tools zstd
COPY 'Anaconda3-2023.07-2-Linux-x86_64.sh' /
RUN bash '/Anaconda3-2023.07-2-Linux-x86_64.sh' -b -p '/opt/anaconda'
RUN rm -vf -- '/Anaconda3-2023.07-2-Linux-x86_64.sh'

Build the docker file:

cd "$('dirname' '--' "${0}")"
mkdir -pv -- './nvidia_docker_image'
cp -vf -- './Dockerfile' './nvidia_docker_image'
cd './nvidia_docker_image'
docker build -t 'cuda_anaconda' .

Interactively run commands:

docker 'run' '--rm' '-it' '--runtime=nvidia' '--gpus' 'all' 'cuda_anaconda' 'fish'

Docker stuff:

Full help for run:

docker run --help

Test:

1:

docker 'run' '--rm' '--runtime=nvidia' '--gpus' 'all' 'nvidia/cuda:11.6.2-base-ubuntu20.04' 'nvidia-smi'

2:

docker 'run' '--rm' '--runtime=nvidia' '--gpus' 'all' 'nvidia/cuda:11.7.1-devel-ubuntu22.04' 'nvidia-smi'

List images:

docker image ls

Main install stuff:

CD and location:

cd "$('dirname' '--' "${0}")"
pwd

Install apt dependencies:

'./install_apt.sh'

Run the script to download anaconda:

'./download_anaconda.sh'

Setup CTK:

'./setup_ctk.sh'

Setup docker:

'./setup_docker.sh'

Build docker image:

'./build_docker.sh'