I want to run a process in parallel using python3. The code I have is running one thing after the other one. Any ideas on how to make it parallel?
from multiprocessing import Process
def work(x, outfile):
for i in range(0,200000):
print(x, i,'hello world', outfile)
if __name__ == '__main__':
NUM_THREADS = 4
for x in range(NUM_THREADS):
try:
outfile = "tmp"+str(x)
p = Process(target=work, args =(x, outfile))
p.start()
p.join()
except:
raise
print("Error: unable to start thread", x)