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

More than 1 year has passed since last update.

【Docker 環境構築】PyTorch・Deep Graph Library・Cuda・mxnetのバージョン互換性【Cuda:11.2.0】

Posted at

1. 背景

UbuntuのGPUマシンのDockerコンテナ内でDeep Graph LibraryのサンプルであるGraph Convolutional Networks (GCN)のコードを実行するための環境構築のための備忘録です.

もともとcuda11.3用の環境しか用意しておらず,今回のコードの実行に必要なmxnetがcuda11.3に対応していなかったためコンテナをカスタマイズしてDockerイメージ化することにしました.

以前書いた記事でDocker回りの基本的な使い方などをまとめています.

2. 前提

PC環境

  • GPUマシン(サーバー側)
    • Ubuntu 20.04 LTS
    • AMD EPYC 7402P 24-Core Processor
    • RTX 3090 ×2
    • メモリ128GB
    • openssh-serverインストール済み
    • Dockerインストール済み

3. 環境構築

入れたいもの

  • cuda11.2.0
  • python3
  • jupyter lab(jupyter labを使いやすくするための拡張機能もいくつか)
  • nodejs
  • torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1(cu111版を入れているが,cu112が存在しないのと,cuda11.2でもcu111が動かせるため)
  • mxnet-cu112(全てはこれのバージョンに合わせるため…)
  • dgl-cu111

セットアップ

terminal
docker pull nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04
docker run -it --gpus all --name cuda11.2 -v ~/Desktop/user1:/container/user1 nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04
apt update
apt -y upgrade
apt install -y python3-pip
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html
pip install jupyterlab
apt install curl vim wget ffmpeg imagemagick nodejs npm
npm install -g n
n stable
apt purge nodejs npm
exec $SHELL -l
source ~/.bashrc

jupyter labの拡張機能をpipで入れる.

terminal
pip install jupyterlab-language-pack-ja-JP lckr-jupyterlab-variableinspector jupyterlab_nvdashboard ipywidgets black yapf isort jupyterlab_code_formatter jupyterlab_tabnine jupyterlab-lsp 'python-lsp-server[all]' pprintpp jupyterlab-spreadsheet-editor ipympl opencv-python

Deep Graph Libraryを動かすために以下を実行.

terminal
pip install mxnet-cu112
pip install dgl-cu111 dglgo -f https://data.dgl.ai/wheels/repo.html
terminal
exit
docker commit cuda11.2 cuda11.2lab

cuda11.2labという名前のDockerイメージが使えるようになった.

4. まとめ

備忘録のため,簡素なものになってしまいましたが,以上のコマンドでDGLのサンプルが実行できるDockerコンテナを作れるようになります.
ミスなどありましたら,コメントでご指摘の程よろしくお願いします.

ここまで読んでくださり,ありがとうございました.

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