Google Colaboratory 無料版(Tesla K80)・Pro(Tesla T4)とローカル(GTK1050)でLightweight GANの速度比較

2024年2月27日

Google Ad

主旨

Google Colaboratory 無料版(Tesla K80)・Pro(Tesla T4)とローカル(GTK1050)でLightweight GANの速度を調査したログである。

目的

ページの目的を以下に記す。

  • 家の環境とGoogle Colabolatoryとの速度の違いを確認
  • GPUごとの速度を測る

期間

2021年9月12日~2021年9月14日

開発に用いたもの

ローカル

開発環境

  • Windows 10 Home
  • Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz 2.21 GHz
  • GeForce GTK 1050
  • CUDA Toolkit
  • Python(自分でコードを書いた部分はなし)
  • lightweight-gan

Pythonバージョン

  • Python 3.6.8
  • torch 1.8.0
  • torchaudio 0.8.0
  • torchvision 0.9.0
  • lightweight-gan 0.20.4
  • kornia 0.4.1

Google Colaboratory 無料版

開発環境

  • Ubuntu 18.04
  • Intel(R) Xeon(R) CPU @ 2.30GHz
  • GK210GL [Tesla K80]
  • Python
  • lightweight-gan

Pythonバージョン

  • Python 3.7
  • torch 1.9.0+cu102
  • torchvision 0.10.0+cu102
  • lightweight-gan 0.20.4

Google Colaboratory Pro

開発環境

  • Ubuntu 18.04
  • Intel(R) Xeon(R) CPU @ 2.00GHz
  • Tesla T4
  • Python
  • lightweight-gan

Pythonバージョン

  • Python 3.7
  • torch 1.9.0+cu102
  • torchvision 0.10.0+cu102
  • lightweight-gan 0.20.4

操作

操作は以下のときと同様である。

学習データは以下のときと同様である。

途中で終了した場合は、最後10回のログから総計算時間を推定、早くから中断した場合はおおよそで推定。

結果

ローカル

総計算時間

44時間10分10秒

ログ

以下のときのログである。

途中で中断することになった。終了時のログは以下のとおりである。

default<E:\gan>:  47%|████████████████████████▋                           | 71190/150000 [13:07:34<28:52:28,  1.32s/it]G: 5.16 | D: 0.05 | GP: 0.03 | SS: 0.01
default<E:\gan>:  47%|████████████████████████▋                           | 71247/150000 [13:08:48<25:34:05,  1.17s/it]G: 5.57 | D: 0.01 | GP: 0.04 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▋                           | 71292/150000 [13:10:07<25:20:05,  1.16s/it]G: 4.33 | D: 0.00 | GP: 0.06 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▋                           | 71346/150000 [13:11:24<38:13:32,  1.75s/it]G: 4.26 | D: 0.02 | GP: 0.05 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▋                           | 71391/150000 [13:12:27<37:45:26,  1.73s/it]G: 4.66 | D: 0.00 | GP: 0.05 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▊                           | 71448/150000 [13:13:45<33:31:59,  1.54s/it]G: 6.54 | D: 0.00 | GP: 0.00 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▊                           | 71493/150000 [13:14:50<32:45:46,  1.50s/it]G: 4.55 | D: 0.08 | GP: 0.00 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▊                           | 71550/150000 [13:16:03<28:02:09,  1.29s/it]G: 2.79 | D: 0.00 | GP: 0.02 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▊                           | 71595/150000 [13:17:06<27:46:16,  1.28s/it]G: 4.29 | D: 0.00 | GP: 0.05 | SS: 0.01
default<E:\gan>:  48%|████████████████████████▊                           | 71634/150000 [13:18:09<30:59:41,  1.42s/it]

Google Colaboratory 無料版・シングルGPU設定

総計算時間

70時間程度?

ログ

計算が遅いため途中で中断した。終了時のログは以下のとおりである。

