labs.beatcraft.com

CUDA5/CentOS6.4

CentOS 6.4(64bit) へCUDA5のインストール手順について記載します。

Hardware Spec

主なHardware Specは以下のとおりです。

CUDA_Tesla.jpg


CUDA_PC.jpg


ETSK20-5GERにはディスプレイ出力端子(D-SUB,DVI,HDMIなど)が無いため
UEFIの設定でPrimary DisplayをOn Boardに設定し、ディスプレイはM/B上の
出力端子に接続しています。

CentOS 6.4(64bit版) のインストール

CentOS 6.4(64bit版)インストール概要は以下のとおりです。

CentOS インストール後設定

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

CentOSのアップデート

インストール直後の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 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
 ...<略>
 ##      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

パッケージ追加と設定

CUDAのインストールには直接関係はありませんが、作業をしやすくするため
ntpdとopensshをインストールします。

ntpdをインストールします。

# yum install ntp

ntpサーバを追加します。

# 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を起動します。

# /etc/init.d/ntpd start

ntpdをサービスに追加します。

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

opensshをインストールします。
既にインストールされている場合はこの手順はとばしてください。

# yum install openssh

/etc/ssh/sshd_config内のPermitRootLoginと
PermitEmptyPasswordsをnoに設定します。

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

sshdを起動します。

# /etc/init.d/sshd start

sshdをサービスに追加します。

# chkconfig --level 5 sshd on
# chkconfig --level 3 sshd on

Tesla K20cドライバインストール

Tesla K20cドライバインストールについて記載します。

Tesla K20cドライバインストール準備

Tesla K20cドライバインストールのためにパッケージの追加、設定を行います。
開発用パッケージ、ライブラリ群(Development tools)をインストールします。

# yum groupinstall 'Development tools'

Tesla K20cのドライバ、CUDA5のインストール時にXが起動していると
エラーが起こるため、runlevel 3に変更し再起動を行います。

# vi /etc/inittab
  ...<略>
  # 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ドライバのダウンロード

以下のURLよりNVIDIA-Linux-x86_64-319.23.runをダウンロードします。
http://www.nvidia.co.jp/object/linux-display-amd64-319.23-driver-jp.html

NVIDIA-Linux-x86_64-319.23.runを実行し、ライセンスに同意後インストールが完了します。
/proc/driver/nvidia/にversionファイルが作成されます。

# 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)

起動時にドライバを読み込むためのファイル(/etc/init.d/nvidia)を作成し、
runlevel3,5の起動時に読み込む用設定します。
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のインストールとSampleの実行

CUDA5のインストールとCUDA5のSamplesについて記載します。

CUDA5のダウンロード

CentOS6 64bit版CUDA(cuda_5.0.35_linux_64_rhel6.x-1.run)を以下のURLから ダウンロードします。
https://developer.nvidia.com/cuda-downloads

CUDA5のSampleインストール時にPATHが見つからずSampleがインストールされないのを防ぐため、
.bashrcに予めPATHを追加します。

$ 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

パッケージのインストール

Samplesのビルドで必要な以下のパッケージを予めインストールします。

# 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 を実行します。
インストール先ディレクトリはデフォルトの/usr/local/cuda-5.0を指定します。

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

Samplesはデフォルトで/usr/local/cuda-5.0/samplesと/root/NVIDIA_CUDA-5.0_Samplesに インストールされます。

rootユーザでビルドできるようにld.so.conf.d/cuda.confを追加しldconfigを実行します。

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

CUDA5 Samplesのビルドと実行

NVIDIA_CUDA-5.0_Samplesをbeatユーザでビルド、実行できるようにします。
/root/NVIDIA_CUDA-5.0_Samplesからコピーし、オーナーをbeatに変更しmakeを実行します。

# 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

ビルド完了後 NVIDIA_CUDA-5.0_Samples/bin/linux/release/に移動し、
NVIDIA CUDA Getting Started Guide for Linuxのページ内Running the Binariesに
記載されているdeviceQuery、bandwidthTestを実行します。
deviceQuery、bandwidthTest共にTesla K20cを用いていることが確認できます。

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

設定完了後のHDD使用容量

設定完了後のHDDの使用容量は以下のとおりです。

# df -h
Filesystem            Size  Used Avail Use% マウント位置
/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

更新履歴

2013/05/31 初稿掲載


BC::labsへの質問は、bc9-dev @ googlegroups.com までお願い致します。
トップ   新規 一覧 単語検索 最終更新   最終更新のRSS