Ubuntu 17.10 comes with CUDA 8 which relies on clang 3.8 (e.g. see this blogpost).
However, I'd like to install CUDA 9 and rely on GCC if possible. How can I do this?
Ubuntu 17.10 comes with CUDA 8 which relies on clang 3.8 (e.g. see this blogpost).
However, I'd like to install CUDA 9 and rely on GCC if possible. How can I do this?
Installation of NVIDIA driver 384
First we install a fresh Ubuntu 17.10 on a computer with an NVIDIA GPU and select "Install third-party software" during the process. Alternatively, we can add the graphics drivers repository manually:
Then we install the most recent NVIDIA driver using apt:
We verify the installation by running:
We should see an output which lists the NVIDIA 384 driver and our discrete NVIDIA GPU - similar to summarized table below:
Preparation for installing of CUDA 9 + SDK
We install a number of build/dev packages which we require later:
We notice that the default gcc/g++ version on 17.10 is
7.2.0 (Ubuntu 7.2.0-8ubuntu3)
:CUDA 9 requires gcc 6. Thus, we install it:
Note that the default gcc version is still
7.2
; can be checked by runninggcc -v
again.Installation of CUDA 9 + SDK
From the CUDA Toolkit Archive, select one of the "runfile (local)" installation packages to download a version of CUDA 9, such as
Make the downloaded file executable and run it using sudo:
We install CUDA with the following configurations:
Set up symlinks for gcc/g++:
Test the CUDA 9 installation using the SDK
Build your favorite CUDA sample and run it:
You may like to set up gcc/g++ symlinks after the cuda install.
Getting this installed took more time than I would like to admit, and while the above answer is a good template, I had some additional steps required for my fresh install of Ubuntu 17.10:
blacklist nouveau
Add the following:
Update initramfs disk
Stop gdm3
Get content
Get the package
Run with --override to override compiler choice
After installing the package, I would get errors with nvidia-smi, so I suggest running the command again to verify it works. When I had issues, I would purge nvidia* and re-get it.
I followed the accepted answer (@ubashu) and everything went well (if not exactly the same, the instructions would lead to the correct path). I would only had the export to Path (as specified also on https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)
After that you can use nvcc -V to check if the install really went well.