Skip to content

Instantly share code, notes, and snippets.

@pollenjp
Last active May 9, 2019 10:19
Show Gist options
  • Save pollenjp/13db217e8360228b003a1c11c34172c0 to your computer and use it in GitHub Desktop.
Save pollenjp/13db217e8360228b003a1c11c34172c0 to your computer and use it in GitHub Desktop.
別々の対象に対して同じスクリプトを実行したいが各実行で空いているGPUをそれぞれ割り当てていき全てのGPUを使っているときは待ち(wait)に入り空きができたら空いた箇所のGPUを割り当てる
#!/bin/bash -eux
# 別々の対象に対して同じスクリプトを実行したいが各実行で空いているGPUをそれぞれ割り当てていき全てのGPUを使っているときは
# 待ち(wait)に入り空きができたら空いた箇所のGPUを割り当てる
@pollenjp
Copy link
Author

pollenjp commented May 9, 2019

pythonで os.system() を使ってshellコマンドを呼び出してそれをmulti-thread処理してやるのが良さそう

import os
os.system("ls -la")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment