Created
May 24, 2017 12:40
-
-
Save vaclavcadek/4ec4bf18e07b7b4729a9094f982e2d74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 numpy as np | |
import multiprocessing | |
def do_calculation(i, **kwargs): | |
np.random.seed() | |
rand=np.random.randint(10) | |
print(i, kwargs['foo'], kwargs['bar'], rand) | |
if __name__ == '__main__': | |
jobs = [] | |
kwargs = dict(foo='bar', bar='foo') | |
for i in range(5): | |
p = multiprocessing.Process(target=do_calculation, args=(i, ), kwargs=kwargs) | |
jobs.append(p) | |
p.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment