This is probably a trivial question, but how do I parallelize the following loop in python?
# setup output lists output1 = list() output2 = list() output3 =
thanks @iuryxavier
from multiprocessing import Pool from multiprocessing import cpu_count def add_1(x): return x + 1 if __name__ == "__main__": pool = Pool(cpu_count()) results = pool.map(add_1, range(10**12)) pool.close() # 'TERM' pool.join() # 'KILL'