Troubleshooting

Torch Cuda compiler version mismatch

낭만가이 2023. 9. 12. 14:20

 

Anaconda를 이용하여 아래와 같이 torch, cudatoolkit, cudnn 등을 설치하였다.

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

 

 

그리고 나서 Torch에서 cuda로 작성된 custom module을 컴파일하려고 하니 다음과 같은 에러가 발생하였다.

The detected CUDA version (12.0) mismatches the version that was used to compile PyTorch (11.7). 
Please make sure to use the same CUDA versions

 

Anaconda에서 cuda 관련된 라이브러리들은 잘 설치가 된 것 같은데...

 

좀 더 알아보니 anaconda에서 설치되는 것은 cuda toolkit중 일부만 설치된다고 하고(runtime), 컴파일러(nvcc, nvidia cuda comipler)는 따로 설치가 안 된다고 한다. 이러다보니, anaconda 환경에 설치되어 있는 버전을 따라가는게 아니라 서버에 설치된 쿠다 컴파일러를 사용하려고 하고, 버전 미스매치가 나는 것이다.

 

이를 해결하기 위해서 conda에 추가적으로 cudatoolkit-dev를 설치해 주었더니 문제가 해결되었다.

conda install cudatoolkit-dev=11.7 -c conda-forge