본문 바로가기
Linux

[CentOS] CentOS 8에서 cuda 10.0 설치하기 (Install cuda 10.0 version in centos 8)

by daewooki 2021. 7. 19.
반응형

기존 centos7을 사용하고 cuda 10.0, cuda 10.1 버전을 사용하고 있었는데 OS 업그레이드로 centos8 버전을 사용하게 되었다. 

 

CUDA version 확인 (nvcc --version)

현재 10.1 버전으로 설치가 되어있다. 

 

기존 서버에서 잘 돌아가던 프로그램을 신규 서버에서 동작시키니 다음과 같은 에러가 발생했다. 

 

에러 내용

2020-08-13 09:15:44.735283: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735398: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735504: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735584: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735663: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735739: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735821: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2020-08-13 09:15:44.735845: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2020-08-13 09:15:44.735876: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-08-13 09:15:44.735895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0
2020-08-13 09:15:44.735915: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N
Device mapping:
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device
2020-08-13 09:15:44.736645: I tensorflow/core/common_runtime/direct_session.cc:296] Device mapping:
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device

 

 

Could not dlopen library  'libcudart.so.10.0' 이런 에러들이 쭈욱 나온다.;; 

오류메시지를 보면 GPU인식은 하지만 cuda 라이브러리 파일이 없어서 열 수 없다고 나온다.

 

centos8 에서는 cuda 10.0을 지원하지 않기 때문에 찾아보다 강제로 cuda 10.0을 인식시킬 수 있는 방법을 찾아 공유한다.

 

 


해결 방법

 

먼저 cuda 10.0 폴더를 생성한다. 

sudo cp -rf /usr/local/cuda-10.1 /usr/local/cuda-10.0

설치해둔 cuda 10.1 폴더를 cuda 10.0 으로 사본을 만든다.

 

다음으로, LD_LIBRARY_PATH 경로에서 lib*.so.10.1* 에 해당하는 파일을 찾아 lib*so.10.0 이라는 이름의 심볼릭 링크를 만든다. 

 

$ sudo ln -s /usr/local/cuda-10.0/lib64/libcudart.so.10.1.168 /usr/local/cuda-10.0/lib64/libcudart.so.10.0
$ sudo ln -s /usr/local/cuda-10.0/lib64/libcufft.so.10.1.168 /usr/local/cuda-10.0/lib64/libcufft.so.10.0
$ sudo ln -s /usr/local/cuda-10.0/lib64/libcurand.so.10.1.168 /usr/local/cuda-10.0/lib64/libcurand.so.10.0
$ sudo ln -s /usr/local/cuda-10.0/lib64/libcusolver.so.10.1.168 /usr/local/cuda-10.0/lib64/libcusolver.so.10.0
$ sudo ln -s /usr/local/cuda-10.0/lib64/libcusparse.so.10.1.168 /usr/local/cuda-10.0/lib64/libcusparse.so.10.0
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libcublas.so.10.2.0.168 /usr/local/cuda-10.0/lib64/libcublas.so.10.0

 

그리고 .bashrc 파일을 열어 PATH, LD_LIBRARY_PATH를 수정한다.

cuda-10.1 -> cuda-10.0

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

 

수정한 환경변수를 적용한다.

$ source ~/.bashrc

 

결과!

 

2020-08-14 10:13:42.235418: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2020-08-14 10:13:42.326871: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcublas.so.10.0
2020-08-14 10:13:42.407721: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0
2020-08-14 10:13:42.409214: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0
2020-08-14 10:13:42.581354: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0
2020-08-14 10:13:42.621782: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0
2020-08-14 10:13:42.691584: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7

Successfully open이라고 나온다. GPU 사용도 잘 된다!

 

 

centos8 에서도 cuda 10.0 사용가능하다. 

 

반응형

댓글