Skip to content

Instantly share code, notes, and snippets.

@desmondyeoh
Created July 27, 2020 05:19
Show Gist options
  • Save desmondyeoh/c293265615c15ab04e780a968b142130 to your computer and use it in GitHub Desktop.
Save desmondyeoh/c293265615c15ab04e780a968b142130 to your computer and use it in GitHub Desktop.
from multiprocessing import Pool
import tqdm
def pmap(func, iterable, n_proc=8):
with Pool(n_proc) as p:
li = list(tqdm.tqdm_notebook(p.imap(func, iterable), total=len(iterable)))
return li
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment