File size: 749 Bytes
5120311 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import subprocess
from multiprocessing import Process
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
def run_consumer_clustering():
proc = subprocess.Popen("python consumer_clustering.py", shell=True)
print(proc.pid)
proc.communicate()
def run_consumer_merge_clustering():
proc = subprocess.Popen("python consumer_merge_clustering.py", shell=True)
print(proc.pid)
proc.communicate()
if __name__ == '__main__':
execs = []
n_pro = 5
for pro in [run_consumer_clustering ,run_consumer_merge_clustering]:
for i in range(n_pro):
ex = Process(target=pro, args=())
execs.append(ex)
ex.start()
for exe in execs:
exe.join()
|