HOW TO install nVIDIA CUDA toolkit , cudnn and nvcc and tensorflow2.5.0+keras, and Pytorch on UBUNTU
HOW TO install nVIDIA CUDA toolkit and nvcc and tensorflow2.5.0+keras, and Pytorch on UBUNTU
I installed it on UBUNTU 20.04.
I using version 11.1 and the file is .deb to install:
because on the Pytorch website, they have the 11.1 version now, so I installed the 11.1 version.
but after few days, I found I can't using FFmpeg with GPU, then I purge all nvidia* and installed 11.3 version.
before install:
before install, if your nVIDIA driver is higher than 455.23, you need to purge Nvidia drivers:
sudo apt-get purge nvidia*
Install CUDA:
Cuda download page: https://developer.nvidia.com/cuda-11.1.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=2004&target_type=deblocal
using above page's command
or for newest version cuda-toolkit 11.3
after installed, then you need to setup ~/.bashrc
$ nano ~/.bashrc
then Scroll to the bottom and add the following lines, you can change the red part to suit your version:
#NVIDIA CUDA Toolkitexport PATH=/usr/local/cuda-11.3/bin/:$PATHexport LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64
then execute
$ source ~/.bashrc
maybe reboot now is better:
$ sudo reboot now
then you can check your cuda-toolkit version and GPU driver version==>
$ nvidia-smi
$ nvcc --version
or
install cudnn:
cudnn download page: https://developer.nvidia.com/rdp/cudnn-download
$ tar -zxf cudnn-11.3-linux-x64-v8.2.0.53.tgz
$ cd cuda
$ sudo cp -P lib64/* /usr/local/cuda/lib64/
$ sudo cp -P include/* /usr/local/cuda/include/
$ cd ~
install Tensorflow 2.5.0:
pip install tensorflow
if you install Keras's version is higher than Tensorflow 2.0 (I installed the TensorFlow 2.5.0 in virtualenv), in Python, the Keras import need change to :
import tensorflow as tffrom tensorflow.keras import layers
install Pytorch:
pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
留言
張貼留言