MysteryGuy
MysteryGuy

Reputation: 1151

can't find cuda lib and include on ubuntu

I have a Nvidia graphic card where cuda is installed. I use qt as IDE and in my .pro, I need to put the include and libs path of cuda. Unfortunately, it's not me who configured the graphic card and the people who did it don't remind where they put the libs and include files... How is it possible to find them quickly (or where could they be).

(I work on Ubuntu)

Upvotes: 12

Views: 35946

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151839

You can use basic linux commands like this:

If the CUDA install was done correctly, the PATH environment variable will be properly set up. In that case you can use the linux which command to find the path to nvcc executable:

which nvcc

The result, e.g. /usr/local/cuda-6.5/bin/nvcc, will give you the path to the CUDA install, it is just everything leading up to the /bin/nvcc part, i.e.

/usr/local/cuda-6.5

From there you can construct the include path by appending /include and the (64-bit system) lib path by appending /lib64:

/usr/local/cuda-6.5/include
/usr/local/cuda-6.5/lib64

If your PATH environment variable is not set up properly, you may need to search your system e.g. for nvcc. The linux find command may be useful for this, however it's most easily decipherable if you can run it as root:

sudo find / -name nvcc

You will hopefully then get some output that shows the path to nvcc on your system. From there you should follow the install instructions to add it to your PATH environment variable.

A proper install will usually also create a folder /usr/local/cuda which is symlinked to the current CUDA version in use.

Upvotes: 12

Related Questions