-
cuda 설치 및 pytorch 설치환경구축 2023. 10. 10. 00:48
https://freddiekim.tistory.com/36
내가 예전에 적었던 글인데 무시하고 아래 글 보면 됨.
설치 전에 이해할것은
nvidia-driver --> cuda --> cudnn 순임.
그러나 cuda 를 설치하면 cuda 드라이버 만들때 추천한 nvidia-driver 가 자동으로 설치됨.
그래서 그거 사용하면됨.
나의 경우는 11.8을 설치하니 nvidia-driver 가 옛날꺼여서 문제가 생겨서 다시
sudo ubuntu-drivers autoinstall 로 드라이버가 자동으로 설치됨.
1. 설치 가능 버전 확인
cuda 를 설치한다는것은 nvidia graphic카드가 있다는것이고 graphic card에 따라서 지원하는 버전이 다르다.
https://en.wikipedia.org/wiki/CUDA
위를 참조하면 내가 가지고 있는 그래픽 카드의
Compute capability (version) 을 확인 할 수 있다. RTX 4090 그래픽 카드인 경우
8.9 인것을 알 수 있고 8.9 는 아래 표를 보면 11.8 버전 부터 포함 되어 있는것을 알 수 있다.
그래서 나의 경우는 cuda 11.8 이후버전을 설치해야함.
2. 설치
https://developer.nvidia.com/cuda-toolkit-archive
여기서 설치 하고 싶은 버전을 설치함.
나의 경우는 위의 경우로 선택해서 설치함.
여기서 중요한것은 runfile은 선택하지 않도록 한다.
인터넷으로 데이터를 가져오지 못해서 설치가 잘되지 않음.
3. 설정
/usr/local가 서 코드를 보면 대부분 link 로 되어 있음. 그래서
아래 처럼 적으면 잘 동작함.
vim ~/.bashrc
아래 코드 작성
source ~/.bashrc
export PATH="/usr/local/cuda/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
4. pytorch 설치
cuda 설치가 끝났으면 pytorch 설치함.
내가 11.8을 설치한 이유는
위 처럼 cuda11.8을 지원했기 때문임. 만일 아래 버전을 선택하고 싶으면
https://pytorch.org/get-started/previous-versions/
위 주소에서 선택해서 설치하면 됨.
반응형'환경구축' 카테고리의 다른 글
miniconda 및 jupyter 설치 (0) 2023.10.11 ubuntu 설치시 검은 화면이 나올때 (0) 2023.10.10 리눅스에서 MAC 키보드 사용할때 function키 기본으로 사용하기 (0) 2023.09.03 Terminal로 nvidia-driver, cuda, cudnn설치하기 (0) 2023.07.08 mAP(Mean Average Precision) (0) 2023.03.19