0num4 / kanachan

A Japanese (Riichi) Mahjong AI Framework
1 stars 0 forks source link

devcontainer上でnvidia-smiやcudaを使えるようにする #3

Open 0num4 opened 12 months ago

0num4 commented 12 months ago

このコマンドだけでは動かなかった

# Install CUDA 11.7.1. See https://docs.nvidia.com/cuda/wsl-user-guide/index.html#getting-started-with-cuda-on-wsl.
pushd /workspaces
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/11.7.1/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb'
sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb
rm -f cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb
popd
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda
vscode ➜ /workspaces/vscode-devcontainer-test/.devcontainer (feat/cuda-learn) $ nvidia-smi
bash: nvidia-smi: command not found          
0num4 commented 12 months ago

ref: #2

0num4 commented 12 months ago

devcontainerにこれを渡したらnvidia smiが動くようになったのでこれが重要っぽい

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    "remoteUser": "root",
    "runArgs": ["--gpus", "all"]
0num4 commented 12 months ago