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 3 years have passed since last update.

Unity ML-Agents で実行条件を変えて学習時間を比較してみた

Last updated at Posted at 2020-09-22

CPU/GPU、UnityEditor/ビルド、ビルドの複数実行、Agentの複数実行と、
実行条件を変えて学習時間を比較してみました。
プログラムはRollerBallを参考につくっていて、こちらに挙げてあります。

環境

  • Windows10
  • Python 3.7.9
  • TensorFlow 2.3.0
  • Unity 2019.4.10f1
  • ML-Agents Release6

学習の高速化

  • GPU で計算する(判断基準は下に記載)
  • ビルドした exe で学習させる
    • --env
  • --no-graphics オプション : 画面表示なし
  • 複数同時起動、CPUのマルチコア(スレッド)が最大
    • --num-envs
  • Agent を複製して実行する

Behavior ParameterのInterface DeviceにGPUを設定する判断基準

単純な推論であればCPUのほうが早い。GPUを選択する基準は以下の通り。

  1. Visual Observation
  2. エージェント数 * Observation > 1024
  3. エージェント数 * 隠れ層の数 > 1024

学習時間の計測結果

手法 学習時間(秒) CPU使用率 補足
UnityEditor 68 25 CPU
GPU 71 25 Behavior Parameter に GPU を設定、※1
ビルド 86 13 ※2
複数同時起動 55 35 --num-envs=4
Agent 複製 21 25 複製4つ、UnityEditor

※1 それぞれ1回の測定なので、数秒は誤差の範囲
※2 ビルド版が UnityEditor より遅くなっているのは、Python とビルドアプリがCPUを食い合っているためだと思われる

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?