Usually on a single machine there can be only one nvidia-driver and nvidia CUDA associated with it. But in a scenario when you might need different CUDA version. In this post we will see how to run multiple CUDA version on same machine.
The CUDA Toolkit files are not installed in the usual /usr/local/cuda*
directories where applications may expect to find them.
Here we will use Anaconda Python Setup for isolating enviornment of these CUDA setups.
The CUDA Toolkit is split between two conda packages:
cudatoolkit
– includes CUDA runtime supportcudatoolkit-dev
– includes the CUDA compiler, headers, etc. needed for application development
By default, conda gpu installation includes the cudatoolkit
runtime package, but not the cudatoolkit-dev
development package.
It is recommended to install and use compiler inside anaconda, so lets install both toolkit and compiler in freshly created conda environment.
conda install cudatoolkit-dev gxx_linux-64=7 cxx-compiler
-c conda-forge
The various CUDA Toolkit components are installed in the conda environment at:
$CONDA_PREFIX/bin
– CUDA executables: nvcc, cuda-memcheck, cuda-gdb, etc.$CONDA_PREFIX/lib64
– libraries for runtime and building applications$CONDA_PREFIX/include
– header files for building applications
You don’t need to put CUDA enviornment variable paths in ~/.bashrc as it will be activated on conda activate
and get removed when conda deactviate
.
Cheers !!!
Join the Discussion