autosetting augmentation probability to 30%
default<./gan>:   0% 45/150000 [01:31<84:14:36,  2.02s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 50/150000 [01:40<83:21:02,  2.00s/it]G: 2.26 | D: 0.58 | GP: 0.01 | SS: 0.24
default<./gan>:   0% 90/150000 [02:53<80:20:14,  1.93s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 100/150000 [03:11<79:46:17,  1.92s/it]G: 2.29 | D: 0.27 | GP: 0.00 | SS: 0.20
default<./gan>:   0% 135/150000 [04:18<79:39:28,  1.91s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 150/150000 [04:46<79:26:34,  1.91s/it]G: 2.65 | D: 0.30 | GP: 0.03 | SS: 0.05
default<./gan>:   0% 180/150000 [05:41<78:50:39,  1.89s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 200/150000 [06:17<78:37:27,  1.89s/it]G: 4.33 | D: 0.00 | GP: 0.10 | SS: 0.04
default<./gan>:   0% 225/150000 [07:06<78:56:55,  1.90s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 250/150000 [07:52<78:40:42,  1.89s/it]G: 3.24 | D: 0.13 | GP: 0.39 | SS: 0.05

詳細のログは以下においた。

Google Colaboratory 無料版・マルチGPU設定

総計算時間

70時間程度?

ログ

計算が遅いため途中で中断した。終了時のログは以下のとおりである。

autosetting augmentation probability to 30%
default<./gan>:   0% 45/150000 [01:26<79:55:18,  1.92s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 50/150000 [01:35<79:30:54,  1.91s/it]G: 2.63 | D: 1.42 | GP: 0.00 | SS: 0.20
default<./gan>:   0% 90/150000 [02:49<78:18:51,  1.88s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 100/150000 [03:07<77:58:15,  1.87s/it]G: 3.81 | D: 0.14 | GP: 0.17 | SS: 0.06
default<./gan>:   0% 135/150000 [04:14<78:27:03,  1.88s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 150/150000 [04:42<78:23:52,  1.88s/it]G: 0.35 | D: 1.19 | GP: 0.01 | SS: 0.06
default<./gan>:   0% 180/150000 [05:37<77:57:40,  1.87s/it][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   0% 200/150000 [06:14<77:52:20,  1.87s/it]G: 2.77 | D: 0.98 | GP: 0.57 | SS: 0.04
default<./gan>:   0% 204/150000 [06:23<78:19:24,  1.88s/it]

詳細のログは以下においた。

Google Colaboratory Pro・シングルGPU設定

総計算時間

15時間56分38秒

ログ

途中で中断した。終了時のログは以下のとおりである。

default<./gan>:   7% 9800/150000 [1:02:29<14:54:01,  2.61it/s]G: 1.55 | D: 0.53 | GP: 0.03 | SS: 0.02
default<./gan>:   7% 9810/150000 [1:02:34<14:54:08,  2.61it/s][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   7% 9850/150000 [1:02:49<14:53:50,  2.61it/s]G: 1.02 | D: 0.37 | GP: 0.01 | SS: 0.03
default<./gan>:   7% 9855/150000 [1:02:51<14:53:46,  2.61it/s][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   7% 9900/150000 [1:03:07<14:53:23,  2.61it/s]G: 1.18 | D: 0.45 | GP: 0.07 | SS: 0.03
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   7% 9945/150000 [1:03:25<14:53:15,  2.61it/s][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   7% 9950/150000 [1:03:27<14:53:13,  2.61it/s]G: 1.69 | D: 0.31 | GP: 0.15 | SS: 0.02
default<./gan>:   7% 9990/150000 [1:03:42<14:52:52,  2.61it/s][W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
default<./gan>:   7% 10000/150000 [1:03:46<14:52:47,  2.61it/s]G: 1.66 | D: 0.26 | GP: 1.26 | SS: 0.03
default<./gan>:   7% 10008/150000 [1:03:50<14:53:03,  2.61it/s]

詳細のログは以下においた。

考察

速度について

ローカルが44時間程度、Google Colaboratory 無料版が70時間程度、Google Colabolatory Proが16時間程度であった。

Google Colabolatory 無料版の計算が一番遅いが、ローカルとは違い電気代がかからない。

家で計算を行う場合、1日に50円以上の電気代がかかっていた。

Google Colaboratory Proであっても、ひと月中計算を回す場合はお得である。

まとめ

  • Google Colabolatory 無料版は電気代がかからないため一番安くつくが遅い。
  • Google Colabolatory Proはローカルの3倍速く、安い。

次回

コロコロコミックを学習データとし、Google Colaboratoryを用いて、512×512の画像を生成。

他の回

「Lightweight GAN 連載記事」でタグ付けを行っている。

広告

PythonとAIの本。

広告