3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSL2でcuda12+cuDNN環境構築(Dockerなし)

Last updated at Posted at 2024-01-05

はじめに

WSL2のUbuntu 22.04,Ubuntu 24.04で環境構築した結果いけたので多分大丈夫
他のUbutnuやMintなどにインストールする場合は適宜URLを変更してください

環境構築

とりあえずアップデート

sudo apt update && sudo apt full-upgrade -y

cudaインストール

以下のURLで対応したOSのインストラクションがあるのでWSLじゃない人は参考にすると良い。

CUDA Toolkit 12.3 Update 2 Downloads

cuDNN Download

以下のシェルスクリプトを実行してtest pass!!みたいなのが出たら成功

#!/bin/bash

# cuda12

sudo apt update && sudo apt full-upgrade -y

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin

sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600

wget https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda-repo-wsl-ubuntu-12-5-local_12.5.1-1_amd64.deb

sudo dpkg -i cuda-repo-wsl-ubuntu-12-5-local_12.5.1-1_amd64.deb

sudo cp /var/cuda-repo-wsl-ubuntu-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install cuda-toolkit-12-5

# cuDNN

wget https://developer.download.nvidia.com/compute/cudnn/9.2.1/local_installers/cudnn-local-repo-ubuntu2204-9.2.1_1.0-1_amd64.deb

sudo dpkg -i cudnn-local-repo-ubuntu2204-9.2.1_1.0-1_amd64.deb

sudo cp /var/cudnn-local-repo-ubuntu2204-9.2.1/cudnn-*-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install cudnn

sudo apt-get -y install cudnn-cuda-12

# test

sudo apt install libcudnn9-cuda-12 libcudnn9-dev-cuda-12 libcudnn9-samples -y

sudo apt install -y libfreeimage3 libfreeimage-dev

cp -r /usr/src/cudnn_samples_v9/ ~/

cd cudnn_samples_v9/mnistCUDNN/

make clean && make 

./mnistCUDNN

3
0
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?