ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • nvidia graphic card 설치 및 Cuda & Cudnn 설치
    etc. 2021. 9. 19. 19:34
    728x90
    nvidia graphic card 설치 

     

    $ sudo apt-add-repository ppa:graphics-drivers/ppa -y
    $ sudo apt-get update
    $ sudo apt-cache search ^nvidia-driver
    # $ ubuntu-drivers devices # 추천하는 드라이버 확인
    $ sudo apt-get install nvidia-driver-460


    (reboot)


    $ nvidia-smi

     

     

     

    cuda 설치 (toolkit 11.2)

     

    graphic card 460을 다운로드 하였기 때문에 호환되는 버전인 
    11.2를 다운로드 하게 되었다.

     

     

    (버전 확인 사이트 )
    https://docs.nvidia.com/deploy/cuda-compatibility/index.html
    (다운로드 사이트 )
    https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arc
    h=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfi
    lelocal
    선택사항 : linux, x86_64, Ubuntu, 18.04, runfile(local)

     


    (터미널에서 명령어 실행)


    $wget 
    https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installer
    s/cuda_11.2.2_460.32.03_linux.run
    $sudo sh cuda_11.2.2_460.32.03_linux.run


    (여기 아주 조심해야함 !!)

    cuda toolkit 만을 제외하고 space bar를 통해 체크박스로 체크 
    표시를 지우고, 설치 


    설치후 $ sudo nano ~/.bashrc 라는 명령어 입력

     

    export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

    을 추가하고 Ctrl+O, Enter, Ctrl+x 순으로 입력한다. 

     

    $ source ~/.bashrc 라는 명령어 입력 후 
    $ nvcc -V 입력하고
    버전이 맞는지 확인한다

     

    cudnn 설치

    https://developer.nvidia.com/rdp/cudnn-archive
    (해당 사이트에서 내 cuda version인 11.2에 맞는 cuDNN 8.1.0 & Linux 
    x86_64로 다운로드)
    (download folder에 다운되어 있다.)


    $ tar -xvzf cudnn-11.2-linux-x64-v8.1.0.77.tgz


    $ sudo cp cuda/include/cudnn.h /usr/local/cuda-11.2/include
    $ sudo cp cuda/include/cudnn_version.h /usr/local/cuda-11.2/include


    $ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-11.2/lib64
    $ sudo chmod a+r /usr/local/cuda-11.2/include/cudnn.h 
    /usr/local/cuda-11.2/lib64/libcudnn*


    <confirmation>
    $ cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR 
    -A 2

    728x90
Designed by Tistory.