Container manager
Project description
Container Manager
DNNツール等を用いた実験の環境構築〜モデル学習をサポートするツールです.
Requirement
- nvidia-driver
- docker
- docker-py
- nvidia-docker
Install
以下のコマンドでcoctlコマンドがインストールされます.
pip install container_manager
GetStart
exampleディレクトリに最も簡単なサンプルがあります.
exampleディレクトリのある場所でcoctlコマンドを使うことでタスクを実行することができます.
run
runコマンドでディレクトリを指定しタスクを作成,実行することができます.
$ coctl run example
上記のコマンドでpytorch1.4がインストールされた環境でタスク名/main.pyが実行されます(例ではexample/main.py).
指定したディレクトリ名のタスクが作成されます.
coctlコマンドは実行したいタスクのディレクトリのある場所で実行してください.
$ coctl run xxx/exampleや$ coctl run ../exampleのような指定はできないことに注意してください.
個別に必要なライブラリ等がある場合はexample/Dockerfileに記載されているように適宜必要なライブラリを追加してください.
main.pyが実行される環境は起動時に毎回新規に環境が作られるため,必ずDockerfileにpip installなどを記載し,指定するディレクトリの中に配置してください.
runの実行後はmain.pyのログが表示されます.Ctr-C などでログの表示を止めることができますが,タスクのプロセス自体は終了しません.
現在走っているタスクを止めるには下記のrmコマンドでタスクを削除するか,同名のタスクをrunすることで削除した後新しいタスクが作成されます.
実行時引数
実行したいタスクのmain.pyが実行時引数を必要とする場合には-oオプションで引数を渡すことができます.
$ coctl run example -o args1:hoge args2:baa arg3
とした場合
$ main.py --args1=hoge --args2=baa --arg3
のように解釈されます.
タスクの入出力
学習データなどの入力データはtraining_input/タスク名以下に配置してください.
出力データはtraining_output/タスク名に出力されます.
タスクの実行される環境ではtraining_input/タスク名は/inputに,training_output/タスク名は/outputとして認識されるのでタスクのmain.pyでは/input以下からデータを読み込み,/outputへデータを書き込みようにしてください.
list
listコマンドで実行中及び完了済みのタスクが表示できます.
$ coctl list
task_name | status
example | running
test | exited
上記の例ではタスク名testが完了済み,exampleが実行中であることを示します.
logs
実行中のタスクのログを確認するにはlistコマンドを利用します.
$ coctl logs example
arg3=default arg
main is run!!!
count 0
count 1
count 2
count 3
-fオプションをつけるとログをストリームで監視します.
rm
rmコマンドでタスクの削除を行うことができます.
$ coctl rm example
Task example is deleted
clean
タスクの生成を繰り返すと不要なデータが蓄積することがあります.
ディスク容量が圧迫される場合はcleanコマンドで不要なデータを削除してください.
$ coctl clean
GCPで学習を行う場合の例
以下のコマンドでGPUを持つインスタンスを確保します.
gcloud beta compute \
--accelerator=type=nvidia-tesla-v100,count=1 \
--image-project=ml-images \
--boot-disk-size=50GB \
--zone=us-central1-a \
--machine-type=n1-standard-1 \
--subnet=default \
--network-tier=PREMIUM \
--maintenance-policy=TERMINATE \
--service-account=770963190637-compute@developer.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/trace.append,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/devstorage.read_write \
--image=c3-deeplearning-tf-ent-2-1-cu100-20200131 \
--boot-disk-type=pd-standard \
--boot-disk-device-name=gpu-test \
--reservation-affinity=any
gpt-testがインスタンス名なので適宜修正してください.
acceleratorをnvidia-tesla-k80にしたり,countを増やしたりすることができます.
また,boot-disk-sizeを変えることでディスク容量が変えられます.
インスタンスの作成が完了し,サーバが起動すると以下のコマンドでログインできます.
gcloud compute ssh インスタcoンス名
*ログイン時にnvidiaドライバのインストールを行うか聞かれるのでyを選択してください.
ContainerManagerの手順に従い,coctlをインストールします.
上記の手順で作成したインスタンスはContainerManagerのrequirementを満たしているのでそのままpip installが可能です.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file container_manager-0.1.0.tar.gz.
File metadata
- Download URL: container_manager-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d78f67b972db0a0f9a8455eb7544090c6b28e8afb33d47f86fb7d281f598277
|
|
| MD5 |
4b79293ac9da667ac58a326bce4b5a01
|
|
| BLAKE2b-256 |
5e9d14d90e96d0fe5ec5f665e6ef8a5cc116288e7566c6e75df8d1db97cb3004
|
File details
Details for the file container_manager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: container_manager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
802ce0703bb126b94f12d9db0d1271d114f2bd0f43412f3ebf5b97b69ed6ae04
|
|
| MD5 |
cf0c26a4dc4714edb8049659074f6c38
|
|
| BLAKE2b-256 |
48beb9314cdb10c6f7f19d0c1c8fe6e59af8f4d578464528d14cd8d3cd30d7f5
|