cuda 개발환경 setup

페이지 정보

작성자 조희승 댓글 0건 조회 14,364회 작성일 12-08-17 14:52

본문

필요라이브러리
apt-get install freeglut3-dev libxi-dev libxmu-dev
환경변수 setup
# cuda
CUDA_HOME=/usr/local/cuda
PATH=$CUDA_HOME/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib:$LD_LIBRARY_PATH
NVIDIA_CUDA_SDK=/usr/local/NVIDIA_GPU_Computing_SDK
export CUDA_HOME PATH LD_LIBRARY_PATH NVIDIA_CUDA_SDK

### GPU 를 이용한 CUDA 개발 환경 구성하기 ###

작성자 : 서진우 ( alang@clunix.com )
작성일 : 2010년 5월 5일
- 설치 패키지 다운로드
http://developer.nvidia.com/ 사이트의 download 메뉴에서 아래 항목의 패키지를 다운로드 받는다.
NVIDIA Driver
CUDA toolkit
CUDA SDK
위 3가지 항목의 패키지를 다운로드 받은 후 아래와 같은 방법으로 설치를 진행한다.
설치 전에 운영체제 환경이 아래와 같이 구성되어 있어야 한다.
1. NVIDIA GT 8600 이상의 Graphic Card 장착
2. RHEL4.x 이상 운영체제
3. HPC 기본 환경 구성 (rsh, rlogin, mpich, nfs, ...)
4. 기본적인 개발툴 설치 (gcc, pgf90, ..)
- 패키지 설치
# init 3
GPU driver 설치
# chmod 755 devdriver_3.1_linux_64_256.40.run
# ./devdriver_3.1_linux_64_256.40.run
CUDA toolkit 설치
# ./cudatoolkit_3.1_linux_64_rhel5.4.run
.
.
========================================
* Please make sure your PATH includes /usr/local/cuda/bin
* Please make sure your LD_LIBRARY_PATH
* for 32-bit Linux distributions includes /usr/local/cuda/lib
* for 64-bit Linux distributions includes /usr/local/cuda/lib64:/usr/local/cuda/lib
* OR
* for 32-bit Linux distributions add /usr/local/cuda/lib
* for 64-bit Linux distributions add /usr/local/cuda/lib64 and /usr/local/cuda/lib
* to /etc/ld.so.conf and run ldconfig as root
* Please read the release notes in /usr/local/cuda/doc/
* To uninstall CUDA, delete /usr/local/cuda
* Installation Complete
설치가 완료되면 /usr/local/cuda 위치에 패키지가 설치된다.
CUDA SDK 설치
# chmod 755 gpucomputingsdk_3.1_linux.run
# ./gpucomputingsdk_3.1_linux.run
--------------------------------------------------------------------------------------
.
Verifying archive integrity... All good.
Uncompressing NVIDIA GPU Computing SDK...Enter install path (default ~/NVIDIA_GPU_Computing_SDK):
Enter CUDA install path (default /usr/local/cuda):
.
.
========================================
Configuring SDK Makefile (/root/NVIDIA_GPU_Computing_SDK/C/common/common.mk)...
========================================
* Please make sure your PATH includes /usr/local/cuda/bin
* Please make sure your LD_LIBRARY_PATH includes /usr/local/cuda/lib
* To uninstall the NVIDIA GPU Computing SDK, please delete /root/NVIDIA_GPU_Computing_SDK
* Installation Complete
설치가 완료되면 사용자 별로 SDK를 이용할수 있게 환경을 구성해 둔다.
# cp -a /root/NVIDIA_GPU_Computing_SDK /usr/local
새로운 사용자가 생성되면 /usr/local/NVIDIA_GPU_Computing_SDK 디렉토리를 자신의 홈디렉토리안에 복사해 둔다.

설치된 패키지에 대한 환경설정을 한다.
# vi /etc/profile.d/cuda.sh
---------------------------------------------------------------
#!/bin/sh
CUDA_HOME=/usr/local/cuda
PATH=$CUDA_HOME/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib:$LD_LIBRARY_PATH
NVIDIA_CUDA_SDK=$HOME/NVIDIA_GPU_Computing_SDK
export CUDA_HOME PATH LD_LIBRARY_PATH NVIDIA_CUDA_SDK

# source /etc/profile.d/cuda.sh
이제 자신의 NVIDIA_GPU_Computing_SDK/C 디렉토리 안에서 make를 수행한다.
# cd $HOME/NVIDIA_GPU_Computing_SDK/C
# make
만일 make 도중 "/usr/bin/ld: cannot find -lglut" 관련 에러가 발생할 경우엔 아래와 같은 처리를
해준다.
# ln -s /usr/lib64/libglut.so.3.8.0 /usr/lib64/libglut.so
만일 /usr/lib64/libglut.so.3.8.0 라이브러리 파일이 없을 경우엔 설치를 해줘야 한다.
# yum install freeglut-devel

Make 가 아무런 에러없이 완료되면 기본적인 CUDA 개발환경 구성이 완료되는 것이다.
이제 $HOME/NVIDIA_GPU_Computing_SDK/C/bin/linux/release 디렉토리에 가보면 새로 build 된 바이너리가
존재할 것이다.
# cd /root/NVIDIA_GPU_Computing_SDK/C/bin/linux/release
# ./deviceQuery
--------------------------------------------------------------------------------
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA
Device 0: "Quadro FX 580"
CUDA Driver Version: 3.10
CUDA Runtime Version: 3.10
CUDA Capability Major revision number: 1
CUDA Capability Minor revision number: 1
Total amount of global memory: 536150016 bytes
Number of multiprocessors: 4
Number of cores: 32
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Clock rate: 1.12 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: Yes
Integrated: No
Support host page-locked memory mapping: No
Compute mode: Default (multiple host threads can use this device simultaneously)
Concurrent kernel execution: No
Device has ECC support enabled: No
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.10, CUDA Runtime Version = 3.10, NumDevs = 1, Device = Quadro FX 580

PASSED
Press <Enter> to Quit...
-----------------------------------------------------------
CUDA 관련 정보가 위와 같이 출력되면 모든 준비가 완료된다.
몇가지 재미난 바이너리들이다 . 한번씩 실행 시켜보면 재미있다.
# ./nbody
# ./simpleTexture3D
# ./smokeParticles

댓글목록

등록된 댓글이 없습니다.