第23章付録:深層学習のための道具
23.3.2. Installing CUDA23.3.2 CUDAをインストールする
Before installing CUDA, be sure to update the instance with the latest drivers.
英語のヒント
CUDAをインストールする前に、必ずインスタンスを最新のドライバで更新しておく。
sudo apt-get update && sudo apt-get install -y build-essential git libgfortran3Here we download CUDA 12.1. Visit NVIDIA’s official repository to find the download link as shown in Fig. 23.3.11.
英語のヒント
Image omitted because its reuse rights could not be verified.権利の確認ができないため画像を割愛。
Fig. 23.3.11図23.3.11
Find the CUDA 12.1 download address.
英語のヒント
CUDA 12.1のダウンロードのアドレスを見つける。
Copy the instructions and paste them onto the terminal to install CUDA 12.1.
英語のヒント
手順をコピーしてターミナルに貼り付け、CUDA 12.1をインストールする。
# The link and file name are subject to changes
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-ubuntu2204-12-1-local_12.1.0-530.30.02-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-1-local_12.1.0-530.30.02-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudaAfter installing the program, run the following command to view the GPUs:
英語のヒント
プログラムをインストールした後、次のコマンドを実行してGPUを見る。
nvidia-smiFinally, add CUDA to the library path to help other libraries find it, such as appending the following lines to the end of
~/.bashrc.英語のヒント
最後に、ほかのライブラリがCUDAを見つけられるように、CUDAをライブラリのパスに加える。たとえば
~/.bashrcの末尾に次の行を追加する。export PATH="/usr/local/cuda-12.1/bin:$PATH"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-12.1/lib64