Created
December 6, 2019 19:33
-
-
Save fanyix/9db420810c7391fc3bf18f146ddc7db1 to your computer and use it in GitHub Desktop.
Launching script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import os | |
import numpy as np | |
import time | |
# number of procs | |
file = 'download.py' | |
sleep_time = 5 | |
proc_N = 8 | |
# gpu_id = np.array([0,1,2,3,0,1,2,3,0,1,2,3]) | |
# assert proc_N == len(gpu_id) | |
# launch processes | |
for proc in range(0, proc_N): | |
my_env = os.environ.copy() | |
# my_env["CUDA_VISIBLE_DEVICES"] = '%g' % gpu_id[proc] | |
subprocess.Popen(['python', '%s' % file, '%d' % proc_N, '%d' % proc], env=my_env) | |
print('%g/%g process launched' % (proc, proc_N)) | |
time.sleep(sleep_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment