CUDA sample code did not get installed through sudo apt-get install nvidia-cuda-toolkit; any solutions?
NVIDIA has released the samples here: https://github.com/NVIDIA/cuda-samples
Make sure to get the version corresponding to your CUDA version (starting from v9.2): https://github.com/NVIDIA/cuda-samples/releases
(I think this repo might miss some samples that were available in the installer, but I'm not sure.)
Here are the directions I followed:
- go to the CUDA website
- download the .run file
- install the .run file after hitting ctrl+alt+f1 to enter into terminal mode
- close the x-window system running in the background
- install an nvidia driver at least version 371
- install cuda by running the .run file. do not install the advanced nvidia driver when it prompts you.
- reboot
- test by building the 1_utilities/deviceQuery sample and running it. It should say Result = Pass at the end.
This was difficult because the advanced nvidia driver that the .run file tried to install was incompatible with my desktop environment, but the versions of the nvidia driver in my ppi were too old for CUDA. So, I had to find a ppa with a more recent nvidia driver.