Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't find cuda lib and include on ubuntu

Tags:

cuda

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)

Thanks

like image 515
MysteryGuy Avatar asked Apr 10 '17 12:04

MysteryGuy


People also ask

How do I find my cuda path in Ubuntu?

By default, the CUDA SDK Toolkit is installed under /usr/local/cuda/. The nvcc compiler driver is installed in /usr/local/cuda/bin, and the CUDA 64-bit runtime libraries are installed in /usr/local/cuda/lib64. Add /usr/local/cuda/bin to your PATH environment variable.


1 Answers

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.

like image 190
Robert Crovella Avatar answered Oct 19 '22 03:10

Robert Crovella