how to install supported CUDA Toolkit 10.2 on Ubuntu 20.04 LTS Linux

81 vues (au cours des 30 derniers jours)
Michal
Michal le 8 Déc 2020
Modifié(e) : Curt Corum le 1 Juin 2024
As you can see here, the CUDA Toolkit currently suported by R2020b is 10.2. But, as you can see here , the only supported version of Ubuntu Linux by CUDA Toolkit 10.2 is Ubuntu 16.04 and 18.04, not 20.04.
How can I install supported version of CUDA toolkit 10.2 on clean installation of Ubuntu 20.04? What is the official install procedure for Ubuntu 20.04 Linux??? Where can I find detailed description of CUDA toolkit 10.2 installation procedure for already officially supported Ubuntu 20.04?
The situatiion is even worst, because different versions of CUDA Toolkit requires different versions of GCC compilers, which are not officially supported by current version of MATLAB, see here. CUDA Toolkit 10.2 requires GCC 7, but GCC version supported GPU (CUDA) for R2020b is GCC 8.
So, I think that this situation is, at least, a bit confusing. But the fact is, that is absolutely not clear how to install currently supported CUDA toolkit (version 10.2) on currently supported linux distribution (Ubuntu 20.04), which is really strange?!
  5 commentaires
Michal
Michal le 8 Déc 2020
Modifié(e) : Michal le 8 Déc 2020
@Matt why you deleted your latest comment?
Matt: But NVIDIA created CUDA Toolkit 10.2. If they chose not to
support it on Ubuntu 20.04, what can MathWorks do? MathWorks has
no control over what NVIDIA chooses to support.
So, on Ubuntu 20.04 is not possible to operate Cuda kernel objects and GPU coder at all, even in a case when Ubuntu 20.04 officially supports these Matlab functionalities?
Matt J
Matt J le 11 Déc 2020
Modifié(e) : Matt J le 11 Déc 2020
So, on Ubuntu 20.04 is not possible to operate Cuda kernel objects and GPU coder at all, even in a case when Ubuntu 20.04 officially supports these Matlab functionalities?
I didn't quite understand that. Surely it is not Ubuntu developers that claim to support Matlab functionality. If anything it is the Mathworks, as the reseller, that claims to accomodate Ubuntu 20.04 users. It is a fair question how the Mathworks can claim to simultaneously accomodate Ubuntu 20.04 with CUDA Toolkit 10.2 if NVIDIA documentation says they are incompatiable, but surely the incompatibility is not something that Mathworks, as the reseller, could solve. It would require NVIDIA, as the OEM, to support Ubuntu 20.04 officially.

Connectez-vous pour commenter.

Réponse acceptée

Michal
Michal le 10 Déc 2020
After thorough discussion with Matlab support and several relevant forums (Ubuntu, NVIDIA, ...) the final result is as follows:
  1. Installation of NVIDIA CUDA Toolkit 10.x (only supported by recent version of MATLAB) on Ubuntu 20.04.x is very problematic or totally impossible task (depends on your Linux skills). Better forget it ... !!!
  2. The only possible way how to reliable install NVIDIA CUDA Toolkit 10.x together with recent Matlab on Ubuntu OS is downgrade to the Ubuntu 18.04 version
  3. Forthcoming Matlab version R2021a will be support NVIDIA CUDA Toolkit 11.0 (compatible with Ubuntu 20.04) which is probably good news, but so far not possible to verify it
So finally, if you're working on Ubuntu 20.04 LTS and want to use CUDA kernel objects or a GPU coder, you're out of the game.
Happy computing!!!

Plus de réponses (4)

Andrea Picciau
Andrea Picciau le 9 Déc 2020
Modifié(e) : Andrea Picciau le 9 Déc 2020
Hi Michal,
Parallel Computing Toolbox (and GPU coder from what I know) comes with its own version of the toolkit, so you shouldn't have to install anything. Are you seeing any problems with MATLAB on Ubuntu 20.04?
  5 commentaires
Andrea Picciau
Andrea Picciau le 9 Déc 2020
Based on your comments I would recommend you contacting MathWorks support who should be able to help you further. You can do that here: https://www.mathworks.com/support/servicerequests/create.html
Michal
Michal le 9 Déc 2020
I already did, but the only response of TMW support so far is: forthcoming version R2021a support Cuda toolkit 11.0.
I am not sure if this answer is acceptable for any customer!?

Connectez-vous pour commenter.


