Background of my questions
I have an old Lenovo ThinkPad W530 laptop with NVIDIA Corporation GK107GLM [Quadro K1000M] / Quadro K1000M/PCIe/SSE2 GPU which is with compute compatibility 3.0 and is supporting CUDA. I want to build some TensorFlow examples and project on Ubuntu for my Udacity nanodegree.
I just installed Ubuntu 20.04 and upgraded my NVIDIA drivers so when I execute nvidia-smi
it gives me the following result:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.51.05 Driver Version: 450.51.05 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Quadro K1000M On | 00000000:01:00.0 Off | N/A |
| N/A 59C P0 N/A / N/A | 496MiB / 1999MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 5470 G /usr/lib/xorg/Xorg 39MiB |
| 0 N/A N/A 7504 G /usr/lib/xorg/Xorg 146MiB |
| 0 N/A N/A 7772 G /usr/bin/gnome-shell 147MiB |
| 0 N/A N/A 34770 G /proc/self/exe 158MiB |
+-----------------------------------------------------------------------------+
As I am trying to build the TensorFlow Code using GPU support, I found out that I need to install CUDA and follow this article about how to install latest version of CUDA 11.0 on Ubuntu 20.04. I went through the whole path and then I found out two problems:
- My GPU is only support Compute Compatibility 3.0 while the minimum support for TensorFlow is 3.5
- To overcome problem 1, I have to build the tensor flow from sources to get a build that supports CUDA 3.0 and to do that I have to use CUDA 10.1 which means I have to start from the beginning.
I removed CUDA 11.0 following the CUDA documentation. I started to install CUDA 10.1 on Ubuntu 20.04 and now I got confused.
CUDA 10.1 installation documentation process is about installing CUDA 10.1 from a .deb
file for Ubuntu 18.04 and there is no support for CUDA 10.1 on Ubuntu 20.04.
So I started to follow the same steps of the article but for CUDA 10.1 instead CUDA 11. I was able to install cuda 10.1 using the command:
sudo apt-get -f install cuda-toolkit-10-1 cuda-libraries-10-1
so that I don't override my installed NVIDIA driver 450 (I did that after several trials).
When I tried to execute command
sudo apt install nvidia-cuda-toolkit
It gave me errors due to dependency problems. To overcome these errors I searched for a solution and then I came across this article which is recommending that:
For the sake of being verbose, do not try to use 18.10 or 18.04 CUDA 10.1 for Ubuntu 20.04. I learned that the hard way, lol!
So, you can install CUDA 10.1 in Ubuntu 20.04 by running,
$ sudo apt install nvidia-cuda-toolkit
I uninstalled CUDA Toolkit 10.1 that I installed using CUDA documentation and I followed this recommendation and the command passed successfully. But now I am not sure if this is it, or am I missing something?!
When I tried to know the different between both ways I found out that the source of nvidia-cuda-toolkit
using the command
apt-cache policy nvidia-cuda-toolkit
it gives me the following result that indicates that the source is the Ubuntu repositories
nvidia-cuda-toolkit:
Installed: 10.1.243-3
Candidate: 10.1.243-3
Version table:
*** 10.1.243-3 500
500 http://eg.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages
100 /var/lib/dpkg/status
My Questions
- If the official installation documentation of CUDA 10.1 for Ubuntu 18.04 as well as CUDA 11 for Ubuntu 20.04 doesn't indicate any thing regarding installing the package of
nvidia-cuda-toolkit
so what is the difference betweennvidia-cuda-toolkit
andcuda-toolkit-10-1
? - Is it enough as indicated by the article to only install
nvidia-cuda-toolkit
if I am trying to use CUDA toolkit 10.1? - Is CUDA 10.1 runtime libraries are now installed? If not, How can I install them right now? should I remove the
nvidia-cuda-toolkit
or can I follow the steps from the documentation? - How can I validate my installation?
- When I tried to build CUDA Samples, didn't find the
cuda-install-samples-10.1.sh
file in my installation. How can I install the samples?
I have been working on trying to build my examples and so far I failed to do that, so I really appreciate your support for this.
For anyone still looking for a solution, I don't have the answer, but I can point you to a couple to resources that do:
For posterity sake, these are the steps (kudos to Stephen Gregory):
1. Clean up
(a) Open a terminal window and type the following three commands to get rid of any NVIDIA/CUDA packages you may already have installed:
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove --autoremove nvidia-cuda-toolkit
sudo apt remove --autoremove nvidia-*
(b) Purge any remaining NVIDIA configuration files and the associated dependencies that they may have been installed with.
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
(c) Remove any existing CUDA folders you may have in /usr/local/
sudo rm -rf /usr/local/cuda*
2. Install
(a) Setup your CUDA PPA. (Read here if you're curious about what a PPA is.)
sudo apt update
sudo add-apt-repository ppa:graphics-driverssudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pubsudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda_learn.list'
(b) Install CUDA 10.1 packages, including the CuDNN library
sudo apt update
sudo apt install cuda-10-1
sudo apt install libcudnn7
3. Add CUDA to PATH
(a) After installing, we need to add CUDA to our PATH, so that the shell knows where to find CUDA. To edit our path, open up the '.profile' file using vim.
sudo vim ~/.profile
(b) Finally, add these lines to the end of the file.
set PATH for cuda 10.1 installation\
if [ -d "/usr/local/cuda-10.1/bin/" ]; then
export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi
4. Reboot
(a) Reboot your computer (as you should after any driver install)
5. Final Check
Now, let's check to make sure everything's set up!
(a) Check NVIDIA Drivers:
nvidia-smi
(b) Check CUDA:
nvcc --version
(c) Check CuDNN
/sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep libcudnn