Reputation: 8038
I'm on a shared machine and don't have root.
My code dies with the following CUDA error
CUDA driver version is insufficient for CUDA runtime version
I want to build my program for the older toolkit. I would assume that this is possible as commercial applications are distributed with support for something earlier then the latest toolkit (?).
I have played around with the arch
flag, but have no success.
nvcc -arch=compute_13 fun.cu
nvcc -arch=compute_20 fun.cu
Whats the flag to compile to an earlier toolkit version?
In my case I have a version 4
toolkit, but I believe the driver only does version 3
.
Upvotes: 0
Views: 2080
Reputation: 12109
First you will need to download and install the older toolkit to your home directory.
Once it is done, you can do the following.
Set CUDADIR=path/to/cuda/ in your .bashrc
Once you have that, you if you are using Makefile, you can use $(CUDADIR)/bin/nvcc
as your compiler, and $(CUDADIR)/lib64
for your library path, $(CUDADIR)/include
for your include path.
If you are using a shell script or are compiling on command line, use $CUDADIR/bin/nvcc
and so on.
Another alternative would be to prepend $CUDADIR/bin to your $PATH like the following in your .bashrc.
CUDADIR=/home/username/cuda
export PATH=$CUDADIR/bin:$PATH
export LD_LIBRARY_PATH=$CUDADIR/lib64:$LD_LIBRARY_PATH
Once your system is updated, you can just change the path pointed by CUDADIR to the new location and you won't have to change anything else.
The -arch
flags are to specify the architecture not the toolkit versions.
Upvotes: 1
Reputation: 152249
I'm not aware of command line flags or similar options to tell a CUDA 4.x toolkit to behave as if it were a CUDA 3.x toolkit, for example.
And as you've discovered, for a particular version of the toolkit, a particular driver version (or newer) is required.
One approach would be to install your desired toolkit on your own. You don't need root privilege for this, but you will need some disk space in your user directories. Select a desired toolkit from the archive and install it onto a local directory in your user directory space. (The toolkit will prompt you for an install location, and to get additional toolkit install options you can do: sh <toolkit filename> --help
). Once you have installed the toolkit to your local directory, e.g. /home/user/cuda, then modify your PATH to include /home/user/cuda/bin (before any other cuda directories, such as /usr/local/cuda/bin) and your LD_LIBRARY_PATH to include /home/user/cuda/lib and /home/user/cuda/lib64 (before any other cuda lib directories.) If you want to make these permanent you can edit your .bashrc file or use a similar approach, depending on distro/shell. You should then be able to type your nvcc compile commands normally. If you are linking in any specific libraries like cublas, etc. you will need to point to the cublas library in your local directory using the -L compiler/linker switches as usual.
The driver is not affected by any of this, nor is the cuda toolkit installed in a community location such as /usr/local/cuda. If you revert your PATH and LD_LIBRARY_PATH environment variables, you should restore the previous functionality of using the cuda toolkit installed in the community location.
Upvotes: 2