Twitterに投稿 はてなブックマークに追加 Google Bookmarksに追加

目次 >> CUDA >> インストール(Linux編)

CUDA - インストール(Linux編)

NVIDIAのGPGPU開発環境であるCUDA(Compute unified device architecture)をインストールして、使ってみる。
OSはubuntu 12.04 x86_64
GeForce GTX 285 2GB VRAM
Intel Core i7 860 2.80GHz
RAM 8GB
CUDA 4.2.9

まず、Xサーバが動いていると

  ERROR: You appear to be running an X server; please exit X before
         installing.  For further details, please see the section INSTALLING
         THE NVIDIA DRIVER in the README available on the Linux driver
         download page at www.nvidia.com.

のようなメッセージが出てドライバがインストールできないので、Xサーバを終了する。
Ubuntu 11.10からは従来のgdmではなく、lightdmになった。下記のようにタイプし

$ sudo service lightdm stop

Xサーバを終了する。そしてダウンロードしたドライバファイルを実行する

$ sudo ./devdriver_4.2_linux_64_295.41.run

いろいろ聞かれるが、通常はすべてYesで問題ない。
次に、CUDA toolkitをインストールする。下記のようにタイプし、

$ sudo ./cudatoolkit_4.2.9_linux_64_ubuntu11.04.run

途中、

Enter install path (default /usr/local/cuda, '/cuda' will be appended):

のように聞かれるが、基本的にデフォルトのままで良い。最後に

========================================

* 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, remove the CUDA files in /usr/local/cuda
* Installation Complete

と出れば完了である。
そして、この中の指示にあるように、たとえば.bashrcに、

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

このような二行を足して、PATHに/usr/local/cuda/binを、LD_LIBRARY_PATHに/usr/local/cuda/lib64および:/usr/local/cuda/libを追加する(64ビットOSの場合)。

最後にGPU Computing SDKをインストールする。これはrootで行う必要は無い。

$ ./gpucomputingsdk_4.2.9_linux.run

とタイプすると、インストールするパスを聞いてくる。

Enter install path (default ~/NVIDIA_GPU_Computing_SDK):

通常はこのままで良い。

Located CUDA at /usr/local/cuda
If this is correct, choose the default below.
If it is not correct, enter the correct path to CUDA

Enter CUDA install path (default /usr/local/cuda): 

これも特に変更していなければここままリターン。
これでインストールは完了である。

SDKをインストールしたディレクトリに移動して、makeと打つと、SDK内のファイルのコンパイルが始まる。
SDKディレクトリ下のC/bin/linux/releaseにある、deviceQueryを実行して下記のように出れば、コンパイルおよび実行環境が正常にインストールされている。

$ ./deviceQuery
[deviceQuery] starting...

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Found 1 CUDA Capable device(s)

Device 0: "GeForce GTX 285"
  CUDA Driver Version / Runtime Version          4.2 / 4.2
  CUDA Capability Major/Minor version number:    1.3
  Total amount of global memory:                 1024 MBytes (1073414144 bytes)
  (30) Multiprocessors x (  8) CUDA Cores/MP:    240 CUDA Cores
  GPU Clock rate:                                1476 MHz (1.48 GHz)
  Memory Clock rate:                             1242 Mhz
  Memory Bus Width:                              512-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 16384
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1024
  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
  Concurrent copy and execution:                 Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  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 = 4.2, CUDA Runtime Version = 4.2, NumDevs = 1, Device = GeForce GTX 285
[deviceQuery] test results...
PASSED

> exiting in 3 seconds: 3...2...1...done!

古いドキュメント4

NVIDIAのGPGPU開発環境であるCUDA(Compute unified device architecture)をインストールして、使ってみる。
OSはubuntu 11.04 x86_64
GeForce GTX 285 2GB VRAM
Intel Core i7 860 2.80GHz
RAM 8GB
CUDA 4.0

CUDA 4.0はUbuntu 11.04をサポートしていないので、少し手間がかかる。
まず、Ubuntu11.04はgcc4.5が標準で、これはCUDA4.0ではサポートされていないのでgcc4.4をインストールする。

$ sudo apt-get install build-essential gcc-4.4 g++-4.4 libxi-dev libxmu-dev freeglut3-dev

次に、gdmを止める

$ sudo service gdm stop
gdm stop/waiting

と打ち、Xサーバを終了する。もしここで、

stop: Unknown instance:

などのエラーが出て、終了しない場合は、ps

$ ps ax | grep gdm
3465 ? S 0:00 xinit /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm -- /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3467 tty7 S<s+ 0:04 /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3643 ? S 0:00 /bin/bash /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm
5253 pts/0 S+ 0:00 grep gdm

もしくは

$ pgrep Xorg
3465

でプロセスIDを調べて、

$ sudo kill 3465

直接killすればよい。

Xサーバを終了したら、

$ sudo ./devdriver_4.0_linux_64_270.41.19.run

と打ち、ドライバをインストールする。
しかし、Ubuntuのデフォルトの状態では下記のようなエラーが出てインストールできない。

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        


  Please read the following LICENSE and then select either "Accept" to accept
  the license and continue with the installation, or select "Do Not Accept" to
  abort the installation.

                     Accept                     Do Not Accept 

            License For Customer Use of NVIDIA Software


 IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of
 NVIDIA Software ("LICENSE") is the agreement which governs use of
 the software of NVIDIA Corporation and its subsidiaries ("NVIDIA")
 downloadable herefrom, including computer software and associated
 printed materials ("SOFTWARE").  By downloading, installing, copying,
 or otherwise using the SOFTWARE, you agree to be bound by the terms
 of this LICENSE.  If you do not agree to the terms of this LICENSE,
 do not download the SOFTWARE.


  NVIDIA Software License                                                  Top 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        






  The distribution-provided pre-install script failed!  Continue installation
  anyway?

                               Yes           No











  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  ERROR: The Nouveau kernel driver is currently in use by your system.  This
         driver is incompatible with the NVIDIA driver, and must be disabled
         before proceeding.  Please consult the NVIDIA driver README and your
         Linux distribution's documentation for details on how to correctly
         disable the Nouveau kernel driver.

                                       OK  









  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

そこで、まず、

$ sudo apt-get install nvidia-current

で、nvidiaのcurrentドライバをインストールした後、再起動。

$ sudo reboot

そして、すぐさま、今インストールしたばかりのドライバも含めて、nvidia-*でいくつかのパッケージを削除する。

$ sudo apt-get remove nvidia-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'nvidia-glx' for regex 'nvidia-*'
Note, selecting 'nvidia-common' for regex 'nvidia-*'
Note, selecting 'nvidia-current' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-libvdpau-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-vdpau-driver' for regex 'nvidia-*'
Note, selecting 'nvidia-vdpau-driver-ia32' for regex 'nvidia-*'
Note, selecting 'nvidia-libvdpau' for regex 'nvidia-*'
Note, selecting 'nvidia-libvdpau-ia32' for regex 'nvidia-*'
Note, selecting 'nvidia-libvdpau1' for regex 'nvidia-*'
Note, selecting 'nvidia-libvdpau1-ia32' for regex 'nvidia-*'
Note, selecting 'nvidia-180-modaliases' for regex 'nvidia-*'
Note, selecting 'nvidia-185-modaliases' for regex 'nvidia-*'
Note, selecting 'nvidia-current-modaliases' for regex 'nvidia-*'
Note, selecting 'nvidia-settings' for regex 'nvidia-*'
Note, selecting 'nvidia-173' for regex 'nvidia-*'
Note, selecting 'nvidia-173-modaliases' for regex 'nvidia-*'
Note, selecting 'nvidia-173-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-173-kernel-source' for regex 'nvidia-*'
Note, selecting 'nvidia-180-kernel-source' for regex 'nvidia-*'
Note, selecting 'nvidia-185-kernel-source' for regex 'nvidia-*'
Note, selecting 'nvidia-180-libvdpau' for regex 'nvidia-*'
Note, selecting 'nvidia-185-libvdpau' for regex 'nvidia-*'
Note, selecting 'nvidia-180-libvdpau-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-185-libvdpau-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-current-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-96' for regex 'nvidia-*'
Note, selecting 'nvidia-96-modaliases' for regex 'nvidia-*'
Note, selecting 'nvidia-96-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-96-kernel-source' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-173' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-173-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-180' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-185' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-180-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-185-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-96' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-96-dev' for regex 'nvidia-*'
Note, selecting 'nvidia-glx-ia32' for regex 'nvidia-*'
Note, selecting 'nvidia-va-driver' for regex 'nvidia-*'
Note, selecting 'nvidia-cg-toolkit' for regex 'nvidia-*'
Note, selecting 'nvidia-opencl-icd' for regex 'nvidia-*'
Note, selecting 'vdpau-va-driver' instead of 'nvidia-va-driver'
Package nvidia-173 is not installed, so not removed
Package nvidia-173-dev is not installed, so not removed
Package nvidia-173-kernel-source is not installed, so not removed
Package nvidia-180-kernel-source is not installed, so not removed
Package nvidia-180-libvdpau is not installed, so not removed
Package nvidia-180-libvdpau-dev is not installed, so not removed
Package nvidia-185-kernel-source is not installed, so not removed
Package nvidia-185-libvdpau is not installed, so not removed
Package nvidia-185-libvdpau-dev is not installed, so not removed
Package nvidia-96 is not installed, so not removed
Package nvidia-96-dev is not installed, so not removed
Package nvidia-96-kernel-source is not installed, so not removed
Package nvidia-current-dev is not installed, so not removed
Package nvidia-glx-173 is not installed, so not removed
Package nvidia-glx-173-dev is not installed, so not removed
Package nvidia-glx-180 is not installed, so not removed
Package nvidia-glx-180-dev is not installed, so not removed
Package nvidia-glx-185 is not installed, so not removed
Package nvidia-glx-185-dev is not installed, so not removed
Package nvidia-glx-96 is not installed, so not removed
Package nvidia-glx-96-dev is not installed, so not removed
Package nvidia-180-modaliases is not installed, so not removed
Package vdpau-va-driver is not installed, so not removed
Package nvidia-cg-toolkit is not installed, so not removed
The following packages will be REMOVED:
  nvidia-common nvidia-current nvidia-settings ubuntu-desktop
0 upgraded, 0 newly installed, 4 to remove and 10 not upgraded.
After this operation, 154 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 139838 files and directories currently installed.)
Removing ubuntu-desktop ...
Removing nvidia-common ...
Removing nvidia-current ...
Removing all DKMS Modules
Done.
update-alternatives: using /usr/lib/mesa/ld.so.conf to provide /etc/ld.so.conf.d/GL.conf (gl_conf) in auto mode.
Removing nvidia-settings ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.POSIX.cache...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for man-db ...
Processing triggers for python-support ...

またまた再起動。なお、このインストールプロセスの中には余分な再起動が入っているかもしれないのでご了承を。

$ sudo reboot

再びgdmを止めて

$ sudo service gdm stop
gdm stop/waiting

ドライバのインストールを試みる。

$ sudo ./devdriver_4.0_linux_64_270.41.19.run

しかし、

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        


  Please read the following LICENSE and then select either "Accept" to accept
  the license and continue with the installation, or select "Do Not Accept" to
  abort the installation.

                     Accept                     Do Not Accept 

            License For Customer Use of NVIDIA Software


 IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of
 NVIDIA Software ("LICENSE") is the agreement which governs use of
 the software of NVIDIA Corporation and its subsidiaries ("NVIDIA")
 downloadable herefrom, including computer software and associated
 printed materials ("SOFTWARE").  By downloading, installing, copying,
 or otherwise using the SOFTWARE, you agree to be bound by the terms
 of this LICENSE.  If you do not agree to the terms of this LICENSE,
 do not download the SOFTWARE.


  NVIDIA Software License                                                  Top 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  ERROR: The Nouveau kernel driver is currently in use by your system.  This
         driver is incompatible with the NVIDIA driver, and must be disabled
         before proceeding.  Please consult the NVIDIA driver README and your
         Linux distribution's documentation for details on how to correctly
         disable the Nouveau kernel driver.

                                       OK  









  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

と再び同じエラーが出る。ここでOKを押すと、

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  For some distributions, Nouveau can be disabled by adding a file in the
  modprobe configuration directory.  Would you like nvidia-installer to
  attempt to create this modprobe file for you?

                               Yes           No   











  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

と聞いてくるので、Yesを選択。

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        




  The modprobe configuration file to disable Nouveau,
  /etc/modprobe.d/nvidia-installer-disable-nouveau.conf, has been written.
  For some distributions, this may be sufficient to disable Nouveau; other
  distributions may require modification of the initial ramdisk.  Please
  reboot your system and attempt NVIDIA driver installation again.  Note if
  you later wish to reenable Nouveau, you will need to delete the file
  /etc/modprobe.d/nvidia-installer-disable-nouveau.conf.

                                       OK  








  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  ERROR: Installation has failed.  Please see the file
         '/var/log/nvidia-installer.log' for details.  You may find
         suggestions on fixing installation problems in the README available
         on the Linux driver download page at www.nvidia.com.

                                       OK  










  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

一旦これでインストーラから抜ける。
ちなみに、このnvidia-installer-disable-nouveau.confを加える作業をやっても、途中にやったnvidia-currentをインストールしてアンインストールする作業をやらないと、なぜか、nouveauが無効になってくれないので注意。
再起動をかける。

$sudo reboot
$ sudo service gdm stop
gdm stop/waiting

そして、ドライバのインストールを開始。

$ sudo ./devdriver_4.0_linux_64_270.41.19.run
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        


  Please read the following LICENSE and then select either "Accept" to accept
  the license and continue with the installation, or select "Do Not Accept" to
  abort the installation.

                     Accept                     Do Not Accept 

            License For Customer Use of NVIDIA Software


 IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of
 NVIDIA Software ("LICENSE") is the agreement which governs use of
 the software of NVIDIA Corporation and its subsidiaries ("NVIDIA")
 downloadable herefrom, including computer software and associated
 printed materials ("SOFTWARE").  By downloading, installing, copying,
 or otherwise using the SOFTWARE, you agree to be bound by the terms
 of this LICENSE.  If you do not agree to the terms of this LICENSE,
 do not download the SOFTWARE.


  NVIDIA Software License                                                  Top 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        






  Install NVIDIA's 32-bit compatibility OpenGL libraries?

                               Yes           No












  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  Would you like to run the nvidia-xconfig utility to automatically update
  your X configuration file so that the NVIDIA X driver will be used when you
  restart X?  Any pre-existing X configuration file will be backed up.        

                               Yes           No   











  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

ここはYesを選択。

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (270.41.19)        





  Your X configuration file has been successfully updated.  Installation of
  the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 270.41.19)
  is now complete.

                                       OK  











  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

これでドライバのインストールは完了。

次に、CUDA toolkitをインストールする

$ sudo ./cudatoolkit_4.0.17_linux_64_ubuntu10.10.run

すると

Enter install path (default /usr/local/cuda, '/cuda' will be appended):

と、インストールする場所を聞かれるが、デフォルトの/usr/local/cudaでよい。
最後に、

* 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

と出るはずであるので、使っているシェルにもよるが、例えばbashを使っているのであれば、.bashrcなどを編集して、パスに/usr/local/cuda/binを、LD_LIBRARY_PATHに /usr/local/cuda/lib64:/usr/local/cuda/libを追加する。

最後に、CUDA SDKをインストールする。これはsudoで行わなくてもよい。

$ ./gpucomputingsdk_4.0.17_linux.run

と打つ。

最後にgccの設定をする。まず、

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.5

と打って、gccのバージョンを選べるようにする。これで、

$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-4.5   60        auto mode
  1            /usr/bin/gcc-4.4   40        manual mode
  2            /usr/bin/gcc-4.5   60        manual mode

Press enter to keep the current choice[*], or type selection number: 

のように選択できるようになる。CUDAを使う場合は、4.4を使う。

再起動して、~/NVIDIA_GPU_Computing_SDKでmakeと打つ。
(もし、ライブラリがないなどのエラーが出たら、必要なライブラリをapt-getでインストールする。)
makeが完了したら、~/NVIDIA_GPU_Computing_SDK/C/bin/linux/releaseにdeviceQueryという実行ファイルができているはずなので実行してみる。

$ ./deviceQuery
[deviceQuery] starting...
./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Found 1 CUDA Capable device(s)

Device 0: "GeForce GTX 285"
  CUDA Driver Version / Runtime Version          4.0 / 4.0
  CUDA Capability Major/Minor version number:    1.3
  Total amount of global memory:                 1024 MBytes (1073414144 bytes)
  (30) Multiprocessors x ( 8) CUDA Cores/MP:     240 CUDA Cores
  GPU Clock Speed:                               1.48 GHz
  Memory Clock rate:                             1242.00 Mhz
  Memory Bus Width:                              512-bit
  Max Texture Dimension Size (x,y,z)             1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(8192) x 512, 2D=(8192,8192) x 512
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 16384
  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
  Concurrent copy and execution:                 Yes with 1 copy engine(s)
  Run time limit on kernels:                     No
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   No
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      No
  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 = 4.0, CUDA Runtime Version = 4.0, NumDevs = 1, Device = GeForce GTX 285
[deviceQuery] test results...
PASSED

Press ENTER to exit...

このように出れば、OKである。(ドライバをインストールした場合は再起動するのを忘れないように)

古いドキュメント3

NVIDIAのGPGPU開発環境であるCUDA(Compute unified device architecture)をインストールして、使ってみる。
OSはubuntu 10.10 x86_64
GeForce GTX 285 2GB VRAM
Intel Core i7 860 2.80GHz
RAM 8GB
CUDA 3.2

まず、Xサーバが動いているとインストールできないので、コマンドラインで

$ sudo /etc/init.d/gdm stop
* Stopping GNOME Display Manager...
...done.

と打ち、Xサーバを終了する。もしここで、

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service gdm stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop gdm

というエラーが出たら、エラー内の指示通りに、

$ sudo service gdm stop

と打つ。

もしこれで

stop: Unknown instance:

などのエラーが出て、終了しない場合は、ps

$ ps ax | grep gdm
3465 ? S 0:00 xinit /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm -- /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3467 tty7 S<s+ 0:04 /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3643 ? S 0:00 /bin/bash /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm
5253 pts/0 S+ 0:00 grep gdm

もしくは

$ pgrep Xorg
3465

でプロセスIDを調べて、

$ sudo kill 3465

直接killすればよい。

Xサーバを終了したら、

$ sudo ./devdriver_3.2_linux_64_260.19.21.run

と打ち、ドライバをインストールする。質問には基本的にすべてyesでよい。

次に、CUDA toolkitをインストールする

$ sudo ./cudatoolkit_3.2.16_linux_64_ubuntu10.04.run

すると

Enter install path (default /usr/local/cuda, '/cuda' will be appended):

と、インストールする場所を聞かれるが、デフォルトの/usr/local/cudaでよい。
最後に、

* 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

と出るはずであるので、使っているシェルにもよるが、例えばbashを使っているのであれば、.bashrcなどを編集して、パスに/usr/local/cuda/binを、LD_LIBRARY_PATHに /usr/local/cuda/lib64を追加する。

最後に、CUDA SDKをインストールする。これはsudoで行わなくてもよい。

$ ./gpucomputingsdk_3.2.16_linux.run

と打つ。

再起動して、~/NVIDIA_GPU_Computing_SDK/Cでmakeと打つ。
(もし、ライブラリがないなどのエラーが出たら、必要なライブラリをapt-getでインストールする。)
makeが完了したら、~/NVIDIA_GPU_Computing_SDK/C/bin/linux/releaseにdeviceQueryという実行ファイルができているはずなので実行してみる。

$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

There is 1 device supporting CUDA

Device 0: "GeForce GTX 285"
CUDA Driver Version: 3.20
CUDA Runtime Version: 3.20
CUDA Capability Major/Minor version number: 1.3
Total amount of global memory: 1073020928 bytes
Multiprocessors x Cores/MP = Cores: 30 (MP) x 8 (Cores/MP) = 240 (Cores)
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 16384
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.48 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: No
Integrated: No
Support host page-locked memory mapping: Yes
Compute mode: Default (multiple host threads can use this device simultaneously)
Concurrent kernel execution: No
Device has ECC support enabled: No
Device is using TCC driver mode: No

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.20, CUDA Runtime Version = 3.20, NumDevs = 1, Device = GeForce GTX 285


PASSED

Press <Enter> to Quit...
-----------------------------------------------------------

このように出れば、OKである。(ドライバをインストールした場合は再起動するのを忘れないように)

古いドキュメント2

NVIDIAのGPGPU開発環境であるCUDA(Compute unified device architecture)をインストールして、使ってみる。
OSはubuntu 10.04 x86_64
GeForce GTX 285 2GB VRAM
Intel Core i7 860 2.80GHz
RAM 8GB
CUDA 3.0

なお、CUDAを使ったプログラムをコンパイルする際にはgccが必須である。
Ubuntu 10.04が2010/4/29にリリースされたが、その時点においてCUDAはUbuntu 9.04用までしかリリースされていない。NVIDIAのフォーラムにUbuntu 10.04にUbuntu 9.04用のCUDAをインストールする方法が載っていたので、それに従った。

CUDAのインストール

CUDA 3.0がサポートしているUbuntu 9.04の場合はそのままドライバのインストールに進めばよいのだが、Ubuntu 10.04の場合はデフォルトの状態では

       NVIDIA Accelerated Graphics Driver for Linux-x86_64 (195.36.15)        


ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most
frequently when this kernel module was built against the wrong or
improperly configured kernel sources, with a version of gcc that
differs from the one used to build the target kernel, or if a driver
such as rivafb/nvidiafb is present and prevents the NVIDIA kernel
module from obtaining ownership of the NVIDIA graphics device(s), or
NVIDIA GPU installed in this system is not supported by this NVIDIA
Linux graphics driver release.

Please see the log entries 'Kernel module load error' and 'Kernel
messages' at the end of the file '/var/log/nvidia-installer.log' for
more information.

OK





NVIDIA Software Installer for Unix/Linux www.nvidia.com

というエラーが出てドライバがインストールできないので次のステップを実行する。Ubuntu 9.04の場合は次のステップは飛ばしてよい。


(ここからUbuntu 10.04のみ)

まず、現在インストールされているNVIDIAのパッケージを削除する。

$ sudo apt-get purge nvidia-*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting nvidia-vdpau-driver for regex 'nvidia-*'
Note, selecting nvidia-185-kernel-source for regex 'nvidia-*'
Note, selecting nvidia-96-kernel-source for regex 'nvidia-*'
Note, selecting nvidia-173-dev for regex 'nvidia-*'
Note, selecting nvidia-kernel-common for regex 'nvidia-*'
Note, selecting nvidia-common for regex 'nvidia-*'
Note, selecting nvidia-173 for regex 'nvidia-*'
Note, selecting nvidia-cg-toolkit for regex 'nvidia-*'
Note, selecting nvidia-180-libvdpau for regex 'nvidia-*'
Note, selecting nvidia-glx-96-dev for regex 'nvidia-*'
Note, selecting nvidia-current for regex 'nvidia-*'
Note, selecting nvidia-185-libvdpau-dev for regex 'nvidia-*'
Note, selecting nvidia-96 for regex 'nvidia-*'
Note, selecting nvidia-glx-dev for regex 'nvidia-*'
Note, selecting nvidia-current-modaliases for regex 'nvidia-*'
Note, selecting nvidia-vdpau-driver-ia32 for regex 'nvidia-*'
Note, selecting nvidia-185-libvdpau for regex 'nvidia-*'
Note, selecting nvidia-libvdpau for regex 'nvidia-*'
Note, selecting nvidia-glx-ia32 for regex 'nvidia-*'
Note, selecting nvidia-glx-173-dev for regex 'nvidia-*'
Note, selecting nvidia-glx-185-dev for regex 'nvidia-*'
Note, selecting nvidia-173-kernel-source for regex 'nvidia-*'
Note, selecting nvidia-glx-173 for regex 'nvidia-*'
Note, selecting nvidia-glx-180 for regex 'nvidia-*'
Note, selecting nvidia-glx-185 for regex 'nvidia-*'
Note, selecting nvidia-96-dev for regex 'nvidia-*'
Note, selecting nvidia-180-libvdpau-dev for regex 'nvidia-*'
Note, selecting nvidia-180-modaliases for regex 'nvidia-*'
Note, selecting nvidia-96-modaliases for regex 'nvidia-*'
Note, selecting nvidia-libvdpau-dev for regex 'nvidia-*'
Note, selecting nvidia-libvdpau-ia32 for regex 'nvidia-*'
Note, selecting nvidia-180-kernel-source for regex 'nvidia-*'
Note, selecting nvidia-libvdpau1 for regex 'nvidia-*'
Note, selecting nvidia-current-dev for regex 'nvidia-*'
Note, selecting nvidia-glx-96 for regex 'nvidia-*'
Note, selecting nvidia-173-modaliases for regex 'nvidia-*'
Note, selecting nvidia-185-modaliases for regex 'nvidia-*'
Note, selecting nvidia-glx for regex 'nvidia-*'
Note, selecting nvidia-glx-180-dev for regex 'nvidia-*'
Note, selecting nvidia-settings for regex 'nvidia-*'
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-21-generic linux-headers-2.6.32-21
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
nvidia-173-modaliases* nvidia-96-modaliases* nvidia-common*
nvidia-current-modaliases*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 442kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 147384 files and directories currently installed.)
Removing nvidia-common ...
Purging configuration files for nvidia-common ...
Removing nvidia-173-modaliases ...
Removing nvidia-96-modaliases ...
Removing nvidia-current-modaliases ...

次に、/etc/modprobe.d/nvidia-graphics-drivers.confというファイルを作成し内容を

blacklist vga16fb
blacklist nouveau
blacklist lbm-nouveau
blacklist nvidia-173
blacklist nvidia-96
blacklist nvidia-current
blacklist nvidiafb

とする。

次に、/etc/X11/xorg.confというファイルを作成し、内容を

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

とする。

ここまでやったら、いったん再起動する。

$ sudo reboot

(ここまでUbuntu 10.04のみ)


まず、Xサーバが動いているとインストールできないので、コマンドラインで

$ sudo /etc/init.d/gdm stop
* Stopping GNOME Display Manager...
...done.

と打ち、Xサーバを終了する。もしここで、

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service gdm stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop gdm

というエラーが出たら、エラー内の指示通りに、

$ sudo service gdm stop

と打つ。

もしこれで

stop: Unknown instance:

などのエラーが出て、終了しない場合は、ps

$ ps ax | grep gdm
3465 ? S 0:00 xinit /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm -- /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3467 tty7 S<s+ 0:04 /usr/bin/X :0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7 -br -once -config /etc/X11/xorg.conf.failsafe -logfile /var/log/Xorg.failsafe.log
3643 ? S 0:00 /bin/bash /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe with-gdm
5253 pts/0 S+ 0:00 grep gdm

もしくは

$ pgrep Xorg
3465

でプロセスIDを調べて、

$ sudo kill 3465

直接killすればよい。

Xサーバを終了したら、

$ sudo sh devdriver_3.0_linux_64_195.36.15.run

と打ち、ドライバをインストールする。質問には基本的にすべてyesでよい。特にUbuntu 10.04の場合は

       NVIDIA Accelerated Graphics Driver for Linux-x86_64 (195.36.15)        





  Would you like to run the nvidia-xconfig utility to automatically update
  your X configuration file so that the NVIDIA X driver will be used when you
  restart X?  Any pre-existing X configuration file will be backed up.        

                               Yes           No   











  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com

ここでYesを選択する。

ここでシステムを再起動する。

$ sudo reboot

次に、CUDA toolkitをインストールする。

$ sudo sh cudatoolkit_3.0_linux_64_ubuntu9.04.run

と打つと、

$ sudo sh cudatoolkit_3.0_linux_64_ubuntu9.04.run
Verifying archive integrity... All good.
Uncompressing NVIDIA CUDA...

Enter install path (default /usr/local/cuda, '/cuda' will be appended):

(中略)

* 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で特に問題ない。

使っているシェルにもよるが、例えばbashを使っているのであれば、.bashrcなどを編集して、パスに/usr/local/cuda/binを、LD_LIBRARY_PATHに /usr/local/cuda/lib64を追加する。

最後に、CUDA SDKをインストールする。これはsudoで行わなくてもよい。

$ sh gpucomputingsdk_3.0_linux.run

と打つと、

$ sh gpucomputingsdk_3.0_linux.run
Verifying archive integrity... All good.
Uncompressing NVIDIA GPU Computing SDK............

Enter install path (default ~/NVIDIA_GPU_Computing_SDK):

Located CUDA at /usr/local/cuda
If this is correct, choose the default below.
If it is not correct, enter the correct path to CUDA

Enter CUDA install path (default /usr/local/cuda):

(中略)

========================================

