-
[Alienware Aurora r12] CUDA, cudnn, anaconda, PytorchEnvironment Settings 2021. 9. 15. 23:50
1. CUDA 11.4 toolkit installation
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub sudo apt-get update sudo apt-get -y install cuda
After installation, have to sest paths
sudo sh -c "echo 'export PATH=$PATH:/usr/local/cuda-11.4/bin' >> /etc/profile" sudo sh -c "echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.4/lib64' >> /etc/profile" sudo sh -c "echo 'export CUDADIR=/usr/local/cuda-11.4' >> /etc/profile" source /etc/profile
check complete installation using nvcc -V
2. cuDNN 8.2.4 Installation
After login with nvidia account, push Download cuDNN button and download cuDNN installation file.
cd Downloads tar xvzf cudnn-11.4-linux-x64-v8.2.4.15.tgz sudo cp cuda/include/cudnn* /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
After unzip cudnn installation file, have to linking again
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8 sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn.so.8.2.4 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn.so.8 sudo ldconfig
Have to check initializing
ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep libcudnn
3. anaconda installation
https://www.anaconda.com/products/individual-d
install linux 64-Bit installer
sha256sum Anaconda3-2021.05-Linux-x86_64.sh 2751ab3d678ff0277ae80f9e8a74f218cfc70fe9a9cdc7bb1c137d7e47e33d53
we have to check our hash code is same with below link
https://docs.anaconda.com/anaconda/install/hashes/all/
after checking, now we can start installation conda
bash Anaconda3-2021.05-Linux-x86_64.sh >> enter >> ctrl+c >> yes >> yes
we have to linking
sudo gedit ~/.bashrc #add below line at the last export PATH=~/anaconda3/bin:~/anaconda3/condabin:$PATH
after save bashrf file, now we have to check complete installation of anaconda
source ~/.bashrc #(base) will come out front of user name conda -V
we have to initialize base prompt when start new terminal window
conda config --set auto_activate_base False
and now we can start anaconda with conda activate
when you want exit anaconda then conda deactivate
4. Pytorch Installation
create virtual conda environment
python --version conda create -n pytorch python=3.8 conda activate pytorch
pytorch installation at the virtual conda
conda install pytorch torchvision cudatoolkit=11.2 -c pytorch -c conda-forge
i installed cudatoolkit=11.4 but use 11.2 version ( there is no newest version for 11.4 )
you can check by using below code
(pytorch) kana@Alienware:~$ python Python 3.8.11 (default, Aug 3 2021, 15:09:35) [GCC 7.5.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> torch.__version__ '1.9.0.post2'
'Environment Settings' 카테고리의 다른 글
[Sublime Text 3] Ubuntu 18.04 에 Sublimtext3 설치 (0) 2021.02.10 Ubuntu 18.04 에서 Qt5.12.5, VTK 7.1, PCL 1.8 설치 (0) 2020.11.29