Welcome to parmap’s documentation!¶
- parmap.map(function, iterable, *args, **kwargs)[source]¶
- This function is equivalent to:
>>> [function(x, args[0], args[1],...) for x in iterable]
- Parameters:
pm_parallel (bool) – Force parallelization on/off
pm_chunksize (int) – see
multiprocessing.pool.Pool
pm_pool (multiprocessing.pool.Pool) – Pass an existing pool
pm_processes (int) – Number of processes to use in the pool. See
multiprocessing.pool.Pool
pm_pbar (bool, dict or callable) –
Show progress bar with optional information.
If it is a boolean, whether to show or not the progress bar.
If it is a dictionary, these are options passed to tqdm.tqdm().
If it is a callable, the callable is a function compatible with tqdm.tqdm(). If you want to pass additional options to your callable, consider using
functools.partial()
:from functools import partial from tqdm_loggable.auto import tqdm parmap.map(print, range(10), pm_pbar = partial(tqdm, desc = "example"))
- parmap.map_async(function, iterable, *args, **kwargs)[source]¶
This function is the multiprocessing.Pool.map_async version that supports multiple arguments.
>>> [function(x, args[0], args[1],...) for x in iterable]
- Parameters:
pm_parallel (bool) – Force parallelization on/off. If False, the function won’t be asynchronous.
pm_chunksize (int) – see
multiprocessing.pool.Pool
pm_callback (function) – see
multiprocessing.pool.Pool
pm_error_callback (function) – (not on python 2) see
multiprocessing.pool.Pool
pm_pool (multiprocessing.pool.Pool) – Pass an existing pool.
pm_processes (int) – Number of processes to use in the pool. See
multiprocessing.pool.Pool
- parmap.starmap(function, iterables, *args, **kwargs)[source]¶
- Equivalent to:
>>> return ([function(x1,x2,x3,..., args[0], args[1],...) for >>> (x1,x2,x3...) in iterable])
- Parameters:
pm_parallel (bool) – Force parallelization on/off
pm_chunksize (int) – see
multiprocessing.pool.Pool
pm_pool (multiprocessing.pool.Pool) – Pass an existing pool
pm_processes (int) – Number of processes to use in the pool. See
multiprocessing.pool.Pool
pm_pbar (bool, dict or callable) –
Show progress bar with optional information.
If it is a boolean, whether to show or not the progress bar.
If it is a dictionary, these are options passed to tqdm.tqdm().
If it is a callable, the callable is a function compatible with tqdm.tqdm(). If you want to pass additional options to your callable, consider using
functools.partial()
:from functools import partial from tqdm_loggable.auto import tqdm parmap.map(print, range(10), pm_pbar = partial(tqdm, desc = "example"))
- parmap.starmap_async(function, iterables, *args, **kwargs)[source]¶
This function is the multiprocessing.Pool.starmap_async version that supports multiple arguments.
>>> return ([function(x1,x2,x3,..., args[0], args[1],...) for >>> (x1,x2,x3...) in iterable])
- Parameters:
pm_parallel (bool) – Force parallelization on/off. If False, the function won’t be asynchronous.
pm_chunksize (int) – see
multiprocessing.pool.Pool
pm_callback (function) – see
multiprocessing.pool.Pool
pm_error_callback (function) – see
multiprocessing.pool.Pool
pm_pool (multiprocessing.pool.Pool) – Pass an existing pool.
pm_processes (int) – Number of processes to use in the pool. See
multiprocessing.pool.Pool