본문 바로가기

About my life/Development Studies

[Linux] 우분투에 쿠다(CUDA) 설치하는 방법: ubuntu 20.04

728x90
반응형

먼저 아래 링크를 통해 본인의 환경을 비교해보시면 cuda 를 지원하는 환경인지 알 수 있습니다.

 

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/

 

CUDA Installation Guide for Linux

The installation instructions for the CUDA Toolkit on Linux. 13. Post-installation Actions The post-installation actions must be manually performed. These actions are split into mandatory, recommended, and optional sections. 13.1. Mandatory Actions Some ac

docs.nvidia.com

 

출처: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/

 

이는 아래 명령어를 통해 볼 수 있습니다.

# Description
$ lsb_release -a

# Kernel
$ uname -r

# GCC
$ gcc --version

# GLIBC
$ ldd --version

 

 

다음으로는 쿠다를 지원하는 GPU 인지 확인하는 방법입니다.

https://developer.nvidia.com/cuda-gpus

 

CUDA GPUs - Compute Capability

Explore your GPU compute capability and CUDA-enabled products.

developer.nvidia.com

 

출처: https://developer.nvidia.com/cuda-gpus

 

이 버튼을 누르시면 지원하는 GPU 목록이 쭉 나옵니다. 그 중 내 그래픽 카드가 있으면 지원하는 것입니다

 

그런 다음 쿠다 툴킷을 다운 받으셔야하는데 GPUDirect 사용하실 분은 쿠타 툴킷 버전도 12.2.2 이상부터는 개방형 그래픽 드라이버를 사용하셔야한다고 하니 자세한 내용은 홈페이지 참고해주셔요

 

저는 불안해서 12.2.1 버전 다운받으려고 합니다.

https://developer.nvidia.com/cuda-12-2-1-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=runfile_local

 

CUDA Toolkit 12.2 Update 1 Downloads

 

developer.nvidia.com

$ wget https://developer.download.nvidia.com/compute/cuda/12.2.1/local_installers/cuda_12.2.1_535.86.10_linux.run
$ sudo sh cuda_12.2.1_535.86.10_linux.run

 

만약 그래픽 드라이버가 이미 존재한다면 그래픽 드라이버를 체크 해제한 후에 설치하시면 됩니다. 이후 버전에 맞게 ~/.bashrc 파일을 수정해주면 됩니다.

 

$ gedit ~/.bashrc

# 아래 코드 복붙
export PATH=/usr/local/cuda-12.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}​

$ source ~/.bashrc
$ nvcc --version

 

이러면 쿠다 설치완료~

 

 

 

reference

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#nvidia-open-gpu-kernel-modules

https://cow-kite24.tistory.com/331

728x90
반응형