Curt Corum
Curt Corum le 27 Oct 2021
Modifié(e) : Curt Corum le 1 Juin 2024
Dear All,
If needed the following can be done...
Install gcc-8 on Ubuntu 20.04 according to instructions at:
Temporarily set gcc-8 as compiler version for gcc using:
(base) curt@asimov:~/ngfn_recon_uiowa_clean/matlab/gpuNUFFT/CUDA$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-9 90 auto mode
1 /usr/bin/gcc-8 80 manual mode
2 /usr/bin/gcc-9 90 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-8 to provide /usr/bin/gcc (gcc) in manual mode
Use script install of CUDA 10.2 from:
which will work on Ubuntu 20.04 even though not recommended.
Make sure to do your mex build with the above alternative gcc-8 setting and switch back when done.
I have used this to build gpuNUFFT mex binaries on Ubuntu 20.04, since gpuNUFFT does not perform well with later toolkit versions.
Hope this helps...

Rachel
Rachel le 19 Oct 2022
Installation
Step 1. Pre-installation Actions
In this step, please check whether your system is cuda-supported.
Note:
  • gcc version is important, please refer to Table 1 in the link. Recommend: gcc-7.
  • See Error case 1 to check and set default gcc version.
  • When downloading cuda-toolkit, recommend to use runfile(local), because for some reason, I tried deb(local) and deb(network), both failed.
Step 2. Package Manager Installation
If you use runfile(local), then there is no need to Install repository meta-data and Installing the CUDA public GPG key. You can directly execute:
1
2
sudo apt-get update
sudo apt-get install cuda
If the installation is broken, try:
1
sudo apt --fix-broken install
Step 3. Check installation
You can check whether you have successfully installed cuda by:
1
nvidia-smi
Then you will get something like this:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 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 2060 On | 00000000:01:00.0 On | N/A |
| 45% 35C P8 10W / 160W | 1062MiB / 5931MiB | 2% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1174 G /usr/lib/xorg/Xorg 40MiB |
| 0 1309 G /usr/bin/gnome-shell 51MiB |
| 0 1536 G /usr/lib/xorg/Xorg 511MiB |
| 0 1679 G /usr/bin/gnome-shell 174MiB |
| 0 2165 G ...quest-channel-token=1797818128468897323 160MiB |
| 0 3936 G ...uest-channel-token=17969104812798294633 118MiB |
+-----------------------------------------------------------------------------+
Step 4 Set environment variables
The PATH variable needs to include /usr/local/cuda-10.2/bin and /usr/local/cuda-10.2/NsightCompute-. refers to the version of Nsight Compute that ships with the CUDA toolkit, e.g. 2019.1.
To add this path to the PATH variable:
1
$ export PATH=/usr/local/cuda-10.2/bin:/usr/local/cuda-10.2/NsightCompute-2019.1${PATH:+:${PATH}}
In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-10.2/lib64 on a 64-bit system, or /usr/local/cuda-10.2/lib on a 32-bit system
  • To change the environment variables for 64-bit operating systems:12$ export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  • To change the environment variables for 32-bit operating systems:12$ export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Error cases
1. Modify default gcc version
Step 1. Install different gcc versions using apt-get, for example:
1
sudo apt-get install gcc-4.8
1
sudo apt-get install gcc-7
Step 2. Check if gcc is installed successfully:
1
gcc --verison
or
1
gcc-7 --version
Step 3. Check priority of gcc1
sudo update-alternatives --config gcc
You can see something like this:8
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Step 4. Modify priority of gcc
1
sudo update-alternative --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
Then you can see the priority of gcc-7 is set to be 100. You can check using the command in Step 3.
Regards,
Rachel Gomez
  2 commentaires
Michal
Michal le 20 Oct 2022
"gcc version is important, please refer to Table 1 in the link. Recommend: gcc-7."
Where is the "link"?
Michal
Michal le 20 Oct 2022
Your installation info is a bit obsolete.
  1. Now (R2022b) is supported cuda 11.0 ... see here.
  2. Officially supported gcc compilers are now gcc-7, ..., gcc-10. See here.
So finally, could you verify and update your CUDA installation steps for recent state of TMW support for Ubuntu 20.04 and/or 22.04, too?

Connectez-vous pour commenter.


Andrea Picciau
Andrea Picciau le 23 Nov 2023
Modifié(e) : Andrea Picciau le 12 Déc 2023
This page from the documentation might help! Requires at least MATLAB R2023b.

Catégories

En savoir plus sur Get Started with GPU Coder dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by