cuda 설치 및 pytorch 설치
https://freddiekim.tistory.com/36
Terminal로 nvidia-driver, cuda, cudnn설치하기
터미널로 설치하는 방법에 대해서 정리를 했다. 아래 처럼 shell로 만들어 놓으면 나중에 다시 설치할때 편할 것 같기는 하다. 꼬여 있는 경우도 있어서 0 번 완전 삭제 부분을 추가했다. 확인하고
freddiekim.tistory.com
내가 예전에 적었던 글인데 무시하고 아래 글 보면 됨.
설치 전에 이해할것은
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
CUDA - Wikipedia
From Wikipedia, the free encyclopedia Parallel computing platform and programming model CUDA (or Compute Unified Device Architecture) is a proprietary and closed source parallel computing platform and application programming interface (API) that allows sof
en.wikipedia.org
위를 참조하면 내가 가지고 있는 그래픽 카드의
Compute capability (version) 을 확인 할 수 있다. RTX 4090 그래픽 카드인 경우
8.9 인것을 알 수 있고 8.9 는 아래 표를 보면 11.8 버전 부터 포함 되어 있는것을 알 수 있다.
그래서 나의 경우는 cuda 11.8 이후버전을 설치해야함.
2. 설치
https://developer.nvidia.com/cuda-toolkit-archive
CUDA Toolkit Archive
Previous releases of the CUDA Toolkit, GPU Computing SDK, documentation and developer drivers can be found using the links below. Please select the release you want from the list below, and be sure to check www.nvidia.com/drivers for more recent production
developer.nvidia.com
여기서 설치 하고 싶은 버전을 설치함.
나의 경우는 위의 경우로 선택해서 설치함.
여기서 중요한것은 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/
PyTorch
An open source machine learning framework that accelerates the path from research prototyping to production deployment.
pytorch.org
위 주소에서 선택해서 설치하면 됨.