딥러닝을 수행하면서 아래와 같은 에러를 접하게 되었다.
RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1
CUDA가 제대로 설치가 안되서 발생한 에러라서 설치하고 재부팅하니까 작동이 잘됐다!
해결방법
1. CUDA 설치하기
- driver version에 맞는 version을 설치해야 하고, CUDA version에 맞는 version의 PyTorch를 설치해야 한다.
1) 본인의 GPU(그래픽카드) 확인하기
- 나는 GTX 1060 3GB이다!
2) 확인한 GPU에 맞는 Compute capacity(version) 확인하기
https://en.wikipedia.org/wiki/CUDA
3) CUDA 설치할 버전 확인하기 - 나는 compute capacity가 6.1이니까 10.0-10.1 버전을 설치하면 된다.
4) 설치하기
- CUDA 10.0-10.1일 경우 아래 명령어로 설치(순서대로 진행하기)
$ pip3 uninstall torch
$ export TORCH_CUDA_ARCH_LIST="6.1" # --> Compute Capability를 TORCH_CUDA_ARCH_LIST 환경 변수의 값으로 설정한다.
$ pip3 install torch==1.7.1+cu101 torchvision==0.8.2+cu101 -f https://download.pytorch.org/whl/torch_stable.html
2. 재부팅하기
'Language & OS > python' 카테고리의 다른 글
[python] 캐시데이터 일괄 삭제하기 (0) | 2022.02.09 |
---|---|
[python] print와 pprint의 차이 (0) | 2022.01.06 |
python 분산 병렬 처리 프레임워크 Ray 사용하기 (0) | 2021.12.17 |