5
7

More than 1 year has passed since last update.

google colabにcuda10.0をインストールする

Posted at

1.はじめに

 先日、google colab から cuda10.0 が削除され、tensorflow1.14や1.15などを使ったコードでは下記のエラーが発生するようになって使えなくなってしまいました。

Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed!
・・・・・・・
・・・・・・・
・・・・・・・
RuntimeError: No GPU devices found

2.対応策
 Tensorflow1.14や1.15などはかなり古くなりましたが、stylegan2を始めとしてかなりコード資産がありますので、今回は google colab に新たに cuda10.0 をインストールするコードを備忘録として残します。

#@title install cuda10.0 

# download data
!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
!sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
!rm /etc/apt/sources.list.d/cuda.list
!sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
!sudo apt-get update
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
!sudo apt install -y ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
!sudo apt-get update

# install NVIDIA driver
!sudo apt-get -y installnvidia-driver-418

# install cuda10.0
!sudo apt-get install -y \
    cuda-10-0 \
    libcudnn7=7.6.2.24-1+cuda10.0  \
    libcudnn7-dev=7.6.2.24-1+cuda10.0

# install TensorRT
!sudo apt-get install -y libnvinfer5=5.1.5-1+cuda10.0 \
    libnvinfer-dev=5.1.5-1+cuda10.0

!apt --fix-broken install
5
7
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
5
7