Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import multiprocessing as mp
- def run(cmd):
- with open(cmd[-1], 'w') as f:
- return subprocess.run(cmd[:-1], stdout=f)
- numbers = []
- i = 100000000
- for _ in range(10):
- numbers.append(i)
- i //= 2
- commands = [['./a.out', str(x), str(x) + '.txt'] for x in numbers]
- nproc = 2
- pool = mp.Pool(nproc)
- pool.map(run, commands)
Add Comment
Please, Sign In to add comment