1

I just setup my Ubuntu 16.04 workstation with an Nvidia GTX 1070, having successfully installed the latest driver through the graphics-drivers PPA following the instructions here.

The nvidia-367 driver made it possible for my GPU to work correctly on my system, correcting the resolution when previously it was totally off when it was still running Nouveau.

I'm not using my machine for gaming, but for data science, so I needed the CUDA toolkit chain (the suite of tools covering NVCC, the CUDA accelerated libraries, and so forth), so I proceeded to install them using the single command of sudo apt-get install nvidia-cuda-toolkit. The whole installation proceeded well, but at the end, I realized I was missing one thing: CUDA code samples!

Even after searching high and low, I have not been able to figure out a way to carry out a standalone installation of the CUDA code samples into my system. From what I understand of the Nvidia documentation , these samples would get automatically installed when I install the CUDA toolkit through a .deb or .run file downloaded from the Nvidia CUDA downloads webpage.

So my questions are:

  • Is there any way that I could obtain the source files for the Nvidia CUDA samples? Just the raw source files, together with the correct Makefile, so that I can compile these samples and run them without going through the whole Nvidia CUDA toolkit installer?

  • Otherwise, has anyone had experience using the Nvidia installer, and if so, does anyone know whether I can skip the CUDA toolkit installation (since I've already done that through apt-get) and just use the installer to download the CUDA samples?

And my follow up question to this is:

  • Am I doing something wrong by not installing CUDA toolkit using Nvidia installer? What's the difference between using that and apt-get? For one, I kind of noticed that there seems to be a difference in the locations of where the CUDA binaries get installed. Using apt-get, tools like NVCC and NVProf have their binaries sitting in my /usr/bin folder (they can also be found in /usr/lib/nvidia-cuda-toolkit/bin; my guess is that they were first compiled and stored under /usr/lib/nvidia-cuda-toolkit/bin but the later copied to /usr/bin). But it seems like using the Nvidia installer, they would end up somewhere else, as the documentation advises modifications to be made to one's $PATH environment variable.

I would greatly appreciate even a partial answer to any one of the few questions that I have posted here, or alternative suggestions to the way I am thinking about this. Thank you!

  • Just to augment my post, the link to the Nvidia documentation that explains how the install and run the CUDA samples can be found here: [docs.nvidia.com/cuda/cuda-installation-guide-linux/… while the link to the CUDA toolkit download page, where the .run or .deb installer can be found, is here: [developer.nvidia.com/cuda-downloads]. – AKKA Aug 16 '16 at 0:23
  • Quoting from the documentation, it states that: in order to modify, compile, and run the samples, the samples must be installed with write permissions. A convenience installation script is provided: $ cuda-install-samples-7.5.sh <dir> This script is installed with the cuda-samples-7-5 package. The cuda-samples-7-5 package installs only a read-only copy in /usr/local/cuda-7.5/samples. – AKKA Aug 16 '16 at 0:23
  • Does the nvidia-cuda-doc package contain the files you're looking for? – steeldriver Aug 16 '16 at 0:27
  • Unfortunately, no. In fact, all the CUDA sample files that I am looking for is listed on docs.nvidia.com/cuda/cuda-samples/index.html#samples-reference . – AKKA Aug 16 '16 at 0:38
1

I have exactely the same issue. I am trying to test my working setup with Ubuntu 16.04 and GTX1080 with CUDA 7.5 for parallel computing, and was hoping to easily get this done by using the packages provided in the repos. Unfortunately as noted above they are missing. It is possible to use the runfile install for installing only the samples. See e.g. for an older version:

https://stackoverflow.com/questions/27306724/ubuntu-14-04-how-to-install-cuda-6-5-without-installing-nvidia-driver

This works also for 7.5. Simply say "no" when prompted for driver and toolkit installation. You will also need to set the right toolkit libraries. This installs cuda samples into your home by default. However there seem to be an issue with libraries not being found as the package from the repo also puts them into a different location.

However some simple samples like matrixMul compile and run fine.

There might be a simple workaround by adding the right path, but probably installing at least cuda-toolkit together with samples from the runfile should make it work 'out-of-the-box' - have not tried it yet...

  • Well as far as I can see the post answers the question as it discusses how to install the cuda samples on Ubuntu 16.04, without installing the other components (driver, toolkit) - exactly what was asked for. – p-rom Aug 29 '16 at 20:38
  • Your response does ans my question. But I would like to share that since that time I, I have decided to remove the toolkit I installed through apt-get, and to install toolkit 8 through the Nvidia installer. See this [link](yangcha.github.io/GTX-1080 ) that I followed. When using the pascal GPUs, its actually more beneficial to install by the Nvidia installer, using toolkit 8. Apt-get installs the older version 7.5, which is not targeted for pascal. Before I did that, I had to sudo apt-get purge --auto-remove nvidia-cuda-toolkit to prevent any conflicts between the library versions. – AKKA Aug 30 '16 at 1:30
  • Also note that if your gcc is at version 5.4, you will need to run the installer with --override option first, before you run the patch file fomr Nvidia (you will know what I mean when you go to the Nvidia CUDA toolkits 8 downloads page, and download the .run file) – AKKA Aug 30 '16 at 1:33
1

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.)

0

Here are the directions I followed:

  1. go to the CUDA website
  2. download the .run file
  3. install the .run file after hitting ctrl+alt+f1 to enter into terminal mode
  4. close the x-window system running in the background
  5. install an nvidia driver at least version 371
  6. install cuda by running the .run file. do not install the advanced nvidia driver when it prompts you.
  7. reboot
  8. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.