0

Until now, I had no problem with working with codes that deal with CUDA. I use pytorch a lot, and my codes all run great. When I type in

> nvidia-smi

, I get

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:01:00.0  On |                  N/A |
|  0%   49C    P8    17W / 300W |    744MiB / 11016MiB |     13%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   42C    P8     8W / 300W |     12MiB / 11019MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1173      G   /usr/lib/xorg/Xorg                           223MiB |
|    0      1404      G   /usr/bin/gnome-shell                         135MiB |
|    0      2459      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files    70MiB |
|    0      4744    C+G   .../local/MATLAB/R2019a/bin/glnxa64/MATLAB   309MiB |
+-----------------------------------------------------------------------------+

which, as far as I know means that I'm using CUDA version 10.2 along with graphics driver version of 440.100. Default location of CUDA install should be

/usr/local/cuda*

but my /usr/local does not show any version of CUDA. I tried to search for the solution of finding the location, and tried to do what others suggest as in [https://stackoverflow.com/questions/36279045/where-did-cuda-get-installed-in-my-computer], and it seems the only viable location among the lists is

/usr/lib/cuda

Is this the right directory? I am suspicious because I get

> nvcc - V

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

I'm confused because I really cannot find where CUDA is installed, while my pytorch codes are all working fine.

The reason why I'm trying to figure out where my CUDA is located is because I have to set up an environment in MATLAB so that I can compile a CUDA code, and when I try to compile, it throws an error saying

>> mexcuda foo.cu
Warning: Version 10.0 of the CUDA toolkit could not be found. If installed, set MW_NVCC_PATH environment variable to location of
nvcc compiler.
 
> In mexcuda (line 166) 
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.

Error in mexcuda (line 166)
    [varargout{1:nargout}] = mex(mexArguments{:});

Could anybody help me with my confusion?

C. Harry
  • 63
  • 7
  • 2
    The reason `nvcc -V` doesn't report anything is because your CUDA install was not done correctly. The mandatory steps [here](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions) were not performed correctly. You can start to figure this out by using a linux utility like `find` or `locate` (use man pages to learn how, please) to find your `nvcc` executable. Assuming there is only one, the path to it can then be used to fix your PATH var. Also [see here](https://stackoverflow.com/questions/53422407/different-cuda-versions-shown-by-nvcc-and-nvidia-smi). – Robert Crovella Aug 10 '20 at 16:02
  • 1
    The default install location of `/usr/local/cuda...` is correct if you use NVIDIA installers. However when you do `sudo apt install nvidia-cuda-toolkit` you are using an Ubuntu-provided installer, and they may (and do) do things differently, including default install location. – Robert Crovella Aug 10 '20 at 16:31
  • Thank you for the answers. I did install CUDA with ```sudo apt install nvidia-cuda-toolkit```and the paths were not set properly. Now it works! – C. Harry Aug 11 '20 at 07:05

0 Answers0