Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-threading #2

Open
biomystery opened this issue Dec 22, 2017 · 1 comment
Open

multi-threading #2

biomystery opened this issue Dec 22, 2017 · 1 comment

Comments

@biomystery
Copy link
Contributor

No description provided.

@biomystery
Copy link
Contributor Author

https://stackoverflow.com/questions/22147166/parallel-excution-and-file-writing-on-python?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

#!/usr/bin/env python
from multiprocessing import Pool

def compute_cluster(c):
"""each cluster can be computed independently"""
... # compute a cluster here

if name=="main":
pool = Pool(10) # run 10 task at most in parallel
pool.map(compute_cluster, range(10))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant