Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple CUDA versions on machine nvcc -V confusion

Tags:

I used to have cuda-7.0 installed on my machine and later un-installed cuda-7.0 and installed cuda-8.0. When I go to my /usr/local folder I see the following folders:

/bin/ /cuda/ /cuda-7.0/ /cuda-8.0/ /etc/ /games/ /include/ /lib/ /lua/ /man/ /MATLAB/ /sbin/ /share/ /src/ 

I guess I'm confused since the /cuda/version.txt file says it is on cuda-8.0, but when I type:

$ nvcc -V 

it reports that I'm using version 7.0:

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2015 NVIDIA Corporation Built on Mon_Feb_16_22:59:02_CST_2015 Cuda compilation tools, release 7.0, V7.0.27 

What still puzzles me is that even if I do:

export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH export PATH=$PATH:/usr/local/cuda-8.0/bin 

after I type $ nvcc -V , it still outputs version 7.0.

Edits:

$ which nvcc /usr/local/cuda-7.0/bin/nvcc  $ echo $PATH /home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/cuda-7.0/bin 
like image 662
Arturo Avatar asked Nov 09 '16 22:11

Arturo


People also ask

Can I have 2 different CUDA versions?

There is only one requirement, that one needs to satisfy in order to install multiple CUDA on the same machine. You need to have latest Nvidia driver that is required by the highest CUDA that you're going to install. Usually it is a good idea to install precise driver that was used during the build of CUDA.

Are CUDA versions backwards compatible?

The CUDA driver maintains backward compatibility to continue support of applications built on older toolkits. Using a compatible minor driver version, applications build on CUDA Toolkit 11 and newer are supported on any driver from within the corresponding major release.


2 Answers

Solution as suggested in the comments:

export PATH=/usr/local/cuda-8.0/bin:$PATH 

The problem was the ordering of $PATH, that my previous command had the =$PATH:/usr/local... instead of =/usr/local....:$PATH

like image 171
Arturo Avatar answered Oct 01 '22 01:10

Arturo


I faced a similar issue after upgrading from cuda-8.0 to cuda-9.2.

Solution is to change the following in .bashrc file:

export CUDA_HOME="/usr/local/cuda-9.2" export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib64:$LD_LIBRARY_PATH" export PATH="/usr/local/cuda-9.2/bin:$PATH" 
like image 36
Raj Mohan Avatar answered Oct 01 '22 01:10

Raj Mohan