0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Installed CUDA12.8.1 + CUDNN9 on Ubuntu22.04 on WSL2 on Windows11

Last updated at Posted at 2025-03-20

環境構築だけで1日がおわった。。

  • ハードウェア構成
OS: Windows11 pro
Processor: 13th Gen Intel(R) Core(TM) i5-13500   2.50 GHz
Installed RAM: 64.0 GB (63.8 GB usable)
GPU: RTX4090
  • WSL上にUbuntu22.04をインストール
    power shellを起動して、下記を実行
wsl --install Ubuntu-22.04
  • Docker Desktopをインストール
    下記にアクセスしてDocker Desktop Installerをダウンロード、インストーラーに従ってDocker Desktopをインストールする
https://docs.docker.com/desktop/setup/install/windows-install/

 その後、docker.desktopを起動し、Setting->Resource->WSL integration->Ubuntu22.04をクリックしてWSL上のUbuntu22.04でdockerを使用できるようにする。

  • nvidia-container-toolkitをインストール
    power shellからubuntu22.04を起動し、下記を実行する
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
  • nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04をRunする
sudo docker run -v ${PWD}/share2host:/root/share2host -it --gpus=all --name cu12.8.1_v -p 8888:8888 nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04

 ちなみに、
  -v xxx.. Host側との共有フォルダは/root/share2host
  -p xxx.. Host側のポート8888とコンテナ内部のポート8888を接続
 してます。

  • CUDA12.8.1をインストール

作成したContainer cu12.8.1_vに入って、

docker start cu12.8.1_v
docker attach cu12.8.1_v

公式ページに従って、下記を実行する

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb
apt-get update
apt-get -y install cuda-toolkit-12-8

nvcc -Vでインストールできてるか確認

root@1f0fffe99111:/# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_0
  • CUDNNをインストール

公式ページに従って、下記を実行する

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb
apt-get update
apt-get -y install cudnn
apt-get -y install cudnn-cuda-12
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?