9

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

MysteryGuy
  • 1,091
  • 2
  • 18
  • 43
  • If the install was done [correctly](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#mandatory-post) then the PATH environment variable will be set up. What is the result of running `which nvcc` ? – Robert Crovella Apr 10 '17 at 13:45
  • 1
    @RobertCrovella I did not know this command but it gives it: /usr/local/cuda-6.5/bin/nvcc. I found it. Moreover, I found an other thing that troubled me ! Thanks a lot, you make my day ending fine :-) – MysteryGuy Apr 10 '17 at 15:39
  • so the include directory should be `/usr/local/cuda-6.5/include` and the lib directory should be `/usr/local/cuda-6.5/lib64` – Robert Crovella Apr 10 '17 at 15:45
  • @RobertCrovella Yes Indeed. However I see that, in usr/local, there is an other folder called cuda which looks the same than cuda-6.5. which one should I use? – MysteryGuy Apr 10 '17 at 15:56
  • the `cuda` folder should be symlinked to `/usr/local/cuda-6.5` if the install was done correctly. symlinking is linux - you're short on linux skills. – Robert Crovella Apr 10 '17 at 15:56
  • @RobertCrovella Probably; i'm a student so I have still a lot of things to learn... So basically, when I'll create the Path in Qt, I should use cuda-6.5 ? – MysteryGuy Apr 10 '17 at 16:19
  • You should be able to use either one. read up on what a linux symbolic link is. If you want Qt scripts to use cuda 6.5 even if other versions get installed later, then use the cuda-6.5 path. If you want Qt scripts to use the latest version of cuda that is installed on the machine, use the cuda path. The symlink should get updated as newer versions are installed, again assuming typical/proper install processes. – Robert Crovella Apr 10 '17 at 16:22
  • @RobertCrovella Ok, thanks for your answer – MysteryGuy Apr 10 '17 at 16:25

1 Answers1

10

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.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • 1
    I'm unable to get my cuda running when I type $which nvcc i get the below /usr/bin/which: no nvcc in (/opt/continuum/anaconda/envs/lab_launch/bin:/opt/continuum/anaconda/condabin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin) – stack user Mar 03 '21 at 22:42