Created
May 16, 2019 11:57
-
-
Save DeastinY/4e81f85103daab472f0e507471dfd934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from multiprocessing import Pool, cpu_count | |
def my_func(i): | |
time.sleep(1) | |
return i | |
print(cpu_count()) | |
with Pool(cpu_count()) as pool: | |
results = pool.map(my_func, range(50)) | |
print(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment