計算の一部をGPUに回して処理速度を向上させる. そのプログラムを作るのに、動かすのに必要なのがこのCUDAライブラリ
Compute Unified Device Architecture
CUDA自体はnvidia社からリリースされ、nvidia社製VGAカードにのみ有効である.

負荷テスト

CUDAバージョン

CUDAOSGCCICCHWCLANG
11.8.0RHEL9.0, RHEL8.6, RHEL7.9, ubuntu22.04, ubuntu20.04.4, ubuntu18.04.6gcc11まで対応
gcc6以上が推奨
20213.5 – 9.0
KeplerとMaxwellは非推奨, Pascal, Volta, Turing, Ampere, Ada, Hopper
14.0
11.7.0RHEL8.5, RHEL7.9, ubuntu22.04, ubuntu20.04.4, ubuntu18.04.6gcc11まで対応
gcc6以上が推奨
20213.5 – 8.6
KeplerとMaxwellは非推奨, Pascal, Volta, Turing, Ampere
11.6.2RHEL8.5, RHEL7.9, ubuntu20.04.4, ubuntu18.04.6
11.6.1RHEL8.5, RHEL7.9, ubuntu20.04.3, ubuntu18.04.6
11.6.0
11.5.1
11.5.0RHEL8.4, RHEL7.9, ubuntu20.04.3, ubuntu18.04.5
11.4.3
11.4.2
11.4.1RHEL8.4, RHEL7.9, ubuntu20.04.2, ubuntu18.04.5
11.4.0gcc9 まで対応
gcc6以上が推奨
19.1
2020
3.5 – 8.6
KeplerとMaxwellは非推奨, Pascal, Volta, Turing, Ampere
11.3.1RHEL8.3, RHEL7.9, ubuntu20.04.1, ubuntu18.04.53.5 – 8.6
Kepler (in part), Maxwell, Pascal, Volta, Turing, Ampere
11.3.0gcc9 まで対応
gcc5以上が推奨*
19.1
2020
3.5 – 8.6
Kepler (in part), Maxwell, Pascal, Volta, Turing, Ampere
11.2.2
11.2.1
11.2.0
11.1.1RHEL8.2, RHEL7.8, ubuntu20.04.1, ubuntu18.04.5
11.1.0
10.2.89RHEL8.1, RHEL7.7, ubuntu18.04.3819.0
2018
3.0 – 7.5
Kepler, Maxwell, Pascal, Volta, Turing
10.1.243RHEL8.0, RHEL7.6, ubuntu18.04.3
10.0.130RHEL7.5, ubuntu18.04.1718.0
2017
9.2.148RHEL7.x, Ubuntu16.04.417.0
2016
3.0 – 7.2
Kepler, Maxwell, Pascal, Volta
9.1.85RHEL7.x, Ubuntu16.046
9.0.176
8.0RHEL7.x, Ubuntu16.045.316
2015
2.0 – 6.x
Fermi, Kepler, Maxwell, Pascal

*https://docs.nvidia.com/cuda/archive/11.0/cuda-installation-guide-linux/index.html

c++の各バージョンでの言語機能実装状況(c++11とかc++14、c++17、c++20など)
https://cpprefjp.github.io/implementation-status.html

あとCUDAのバージョンで適用できるOSも限定されているようで、もしOSに適合しないCUDAを入れた場合下記のようなメッセージが出る
実質はCUDAドライバーとOSの組み合わせと思うのだが...

[   10.253873] NVRM: The NVIDIA GPU 0000:13:00.0 (PCI ID: 10de:2531)
               NVRM: installed in this system is not supported by the
               NVRM: NVIDIA 465.19.01 driver release.
               NVRM: Please see 'Appendix A - Supported NVIDIA GPU Products'
               NVRM: in this release's README, available on the operating system
               NVRM: specific graphics driver download page at www.nvidia.com.
[   10.254137] nvidia: probe of 0000:13:00.0 failed with error -1
[   10.254150] NVRM: The NVIDIA probe routine failed for 1 device(s).

インストール

下記サイトからCUDAライブラリを入手します
https://developer.nvidia.com/cuda-downloads

インストール用ファイルは

と3種類ありますが、ここでは「rpm(local)」をいつも使用しています.

CUDAを機能させるためにはNVIDIAドライバが必要です。
これらインストール用ファイルには NVIDIAドライバ を含み一度でドライバとライブラリを入れれますが、NVIDIAドライバが古かったりします.
ここではNVIDIAのように、NVIDIAドライバのみを先行してインストールして、あとからCUDAライブラリを入れております.

「rpm(local)」の場合は、rpmファイルを取得して、localinstallでリポジトリのインストール、その後必要なパッケージをインストールしています
「必要なパッケージ」は「cuda-toolkit」です. この「cuda-toolkit」でnvccやcudaライブラリ(開発/実行)がインストールされます

dnf localinstall cuda-repo-rhel9-12-1-local-12.1.0_530.30.02-1.x86_64.rpm
dnf install cuda-toolkit-12-1
 
dnf remove cuda-repo-rhel9-12-1-local-12.1.0_530.30.02-1         <-- 「必要なパッケージ」のインストールが終わったらリポジトリを削除します

もし、実行ライブラリのみ必要だったら「cuda-libraries」のみを入れます. これでランタイムライブラリのみ入ります.
Gautomatch, GCTFにおいては、cuda-libraries-10-1があればいい

インストール runfileで

nvidiaドライバとcudaライブラリを一緒に入れてみる.
まずは nouveau を強制的に外して、multi-user.targetに切り替える

[root@centos7 ~]# vi /etc/default/grub
 :
GRUB_CMDLINE_LINUX="rhgb quiet"
 ↓
GRUB_CMDLINE_LINUX="rhgb quiet nouveau.modeset=0 modprobe.blacklist=nouveau"
 :
[root@centos7 ~]# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
[root@centos7 ~]# systemctl set-default multi-user.target
[root@centos7 ~]# reboot
 
[root@centos7 ~]# yum install epel-release -y; yum install dkms -y
[root@centos7 ~]# bash /Public/cuda/cuda_12.1.0_530.30.02_linux.run --driver --kernelobjects --toolkit --no-opengl-libs --no-man-page --silent
[root@centos7 ~]# systemctl set-default graphical.target ; reboot

conda

conda経由で作れるcrYOLOやtopazにはcudaライブラリが必要ですが、別に/usr/local/cudaが必要なわけではない.
cudaの中で独自にcudaライブラリを用意するから. nvidiaドライバは必須ですけど.

なら必要な局面は?となるとrelionとか自らコンパイルするとか自作プログラムを作る際には/usr/local/cudaが必要となる

nvidia-persistenced 

CUDAの動作モード.

cudaライブラリのパッケージから入れるか、nvidiaドライバを入れてからcudaのtoolkitのみを入れるかになる
前者は「Persistence Mode」のツールも入れてくれるが、後者は入らない。

後者の場合 https://download.nvidia.com/XFree86/nvidia-persistencedにてnvidiaドライバと同じバージョンのツールを取得する

bash NVIDIA-Linux-x86_64-520.56.06.run --disable-nouveau --no-opengl-files --no-libglx-indirect
reboot
tar xf nvidia-persistenced-520.56.06.tar.bz2                <-- 取得したファイル
cd nvidia-persistenced-520.56.06
make
make install
cd init
make install    <--- 「nvidia-persistenced.service」がインストールされる

EnvironmentModules

コンパイラ環境でもあるので modulefile を用意します

[root@rockylinux9 ~]# mkdir /apps/modulefiles/cuda
 
[root@rockylinux9 ~]# vi /apps/modulefiles/cuda/12.1
#%Module1.0
 
set cuda /usr/local/cuda-12.1
 
prepend-path PATH            $cuda/bin
prepend-path LD_LIBRARY_PATH $cuda/lib64
prepend-path MANPATH         $cuda/share/man
 
[root@rockylinux9 ~]#

LD_LIBRARY_PATH は「/etc/ld.so.conf.d/」で定義されているから不要かもしれない

最新の60件
2025-01-23 2025-01-22 2025-01-21 2025-01-20 2025-01-13 2025-01-12 2025-01-08 2024-12-30 2024-12-29 2024-12-22 2024-12-20 2024-12-17 2024-12-15 2024-12-14 2024-12-12 2024-12-11 2024-12-10 2024-12-09 2024-12-08 2024-12-04 2024-11-28 2024-11-22 2024-11-15 2024-11-14 2024-11-12 2024-11-06 2024-11-05 2024-11-04 2024-11-02 2024-11-01 2024-10-29 2024-10-28 2024-10-27 2024-10-23 2024-10-18 2024-10-17 2024-10-15 2024-10-14 2024-10-13 2024-10-11 2024-10-10 2024-10-09 2024-10-08 2024-10-05

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-08-14 (月) 16:35:03