Skip to content

Instantly share code, notes, and snippets.

@cboettig
Last active July 26, 2023 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cboettig/eadd67cd29e1ea0532ac5fb8b439f513 to your computer and use it in GitHub Desktop.
Save cboettig/eadd67cd29e1ea0532ac5fb8b439f513 to your computer and use it in GitHub Desktop.
NVIDIA warp drive: add nvidia dev libraries to container without breaking driver/lib matching

notebook: pangeo/pytorch-notebook

We need nvidia dev requirements if using the default containers (e.g. pangeo/pytorch-notebook):

https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.8.0/ubuntu2204/runtime/cudnn8/Dockerfile?ref_type=heads

https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.8.0/ubuntu2204/base/Dockerfile?ref_type=heads

 apt-get update && apt-get install -y --no-install-recommends     gnupg2 curl ca-certificates &&     curl -fsSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb &&     dpkg -i cuda-keyring_1.0-1_all.deb 

apt-get update && apt-get install -y --no-install-recommends     cuda-cudart-dev-11-8
  cuda-command-line-tools-11-8 cuda-minimal-build-11-8 cuda-libraries-dev-11-8

And need to set env vars:

import os
#os.environ["LIBRARY_PATH"]
os.environ["CPATH"] = "/usr/local/cuda/targets/x86_64-linux/include" # +":" + os.getenv("CPATH")
os.environ["LD_LIBRARY_PATH"] = "/usr/local/cuda/targets/x86_64-linux/lib" 
os.environ["PATH"]="/usr/local/cuda/bin" +":" + os.getenv("PATH")
os.environ["LIBRARY_PATH"]="/usr/local/cuda/lib64/stubs"

Additionally, we need a workable python environment because conda install -c conda-forge gxx_linux-64 is a terrible idea. As root we get system python:

apt install python3-dev python3-venv
conda deactivate
/usr/bin/python3 -m venv pycuda
source pycuda/bin/activate
python -m ipykernel install --user --name pycuda

pip install rl-warp-drive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment