SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import multiprocessing as mp
  2.  
  3.  
  4. def f(huge_amount):
  5.     count = 0
  6.     for i in range(huge_amount):
  7.         if i % 2:
  8.             count += 1
  9.         else:
  10.             count -= 1
  11.  
  12.  
  13. if __name__ == '__main__':
  14.     huge_amount = 100000000000
  15.     cpus = mp.cpu_count()
  16.     list_amount = [huge_amount] * cpus
  17.     with mp.Pool(cpus) as p:
  18.         p.map(f, list_amount)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top