Configuring SDK Makefile (/home/foo/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 /home/foo/NVIDIA_GPU_Computing_SDK
* Installation Complete

(ここからUbuntu 10.04のみ)

Ubuntu 10.04でもCUDA toolkit、GPU Computing SDKのインストール自体は問題なく行える。しかしコンパイルは下記の設定を行わないとエラーが出てしまう。

まず、gcc 4.3を導入する。

$ sudo apt-get install gcc-4.3 g++-4.3
[sudo] password for satodadmin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-21-generic linux-headers-2.6.32-21
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
cpp-4.3 gcc-4.3-base libstdc++6-4.3-dev
Suggested packages:
gcc-4.3-locales g++-4.3-multilib gcc-4.3-doc libstdc++6-4.3-dbg
gcc-4.3-multilib libmudflap0-4.3-dev libgcc1-dbg libgomp1-dbg
libmudflap0-dbg libstdc++6-4.3-doc
The following NEW packages will be installed:
cpp-4.3 g++-4.3 gcc-4.3 gcc-4.3-base libstdc++6-4.3-dev
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.5MB of archives.
After this operation, 33.9MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/universe gcc-4.3-base 4.3.4-10ubuntu1 [111kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/universe cpp-4.3 4.3.4-10ubuntu1 [3,367kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/universe gcc-4.3 4.3.4-10ubuntu1 [2,791kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid/universe libstdc++6-4.3-dev 4.3.4-10ubuntu1 [1,385kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid/universe g++-4.3 4.3.4-10ubuntu1 [4,809kB]
Fetched 12.5MB in 7s (1,614kB/s)
Selecting previously deselected package gcc-4.3-base.
(Reading database ... 145621 files and directories currently installed.)
Unpacking gcc-4.3-base (from .../gcc-4.3-base_4.3.4-10ubuntu1_amd64.deb) ...
Selecting previously deselected package cpp-4.3.
Unpacking cpp-4.3 (from .../cpp-4.3_4.3.4-10ubuntu1_amd64.deb) ...
Selecting previously deselected package gcc-4.3.
Unpacking gcc-4.3 (from .../gcc-4.3_4.3.4-10ubuntu1_amd64.deb) ...
Selecting previously deselected package libstdc++6-4.3-dev.
Unpacking libstdc++6-4.3-dev (from .../libstdc++6-4.3-dev_4.3.4-10ubuntu1_amd64.deb) ...
Selecting previously deselected package g++-4.3.
Unpacking g++-4.3 (from .../g++-4.3_4.3.4-10ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up gcc-4.3-base (4.3.4-10ubuntu1) ...
Setting up cpp-4.3 (4.3.4-10ubuntu1) ...
Setting up gcc-4.3 (4.3.4-10ubuntu1) ...
Setting up g++-4.3 (4.3.4-10ubuntu1) ...
Setting up libstdc++6-4.3-dev (4.3.4-10ubuntu1) ...

次に、

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.3
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4

とコマンドを打つ。これでupdate-alternatives --config gccと打つと

$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-4.4 60 auto mode
1 /usr/bin/gcc-4.3 40 manual mode
2 /usr/bin/gcc-4.4 60 manual mode

Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-4.3 to provide /usr/bin/gcc (gcc) in manual mode.

のようにgccのバージョンを選べるようになる。CUDAをコンパイルする際はgcc4.3を使う必要がある。

(ここまでUbuntu 10.04のみ)


そして、~/NVIDIA_GPU_Computing_SDK/Cでmakeと打つ。
(もし、ライブラリがないなどのエラーが出たら、必要なライブラリをapt-getでインストールする。)
makeが完了したら、~/NVIDIA_GPU_Computing_SDK/C/bin/linux/releaseにdeviceQueryという実行ファイルができているはずなので実行してみる。

$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

There is 1 device supporting CUDA

Device 0: "GeForce GTX 285"
CUDA Driver Version: 3.0
CUDA Runtime Version: 3.0
CUDA Capability Major revision number: 1
CUDA Capability Minor revision number: 3
Total amount of global memory: 1073414144 bytes
Number of multiprocessors: 30
Number of cores: 240
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 16384
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.48 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: No
Integrated: No
Support host page-locked memory mapping: Yes
Compute mode: Default (multiple host threads can use this device simultaneously)

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 4249427, CUDA Runtime Version = 3.0, NumDevs = 1, Device = GeForce GTX 285


PASSED

Press <Enter> to Quit...
-----------------------------------------------------------

このように出れば、OKである。(ドライバをインストールした場合は再起動しておく必要がある)

古いドキュメント

NVIDIAのGPGPU開発環境であるCUDA(Compute unified device architecture)をインストールして、使ってみる。
Suse10.2向けが
GeForce8800GT 1GB VRAM
AMD Dual-Core Opteron
RAM 4GB

CUDAのインストール

64bit版を中心に解説する。

OSのインストール

もし新規にOSをインストールするのであれば、CUDAに対応したLinuxOSをインストールする。
CUDA1.1ではOpenSUSEの場合、10.2を使うことができる。(10.3ではじめインストールしてみたが、いろいろと問題が出たので、10.2に戻した)

必要なパッケージはgccおよびg++で、すべてyastを使ってインストールできる。

次に、CUDA対応のドライバをインストールする。OpenSUSEの場合、パッケージのソースにdownload.nvidia.comを追加するとインストールできるとあるが、
参考:http://www.suse.de/~sndirsch/nvidia-installer-HOWTO.html
うまくいかなかったので、yastでカーネルのソースをダウンロードして、ここより、Linux用CUDAサポートNVIDIAドライバ(NVIDIA-Linux-x86_64-169.09-pkg2.run)をダウンロードし、

# sh NVIDIA-Linux-x86-169.12-pkg1.run -q

もしくは64bit版の場合は

# sh NVIDIA-Linux-x86_64-169.12-pkg2.run -q

と打ち、ドライバをインストール。さらに

# sax2 -r -m 0=nvidia

と打って設定を完了した。

なおこの際にX11を終了しておく必要があるので、そのやり方は、Ctrl+Alt+BSでX11を終了し、

# /sbin/init 3

と打ってテキストモードにする。

OpenSUSE 10.2用CUDAツールキット バージョン1.1のインストール

CUDAダウンロードのページからOpenSUSE 10.2用CUDAツールキット バージョン1.1をダウンロードする。

$ sudo sh NVIDIA_CUDA_Toolkit_1.1_Suse10.2_x86_64.run

と打つと、インストールパスを聞かれる。基本的にはデフォルトのままでよい。

$ sudo sh NVIDIA_CUDA_Toolkit_1.1_Suse10.2_x86_64.run

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

root's password:
Verifying archive integrity... All good.
Uncompressing NVIDIA CUDA...............................................................................
Enter install path (default /usr/local/cuda, '/cuda' will be appended):

(中略)

`lib/libcublasemu.so.1.1' -> `/usr/local/cuda/lib/libcublasemu.so.1.1'
`lib/libcublas.so' -> `/usr/local/cuda/lib/libcublas.so'
`lib/libcufft.so' -> `/usr/local/cuda/lib/libcufft.so'
`lib/libcublasemu.so.1' -> `/usr/local/cuda/lib/libcublasemu.so.1'
`lib/libcufftemu.so.1.1' -> `/usr/local/cuda/lib/libcufftemu.so.1.1'

========================================

* Please make sure your PATH includes /usr/local/cuda/bin
* Please make sure your LD_LIBRARY_PATH includes /usr/local/cuda/lib
* or add /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

使っているシェルにもよるが、例えばbashを使っているのであれば、.bashrcなどを編集して、パスに/usr/local/cuda/binを、LD_LIBRARY_PATHに /usr/local/cuda/libを追加する。

Linux用CUDA SDKバージョン1.1のインストール

CUDAダウンロードのページからLinux用CUDA SDKバージョン1.1をダウンロードする。
これはrootで実行する必要はなく、下記のように実行するとインストールされる。

$ sh NVIDIA_CUDA_SDK_1.1_Linux.run
Verifying archive integrity... All good.
Uncompressing NVIDIA CUDA SDK.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Enter install path (default ~/NVIDIA_CUDA_SDK): which: no nvcc in (/home/foo/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin)
Could not locate CUDA. Enter the full path to CUDA.
If you do not know the path, accept the default and then
modify the CUDA_INSTALL_PATH variable in
/home/foo/NVIDIA_CUDA_SDK/common/common.mk.

/usr/local/cuda

(中略)

Configuring SDK Makefile (/home/foo/NVIDIA_CUDA_SDK/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 CUDA SDK, please delete /home/foo/NVIDIA_CUDA_SDK
* Installation Complete

なお、全員に共通のディレクトリで使用できるようにするには、例えば、/usr/local/NVIDIA_CUDA_SDKのようなディレクトリにインストールすればよい。

ライブラリlibcutil.aの作成

cutilなどを含むプログラムを生成する場合、libcutil.aというファイルが必要になる。これを生成するには、
NVIDIA_CUDA_SDK/commonディレクトリでmakeと打つと、NVIDIA_CUDA_SDK/libディレクトリにlibcutil.aというファイルが作成される。

最終更新日


本文中のFC4はFedora ProjectのFedora Core 4を、FC5はFedora Core 5を、FC6はFedora Core 6をopenSUSEはNovellのSUSE Linux OSSを表します。Fedora7以降は、単にFedora7、Fedora8、Fedora9、Fedora10、Fedora11、Fedora12、Fedora13、Fedora14、Fedora15と表示しています。Ubuntuは、必要に応じて20.04、21.04のようにバージョン番号をつけて区別しています。

ここに登場するドメイン名やIPアドレスなどはフィクションです。実在の人物・団体等とは一切関係がありません。
実際に使用する際は、各自の環境に合わせて書き換えてください。
もし何か間違いなどありましたらこちらからご連絡ください
リンクに許可は不要です。
Copyright (C) 2021 Chikuma Engineering Co., Ltd. All Rights Reserved.