This is straightforward.
- Create a conda virtual environment, e.g.,
conda create -n cudacudnn python=3.9 pip
- Activate the virtual environment, i.e,
conda activate cudacudnn
- Assume we are using Pytorch 2.0, e.g., install it via
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
- Install CUDA toolkit and cuDNN, e.g.,
conda install -c conda-forge cudnn=8 cudatoolkit=11.8
- Add the library path of the conda environment to LD_LIBRARY_PATH. There are several
approaches. Two appraoches are as follows, assuming the environment
is at
$HOME/.conda/envs/cudacudnn
and we want to runfoo.py
,
orvirtenv_path=$HOME/.conda/envs/cudacudnn export LD_LIBRARY_PATH=${virtenv_path}/lib:$LD_LIBRARY_PATH python foo.py
virtenv_path=$HOME/.conda/envs/cudacudnn LD_LIBRARY_PATH=${virtenv_path}/lib:$LD_LIBRARY_PATH python foo.py
No comments:
Post a Comment