[[labs.beatcraft.com]] ~

#contents

* CUDA5/CentOS6.4 [#uc1c5ea8]
This article explains how to install CentOS 6.4 and CUDA5 on a PC, which is equipped with Tesla K20.~
~
#ref(CUDA_Tesla.jpg,,60%) ~
~

* Hardware Specification [#de8b31c5]
The specification of hardware is shown below~

- CPU: Core i7 3770(3.4GHz,4core/8thread)
- Memory: 32GB(DDR3-12800 8GBx4)
- HDD: 1TB(SATA,7200rpm)
- GPU: ETSK20-5GER(nvidia Tesla K20c) ~
~
#ref(CUDA_PC.jpg,,60%) ~
~

Since ETSK20-5GER does not have terminals of display outputs, such as D-SUB, DVI, HDMI, and so on, use the terminals of the mother board are used. To use the terminals, at the configuration of UEFI, the Primary Display is On Board.~

* To Install CentOS 6.4 (64bit) [#z1f9e64b]
The settings of installing CentOS 6.4 are shown below. ~
- Language & Keyboard: Japanese
- Package: Standard Desktop Install
- HDD Partition: Using whole disk, the standard configuration
- Network: DHCP

本稿では個別のパッケージのカスタマイズ設定は行っていません。~
またFirewall、SELinuxは共にDisableに設定しています。~

* CentOS インストール後設定 [#db8c96a0]
CentOS 6.4(64bit版)インストール後の設定について記載します。 ~

** CentOSのアップデート [#sf692f14]
インストール直後のKernelバージョンは以下のとおりです。~

 $ uname -a
 Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

yum コマンドでアップデートを実行します。 ~

 # yum update

アップデート完了後再起動を実行しアップデートしたKernelで起動することを確認します。~

 # reboot

再起動後のKernelバージョンは以下のとおりです。~

 $ uname -a
 Linux localhost.localdomain 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

beatユーザを作成し、sudoにbeatユーザを追加します。~

 # useradd beat
 # passwd beat

 # /usr/sbin/visudo
 
  ...<&#30053;>
  ##      user    MACHINE=COMMANDS
  ##
  ## The COMMANDS section may have other options added to it.
  ##
  ## Allow root to run any commands anywhere
  root    ALL=(ALL)       ALL
  beat    ALL=(ALL)       ALL

** &#12497;&#12483;&#12465;&#12540;&#12472;&#36861;&#21152;&#12392;&#35373;&#23450; [#i1de06fb]
CUDA&#12398;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12395;&#12399;&#30452;&#25509;&#38306;&#20418;&#12399;&#12354;&#12426;&#12414;&#12379;&#12435;&#12364;&#12289;&#20316;&#26989;&#12434;&#12375;&#12420;&#12377;&#12367;&#12377;&#12427;&#12383;&#12417; ~
ntpd&#12392;openssh&#12434;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12375;&#12414;&#12377;&#12290; ~
~
ntpd&#12434;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12375;&#12414;&#12377;&#12290;~

 # yum install ntp

ntp&#12469;&#12540;&#12496;&#12434;&#36861;&#21152;&#12375;&#12414;&#12377;&#12290; ~

 # vi /etc/ntp/step-tickers
 
   # List of servers used for initial synchronization.
   ntp.nict.jp
   ntp.jst.mfeed.ad.jp
   ntp.ring.gr.jp
 
ntpd&#12434;&#36215;&#21205;&#12375;&#12414;&#12377;&#12290;~

 # /etc/init.d/ntpd start

ntpd&#12434;&#12469;&#12540;&#12499;&#12473;&#12395;&#36861;&#21152;&#12375;&#12414;&#12377;&#12290; ~

 # chkconfig --level 3 ntpd on
 # chkconfig --level 5 ntpd on

openssh&#12434;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12375;&#12414;&#12377;&#12290;~
&#26082;&#12395;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12373;&#12428;&#12390;&#12356;&#12427;&#22580;&#21512;&#12399;&#12371;&#12398;&#25163;&#38918;&#12399;&#12392;&#12400;&#12375;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;~

 # yum install openssh

/etc/ssh/sshd_config&#20869;&#12398;PermitRootLogin&#12392;~
PermitEmptyPasswords&#12434;no&#12395;&#35373;&#23450;&#12375;&#12414;&#12377;&#12290;~

 # vi /etc/ssh/sshd_config
 
   ... <&#30053;>
   # Authentication:
  
   #LoginGraceTime 2m
   PermitRootLogin no
   #StrictModes yes
   #MaxAuthTries 6
   #MaxSessions 10
   ... <&#30053;>
   # To disable tunneled clear text passwords, change to no here!
   #PasswordAuthentication yes
   PermitEmptyPasswords no
   PasswordAuthentication yes
   ...

sshd&#12434;&#36215;&#21205;&#12375;&#12414;&#12377;&#12290; ~
 # /etc/init.d/sshd start

sshd&#12434;&#12469;&#12540;&#12499;&#12473;&#12395;&#36861;&#21152;&#12375;&#12414;&#12377;&#12290;
 # chkconfig --level 5 sshd on
 # chkconfig --level 3 sshd on

* Tesla K20c&#12489;&#12521;&#12452;&#12496;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523; [#n811fcbc]
Tesla K20c&#12489;&#12521;&#12452;&#12496;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12395;&#12388;&#12356;&#12390;&#35352;&#36617;&#12375;&#12414;&#12377;&#12290;~

** Tesla K20c&#12489;&#12521;&#12452;&#12496;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#28310;&#20633; [#k7d204e8]
Tesla K20c&#12489;&#12521;&#12452;&#12496;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12398;&#12383;&#12417;&#12395;&#12497;&#12483;&#12465;&#12540;&#12472;&#12398;&#36861;&#21152;&#12289;&#35373;&#23450;&#12434;&#34892;&#12356;&#12414;&#12377;&#12290;~
&#38283;&#30330;&#29992;&#12497;&#12483;&#12465;&#12540;&#12472;&#12289;&#12521;&#12452;&#12502;&#12521;&#12522;&#32676;(Development tools)&#12434;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12375;&#12414;&#12377;&#12290;~

 # yum groupinstall 'Development tools'

Tesla K20c&#12398;&#12489;&#12521;&#12452;&#12496;&#12289;CUDA5&#12398;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#26178;&#12395;X&#12364;&#36215;&#21205;&#12375;&#12390;&#12356;&#12427;&#12392; ~
&#12456;&#12521;&#12540;&#12364;&#36215;&#12371;&#12427;&#12383;&#12417;&#12289;runlevel 3&#12395;&#22793;&#26356;&#12375;&#20877;&#36215;&#21205;&#12434;&#34892;&#12356;&#12414;&#12377;&#12290; ~

 # vi /etc/inittab
 
   ...<&#30053;>
   # Default runlevel. The runlevels used are:
   #   0 - halt (Do NOT set initdefault to this)
   #   1 - Single user mode
   #   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
   #   3 - Full multiuser mode
   #   4 - unused
   #   5 - X11
   #   6 - reboot (Do NOT set initdefault to this)
   #
   id:3:initdefault:
 
 # reboot

** Tesla K20c&#12489;&#12521;&#12452;&#12496;&#12398;&#12480;&#12454;&#12531;&#12525;&#12540;&#12489; [#w3abdcaf]
&#20877;&#36215;&#21205;&#24460;&#12289;&#20197;&#19979;&#12398;URL&#12424;&#12426;NVIDIA-Linux-x86_64-319.23.run&#12434;&#12480;&#12454;&#12531;&#12525;&#12540;&#12489;&#12375;&#12414;&#12377;&#12290;~
http://www.nvidia.co.jp/object/linux-display-amd64-319.23-driver-jp.html ~
~
NVIDIA-Linux-x86_64-319.23.run&#12434;&#23455;&#34892;&#12375;&#12289;&#12521;&#12452;&#12475;&#12531;&#12473;&#12395;&#21516;&#24847;&#24460;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12364;&#23436;&#20102;&#12375;&#12414;&#12377;&#12290;~
&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#23436;&#20102;&#24460;/proc/driver/nvidia/&#12395;version&#12501;&#12449;&#12452;&#12523;&#12364;&#20316;&#25104;&#12373;&#12428;&#12414;&#12377;&#12290;~

 # chmod +x NVIDIA-Linux-x86_64-319.23.run
 # ./NVIDIA-Linux-x86_64-319.23.run
 
 # cat /proc/driver/nvidia/version
 NVRM version: NVIDIA UNIX x86_64 Kernel Module  304.54  Sat Sep 29 00:05:49 PDT 2012
 GCC version:  gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)

&#20197;&#19979;&#12398;URL&#12395;&#35352;&#36617;&#12398;&#12354;&#12427;&#12424;&#12358;&#12395;&#36215;&#21205;&#26178;&#12489;&#12521;&#12452;&#12496;&#12434;&#35501;&#12415;&#36796;&#12416;&#12383;&#12417;&#12398;&#12501;&#12449;&#12452;&#12523;(/etc/init.d/nvidia)&#12434;&#20316;&#25104;&#12375;&#12289;~
runlevel3,5&#12398;&#36215;&#21205;&#26178;&#12395;&#23455;&#34892;&#12377;&#12427;&#12424;&#12358;&#35373;&#23450;&#12375;&#12414;&#12377;&#12290;~
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#install-cuda-software ~

 # vi /etc/init.d/nvidia
 
   #!/bin/bash
  
   /sbin/modprobe nvidia
  
   if [ "$?" -eq 0 ]; then
    # Count the number of NVIDIA controllers found.
    NVDEVS=`lspci | grep -i NVIDIA`
    N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
    NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
   
    N=`expr $N3D + $NVGA - 1`
    for i in `seq 0 $N`; do
      mknod -m 666 /dev/nvidia$i c 195 $i
    done
  
    mknod -m 666 /dev/nvidiactl c 195 255
  
   else
    exit 1
   fi
 
 # cd /etc/rc5.d/
 # ln -s S99nvidia ../init.d/nvidia
 # cd /etc/rc3.d/
 # ln -s S99nvidia ../init.d/nvidia

* CUDA5&#12398;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12392;Sample&#12398;&#23455;&#34892; [#gbfa8ff5]
CUDA5&#12398;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12392;CUDA5&#12398;Samples&#12395;&#12388;&#12356;&#12390;&#35352;&#36617;&#12375;&#12414;&#12377;&#12290;~

** CUDA5&#12398;&#12480;&#12454;&#12531;&#12525;&#12540;&#12489; [#ge140c64]
CentOS6 64bit&#29256;CUDA(cuda_5.0.35_linux_64_rhel6.x-1.run)&#12434;&#20197;&#19979;&#12398;URL&#12363;&#12425; ~
&#12480;&#12454;&#12531;&#12525;&#12540;&#12489;&#12375;&#12414;&#12377;&#12290;~
https://developer.nvidia.com/cuda-downloads ~
~
CUDA5&#12398;Sample&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#26178;&#12395;PATH&#12364;&#35211;&#12388;&#12363;&#12425;&#12378;Sample&#12364;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12373;&#12428;&#12394;&#12356;&#12398;&#12434;&#38450;&#12368;&#12383;&#12417;&#12289;~
.bashrc&#12395;&#20104;&#12417;PATH&#12434;&#36861;&#21152;&#12375;&#12414;&#12377;&#12290; ~

 $ cd /home/beat
 $ vi .bashrc
 
   # .bashrc
  
   # Source global definitions
   if [ -f /etc/bashrc ]; then
           . /etc/bashrc
   fi
  
   # User specific aliases and functions
   export PATH=/usr/local/cuda-5.0/bin:$PATH
   export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/usr/local/cuda-5.0/lib:$LD_LIBRARY_PATH
 
 # source .bashrc

** &#12497;&#12483;&#12465;&#12540;&#12472;&#12398;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523; [#md50346c]
Samples&#12398;&#12499;&#12523;&#12489;&#12391;&#24517;&#35201;&#12394;&#20197;&#19979;&#12398;&#12497;&#12483;&#12465;&#12540;&#12472;&#12434;&#20104;&#12417;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12375;&#12414;&#12377;&#12290;~

 # yum install freeglut-devel.x86_64 libXi-devel.x86_64 mpich2-devel.x86_64 libXmu-devel.x86_64

cuda_5.0.35_linux_64_rhel6.x-1.run &#12434;&#23455;&#34892;&#12375;&#12414;&#12377;&#12290;~
&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#20808;&#12487;&#12451;&#12524;&#12463;&#12488;&#12522;&#12399;&#12487;&#12501;&#12457;&#12523;&#12488;&#12398;/usr/local/cuda-5.0&#12434;&#25351;&#23450;&#12375;&#12414;&#12377;&#12290;~

 # chmod +x cuda_5.0.35_linux_64_rhel6.x-1.run
 # ./cuda_5.0.35_linux_64_rhel6.x-1.run

Samples&#12399;&#12487;&#12501;&#12457;&#12523;&#12488;&#12391;/usr/local/cuda-5.0/samples&#12392;/root/NVIDIA_CUDA-5.0_Samples&#12395; ~
&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12373;&#12428;&#12414;&#12377;&#12290;~
~
root&#12518;&#12540;&#12470;&#12391;&#12499;&#12523;&#12489;&#12391;&#12365;&#12427;&#12424;&#12358;&#12395;ld.so.conf.d/cuda.conf&#12434;&#36861;&#21152;&#12375;ldconfig&#12434;&#23455;&#34892;&#12375;&#12414;&#12377;&#12290;~

 # cat /etc/ld.so.conf.d/cuda.conf
 
   /usr/local/cuda-5.0/lib
   /usr/local/cuda-5.0/lib64
 # ldconfig

** CUDA5 Samples&#12398;&#12499;&#12523;&#12489;&#12392;&#23455;&#34892; [#v02860fe]
NVIDIA_CUDA-5.0_Samples&#12434;beat&#12518;&#12540;&#12470;&#12391;&#12499;&#12523;&#12489;&#12289;&#23455;&#34892;&#12391;&#12365;&#12427;&#12424;&#12358;&#12395;&#12375;&#12414;&#12377;&#12290;~
/root/NVIDIA_CUDA-5.0_Samples&#12363;&#12425;&#12467;&#12500;&#12540;&#12375;&#12289;&#12458;&#12540;&#12490;&#12540;&#12434;beat&#12395;&#22793;&#26356;&#12375;make&#12434;&#23455;&#34892;&#12375;&#12414;&#12377;&#12290;~

 # cp -afr /root/NVIDIA_CUDA-5.0_Samples /home/beat/.
 # cd /home/beat
 # chown -R beat.beat NVIDIA_CUDA-5.0_Samples
 $ cd ~/NVIDIA_CUDA-5.0_Samples
 $ make

&#12499;&#12523;&#12489;&#23436;&#20102;&#24460; NVIDIA_CUDA-5.0_Samples/bin/linux/release/&#12395;&#31227;&#21205;&#12375;&#12289;~
NVIDIA CUDA Getting Started Guide for Linux&#12398;&#12506;&#12540;&#12472;&#20869;Running the Binaries&#12395; ~
&#35352;&#36617;&#12373;&#12428;&#12390;&#12356;&#12427;deviceQuery&#12289;bandwidthTest&#12434;&#23455;&#34892;&#12375;&#12414;&#12377;&#12290; ~
deviceQuery&#12289;bandwidthTest&#20849;&#12395;Tesla K20c&#12434;&#29992;&#12356;&#12390;&#12356;&#12427;&#12371;&#12392;&#12364;&#30906;&#35469;&#12391;&#12365;&#12414;&#12377;&#12290;~
~
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#running-binaries ~

 $ cd ~/NVIDIA_CUDA-5.0_Samples/bin/linux/release/
 $ ./deviceQuery
 ./deviceQuery Starting...
  
    CUDA Device Query (Runtime API) version (CUDART static linking)
   
    Detected 1 CUDA Capable device(s)
   
    Device 0: "Tesla K20c"
     CUDA Driver Version / Runtime Version          5.0 / 5.0
     CUDA Capability Major/Minor version number:    3.5
     Total amount of global memory:                 4800 MBytes (5032706048 bytes)
     (13) Multiprocessors x (192) CUDA Cores/MP:    2496 CUDA Cores
     GPU Clock rate:                                706 MHz (0.71 GHz)
     Memory Clock rate:                             2600 Mhz
     Memory Bus Width:                              320-bit
     L2 Cache Size:                                 1310720 bytes
     Max Texture Dimension Size (x,y,z)             1D=(65536), 2D=(65536,65536), 3D=(4096,4096,4096)
     Max Layered Texture Size (dim) x layers        1D=(16384) x 2048, 2D=(16384,16384) x 2048
     Total amount of constant memory:               65536 bytes
     Total amount of shared memory per block:       49152 bytes
     Total number of registers available per block: 65536
     Warp size:                                     32
     Maximum number of threads per multiprocessor:  2048
     Maximum number of threads per block:           1024
     Maximum sizes of each dimension of a block:    1024 x 1024 x 64
     Maximum sizes of each dimension of a grid:     2147483647 x 65535 x 65535
     Maximum memory pitch:                          2147483647 bytes
     Texture alignment:                             512 bytes
     Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
     Run time limit on kernels:                     No
     Integrated GPU sharing Host Memory:            No
     Support host page-locked memory mapping:       Yes
     Alignment requirement for Surfaces:            Yes
     Device has ECC support:                        Enabled
     Device supports Unified Addressing (UVA):      Yes
     Device PCI Bus ID / PCI location ID:           1 / 0
     Compute Mode:
       < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
  
   deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 5.0, CUDA Runtime Version = 5.0, NumDevs = 1, Device0 = Tesla  K20c

 $ ./bandwidthTest
 [CUDA Bandwidth Test] - Starting...
 Running on...
  
    Device 0: Tesla K20c
    Quick Mode
  
    Host to Device Bandwidth, 1 Device(s)
    PINNED Memory Transfers
      Transfer Size (Bytes)        Bandwidth(MB/s)
      33554432                     6431.7
  
    Device to Host Bandwidth, 1 Device(s)
    PINNED Memory Transfers
      Transfer Size (Bytes)        Bandwidth(MB/s)
      33554432                     6396.1
  
    Device to Device Bandwidth, 1 Device(s)
    PINNED Memory Transfers
      Transfer Size (Bytes)        Bandwidth(MB/s)
      33554432                     143752.5


** &#35373;&#23450;&#23436;&#20102;&#24460;&#12398;HDD&#20351;&#29992;&#23481;&#37327; [#c97ef8c4]
&#35373;&#23450;&#23436;&#20102;&#24460;&#12398;HDD&#12398;&#20351;&#29992;&#23481;&#37327;&#12399;&#20197;&#19979;&#12398;&#12392;&#12362;&#12426;&#12391;&#12377;&#12290;~

 # df -h
 Filesystem            Size  Used Avail Use% &#12510;&#12454;&#12531;&#12488;&#20301;&#32622;
 /dev/mapper/vg_beattesla-lv_root
                         50G  4.3G   45G   9% /
 tmpfs                  16G     0   16G   0% /dev/shm
 /dev/sda1             485M   66M  394M  15% /boot
 /dev/mapper/vg_beattesla-lv_home
                        852G  1.4G  808G   1% /home

* &#26356;&#26032;&#23653;&#27508; [#cbed8220]
2013/05/31 &#21021;&#31295;&#25522;&#36617; ~
2013/06/01 &#25991;&#35328;&#20462;&#27491; ~

Front page   New List of pages Search Recent changes   RSS of recent changes