tensorflow를 pip 대신 conda로 깔면 밑에 cuda, cdnn을 까는 삽질을 안해도 된다고 한다 ㅠㅠ
하...내 시간 ㅜㅜ 알아서 다 해준다는데...왜.... 밑에 것 보세요....
conda install tensorflow하면 된다함. 끝
https://medium.com/analytics-vidhya/why-conda-install-instead-of-pip-install-ba4c6826a0ae
** 현재 (2021.06.28) 쓰고 있는 우분투는 최신 버전인 우분투 20으로 아래 기술한 것과는 상이하다
나는 아나콘다를 최신버전으로 공홈가서 다운받아 깔았고, 가상환경 만든 다음에 이 웹페이지
를 보고 따라해봤다.
그 외 참고 페이지
https://ieworld.tistory.com/12
https://webnautes.tistory.com/1423
- Open Terminal :
ctrl + alt + t - 아나콘다 깔기 :
$ cd ~/Downloads && wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh && bash Anaconda3–2020.02-Linux-x86_64.sh && exit
or
공홈가서 직접 설치파일 다운받아 깔아주기 - 가상환경 설정 :
$ conda create -n aiffel python=3.7 -y && conda activate aiffel - conda install anaconda
conda install notebook
conda install matplotlib
conda install tensorflow-gpu==2.2.0
conda install pandas
conda install seaborn
conda install cmake -y
각각 설치해 주고 - GPU 확인 :
nvidia-smi
입력해서 GPU 정보 안뜨면 - nvidia 글카 깔아주기 :
- $ sudo add-apt-repository ppa:graphics-drivers/ppa $ sudo apt-get update -y && sudo apt-get install nvidia-driver-440 -y && sudo reboot
- 아니면 공홈에 들어가서 내 gpu 버전에 맞는 그래픽 카드 깔아주면 됨.
- Cuda, Cudnn 버전 맞춰서 공홈에서 다운받아 깔아주기
- 제발 버전 맞춰서 깔자! https://www.tensorflow.org/install/source_windows?hl=en#gpu 여기 들어가면 다 있다.
- cudnn은 https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#install-windows 이 사이트 보고 각자의 os에 맞춰서 순서대로 깔아준다.
- [아래는 윈도 버전 해당 링크]
- unzip한 후에 cudnn에서 cuda로 bin/include/lib 파일들 각각 복붙
- Navigate to your <installpath> directory containing cuDNN.
- Unzip the cuDNN package.cudnn-x.x-windows-x64-v8.x.x.x.ziporcudnn-x.x-windows10-x64-v8.x.x.x.zip
- Copy the following files into the CUDA Toolkit directory.
- Copy <installpath>\cuda\bin\cudnn*.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x\bin.
- Copy <installpath>\cuda\include\cudnn*.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x\include.
- Copy <installpath>\cuda\lib\x64\cudnn*.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x\lib\x64.
- Set the following environment variables to point to where cuDNN is located. To access the value of the $(CUDA_PATH) environment variable, perform the following steps:
- Open a command prompt from the Start menu.
- Type Run and hit Enter.
- Issue the control sysdm.cpl command.
- Select the Advanced tab at the top of the window.
- Click Environment Variables at the bottom of the window.
- Ensure the following values are set:Variable Name: CUDA_PATH Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x
- 변수 설정할 때, 아까전에 복붙한 cuda 쪽 bin/include/lib 파일 경로 + cdnn 파일 경로를 시스템 환경변수 Path에 설정해준다. 참조
- GPU 잡고 있는지 확인하기 -1:
1)
conda activate aiffel
jupyter notebook
2)
import tensorflow as tf
tf.config.list_physical_devices(‘GPU’)
실행해서
3) [PhysicalDevice(name=’/physical_device:GPU:0', device_type=’GPU’)] 나오는 지 확인
cf) 번외로 바로 python 쳐서 그 안에서 코드 돌려봐도 똑같이 나옴 - GPU 확인 2:
터미널에 nvidia-smi 쳐서 정보 나오는 지 확인
첫날 우분투 인상은 마치 맥북을 만질 때의 그 느낌과 같았다.
UI도 비슷해보이고, 어딘가 불편한 것도 비슷하고 약간 막막한 기분이 드는 것도 비슷한데
UI가 이뻐서 계속 쓰고 싶은 것도 비슷하고...
M1맥북 월급으로 지르기 전까진 요 노트북으로 존버할거다.
'Ubuntu Setting' 카테고리의 다른 글
Ubuntu 20.04에서 소리가 작게 나오는 현상. (0) | 2021.07.14 |
---|---|
우분투- 한영키 전환 설치 (0) | 2020.12.31 |