cuda가 라이브러리라면 cuda toolkit은 cuda로 gpu 프로그래밍할 때 쉽게 해주는 소프트웨어다.
안녕하세요~
gpu를 사용해서 keras를 돌리려고 하는데
2022-04-06 15:14:53.600331: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
이런 식으로 나와서요.....
conda 환경에서 cuda를 설치해봤는데도 안 돼서 그러는데 혹시 sudo 권한으로 cuda를 설치해주실 수 있을까요?
아니면 다른 방법이 있을까요...?
cuda 라이브러리가 읎어서 발생함.
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove --autoremove nvidia-cuda-toolkit
sudo apt remove --autoremove nvidia-*
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*
sudo apt update
sudo add-apt-repository ppa:graphics-drivers
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda_learn.list'
sudo apt update
sudo apt install cuda-10-1
sudo apt install libcudnn7
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH
위의 에러는 해결되었으나
Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-10.0/extras/CUPTI/lib64:/usr/local/cuda-10.0/lib64
발생.
https://github.com/tensorflow/tensorflow/issues/45930
https://www.tensorflow.org/install/gpu#install_cuda_with_apt
https://stackoverflow.com/questions/63199164/how-to-install-libcusolver-so-11[중요] 이거 참고함.
libcudart.so.11.0에 11.0을 link를 걸어줌. (원래 11.0이라는건 없다고 한다-ㅈ-;;)
링크 걸 때 파일 이름을 잘못 적어서 .... 개고생함 휴.. 파일 이름 확인 잘 하자.
GPU가 동작을 안한다..!!!
nvdia-smi에는 version 11, nvcc로 확인해보니 Cuda 9로 사용되고 있었음. ㅇ<-<
Cuda 10으로 깐 줄았는데 알고보니 제대로 안깔림..ㅠㅠ..망했어요!!!!!!
인터넷에 돌아다니는 파편적인 정보로 대충 때울려다가 망했다.
커널 모듈 드라이버 버전이 510.60 이상임 -> CUDA 버전 전부 다된다. ... CUDA 버전 제한없다.
Running a CUDA application requires the system with at least one CUDA capable GPU and a driver that is compatible with the CUDA Toolkit.
그래픽 카드마다 설치가 가능한 CUDA와 cuDNN 버전이 다를 수 있다.
-> 7.5만 되는 줄 알았는데 다른 예제들 보니 RTX 2080이랑 Cuda 10 호환 되긴 하는듯..?ㅠ??..정확히 모르겠다.
CUDA 설치 시 최소 그래픽 Driver 버전이 존재한다.
- CUDA-capable GPU
- A supported version of Linux with a gcc compiler and toolchain
- NVIDIA CUDA Toolkit (available at https://developer.nvidia.com/cuda-downloads)
cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 510.60.02 Wed Mar 16 11:24:05 UTC 2022
GCC version: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
우리의 driver version이 510.60임 -> 10.1은 무조건 호환성이 맞다.
2.1. Verify You Have a CUDA-Capable GPU
lspci | grep -i nvidia
2.2. Verify You Have a Supported Version of Linux
uname -m && cat /etc/*release
2.3. Verify the System Has gcc Installed
gcc --version
2.4. Verify the System has the Correct Kernel Headers and Development Packages Installed
uname -r
This is the version of the kernel headers and development packages that must be installed prior to installing the CUDA Drivers.
The kernel headers and development packages for the currently running kernel can be installed with:
sudo apt-get install linux-headers-$(uname -r)
(OK)
2.5. Download the NVIDIA CUDA Toolkit.
- Download the NVIDIA CUDA Toolkit.
- Handle conflicting installation methods.
https://gist.github.com/Mahedi-61/2a2f1579d4271717d421065168ce6a73
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
https://medium.com/@exesse/cuda-10-1-installation-on-ubuntu-18-04-lts-d04f89287130