화학소프트웨어/CUDA

Linux x86_64 Nvidia 드라이버 설치 및 CUDA toolkit 설치 - ②

NeoAlchemist 2010. 3. 20. 17:32
728x90
반응형



NVIDIA 리눅스 드라이버를 설치 했으니 컴퓨터 상의 GPU 상태를 확인해보자.

[root@chemzine ~]# /usr/bin/nvidia-settings

위의 명령을 실행하면 다음과 같은 창이 나타나 그래픽상황을 확인 할 수 있다.
(Red Hat Enterprise Linux 4.x의 경우
Applications -> System Tools -> NVIDIA X Server Settings )



테스트에 사용한 그래픽카드 (GPU)는 8600GT 이며 발열상태 및 메모리,  클럭등의 정보를 확인 할 수 있다. (그래픽카드를 새로 장만해야겠다 ;;;)

이제 CUDA toolkit을 설치해보자.

[root@chemzine home]# ls
cudasdk_2.3_linux.run                 cudatoolkit_2.3_linux_64_rhel5.3.run 
NVIDIA-Linux-x86_64-190.53-pkg2.run 

난 리눅스 /home 디렉토리에 드라이버랑 CUDA toolkit, SDK 코드샘플등을 옮겨놨으니
/home 디렉토리에서 작업을 수행할 것이다.


[root@chemzine home]# sh cudatoolkit_2.3_linux_64_rhel5.3.run
 Verifying archive integrity... All good.
Uncompressing NVIDIA CUDA.....................
..............................................................................................................
..............................................................................................................
Enter install path (default /usr/local/cuda, '/cuda' will be appended):

CUDA toolkit을 어디다 설치할 것인지를 물어보는 것이다. 그냥 엔터를 치고 넘어가면
/usr/local/cuda 에 설치가 된다.


`include/sm_13_double_functions.h' -> `/usr/local/cuda/include/sm_13_double_functions.h'
`include/cuComplex.h' -> `/usr/local/cuda/include/cuComplex.h'
`include/math_functions.h' -> `/usr/local/cuda/include/math_functions.h'
`include/cuda_runtime.h' -> `/usr/local/cuda/include/cuda_runtime.h'
`include/vector_functions.h' -> `/usr/local/cuda/include/vector_functions.h'
`include/common_types.h' -> `/usr/local/cuda/include/common_types.h'
`include/cuda.h' -> `/usr/local/cuda/include/cuda.h'
`include/sm_12_atomic_functions.h' -> `/usr/local/cuda/include/sm_12_atomic_functions.h'
`include/texture_fetch_functions.h' -> `/usr/local/cuda/include/texture_fetch_functions.h'
`include/channel_descriptor.h' -> `/usr/local/cuda/include/channel_descriptor.h'
`include/__cudaFatFormat.h' -> `/usr/local/cuda/include/__cudaFatFormat.h'
========================================
* 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
* OR
*   for 32-bit Linux distributions add /usr/local/cuda/lib
*   for 64-bit Linux distributions add /usr/local/cuda/lib64
* 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

이렇게 되면 CUDA를 사용할 수 있는 환경으로 설치가 완료된 것이다.
다만 경로 설정이 좀 필요한데 설정을 해보도록 하자.

[root@chemzine home]# cd
[root@chemzine ~]# ls -a
.                .dbus     .gnome2_private     .nvidia-settings-rc
..               Desktop   .gstreamer-0.10     .redhat
anaconda-ks.cfg  .dmrc     .gtkrc-1.2-gnome2   .scim
.bash_history    .eggcups  .ICEauthority       .tcshrc
.bash_logout     .gconf    install.log         .thumbnails
.bash_profile    .gconfd   install.log.syslog  .Trash
.bashrc          .gnome    .metacity           .Xauthority
.cshrc           .gnome2   .nautilus           .xsession-errors

[root@chemzine ~]# vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

unset USERNAME


위에 파란색으로 된 부분을 아래와 같이 수정합니다.

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

vi 에디터의 사용법은 따로 정리를 하고 여기서는 단순히 수정 저장하는 법만 다루겠음.

방향키로 이동 후 수정하고자 하는 위치에서 a키 혹은 i키를 누르면
에디터 하단에 다음과 같이 나타남

-- INSERT --

이 상태에서는 파일을 수정할 수 있으며 수정후 저장하기 위해서는
ESC 키를 누른 후 :wq 를 입력한다.

수정후에 다음과 같이 수정한 파일 내용이 적용되도록 명령어를 입력하고
경로 설정이 바르게 되었는지 확인하자.

[root@chemzine ~]# source .bash_profile
[root@chemzine ~]# which nvcc
/usr/local/cuda/bin/nvcc


만약 경로설정을 하지 않았다면 다음과 같이 표현될 것이다.

[root@chemzine home]# which nvcc
/usr/bin/which: no nvcc in /usr/kerberos/sbin:/usr/kerberos/bin:
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)


이렇게 해서 CUDA를 사용하기 위해 NVIDIA 드라이버와 CUDA Toolkit 설치를 마쳤다. ㅋㅋ
다음은 SDK설치를 확인해보자.. ^^
728x90
반응형