Tensorflow 1.x 버전을 사용하기 위해 RTX 2080 TI PC 에 환경 구성을 하고자 한다.
(RTX 30 대 부터는 CUDA >=11.0 만 호환 돼 Tensorflow 1.x 버전을 사용할 수 없다.)
What will be installed:
- RTX 2080 ti
- Ubuntu 18.04
- nvidia-driver 440.x
- CUDA 10.0
- cuDNN 7.6.5
1.nvidia driver 설치
아래 명령어를 통해 nvidia-driver 440 설치
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update
$ sudo apt install nvidia-driver-440
$ sudo reboot # 설치 후 재부팅
설치를 완료 한 후 nvidia-smi 를 통해 설치 여부를 확인
$ nvidia-smi
2. CUDA 설치
아래 URL에서 CUDA Toolkit 10.0 설치
CUDA Toolkit 10.0 Archive
Select Target Platform Click on the green buttons that describe your target platform. Only supported platforms will be shown. Operating System Architecture Distribution Version Installer Type Do you want to cross-compile? Yes No Select Host Platform Click
developer.nvidia.com
Download 디렉토리로 이동 후
$ sudo sh cuda_10.0.130_410.48_linux.run
% More(%) --> space 연타하여 스킵
% Eula --> accept
% accelrated nvidia graphic driver --> no
% cuda 10.0 toolkit --> yes
% location[/usr/local/cuda-10.0] --> enter
% symbolic link [/usr/local/cuda] --> yes
% cuda sample --> no
이후 bashrc 편집
$ sudo gedit ~/.bashrc
마지막줄에 아래 내용 추가
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
bashrc 적용
$ source ~/.bashrc
nvcc -V 를 통해 설치 확인
$ nvcc -V
>>'Cuda compilation tools, release 10.0, V10.0.130'
$ whereis cuda # 쿠다 설치 위치 확인
$ sudo apt-get autoremove --purge 'cuda*' # CUDA 삭제
3. cuDNN 설치
https://developer.nvidia.com/rdp/form/cudnn-download-survey
- cuDNN Runtime Library for Ubuntu18.04 (Deb)
- cuDNN Developer Library for Ubuntu18.04 (Deb)
- cuDNN Code Samples and User Guide for Ubuntu18.04 (Deb)
$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.0_amd64.deb
$ sudo reboot
4. Anaconda3 설치
https://www.anaconda.com/products/distribution
Anaconda | Anaconda Distribution
Anaconda's open-source Distribution is the easiest way to perform Python/R data science and machine learning on a single machine.
www.anaconda.com
# sudo sh 로 설치하지 말것
sh Anaconda3-2022.05-Linux-x86_64.sh
설치 도중 나오는 질문에 대하여 yes / accept / enter 로 진행
5. 설치확인 및 가상환경 생성
새 터미널 실행 (중요)
$ conda create -n [가상환경이름] python=[버전] anaconda # # anaconda 추가하면 기본 라이브러리가 함께 설치
tf 설치
conda install tensorflow-gpu==1.13 # 버전 입력
conda install pytorch==1.3.1 torchvision cudatoolkit=10.0 -c pytorch
Tensorflow 정상설치 확인
import tensorflow as tf
tf.test.is_built_with_cuda()
tf.config.list_physical_devices('GPU') # tensorflow >=2.4.0
tf.test.is_gpu_available('GPU') #tensorflow 1.x
tf.sysconfig.get_build_info()
Torch 정상설치 확인
import torch
torch.cuda.get_device_name(0)
torch.cuda.is_available()
torch.__version__
이하 RTX 3090 + Ubuntu 20.04 작성중...
What will be installed
- TensorFlow v2.5.0
- PyTorch v1.9.0
- CUDA v11.1
- cuDNN v8.2.1
- Dependencies and other frameworks like Caffe and Theano
- Ubuntu 20.04 LTS (Focal Fossa)
From : https://lambdalabs.com/blog/install-tensorflow-and-pytorch-on-rtx-30-series/
Install TensorFlow & PyTorch for the RTX 3090, 3080, 3070
Instructions for getting TensorFlow and PyTorch running on NVIDIA's GeForce RTX 30 Series GPUs (Ampere), including RTX 3090, RTX 3080, and RTX 3070.
lambdalabs.com
2. https://uhou.tistory.com/207
RTX 3090을 사용한 딥러닝 실험환경 구축하기 (Ubuntu 18.04)
실험용 워크스테이션 서버에 GeForce RTX 3090을 장착하여 사용하게 되었습니다. 직접 GPU를 교체하지는 않았고 기사님께서 오셔서 설치를 해주셨는데, GPU 장착 이후에 제가 Ubuntu 18.04 x86_64 운영체
uhou.tistory.com
'ML or DL > 개발환경' 카테고리의 다른 글
[Jupyter notebook] notebook 폰트 변경 (0) | 2022.01.20 |
---|---|
[딥러닝 환경구축] Pytorch 설치 / RTX 3090 에 맞는 pytorch 설치 (0) | 2021.10.26 |
[Jupyter notebook] Jupyter Notebook에서 import torch 안될 때 (0) | 2021.10.26 |
Termnial Command (0) | 2021.09.01 |
Anomaly Detection 알고리즘 별 딥러닝 환경 (0) | 2021.09.01 |