npstreams.pmap¶
- npstreams.pmap(func, iterable, args=None, kwargs=None, processes=1, ntotal=None)¶
Parallel application of a function with keyword arguments.
- Parameters
func (callable) – Function to be applied to every element of iterable.
iterable (iterable) – Iterable of items to be mapped.
args (tuple or None, optional) – Positional arguments of function.
kwargs (dictionary or None, optional) – Keyword arguments of function.
processes (int or None, optional) – Number of processes to use. If None, maximal number of processes is used. Default is one.
ntotal (int or None, optional) – If the length of iterable is known, but passing iterable as a list would take too much memory, the total length ntotal can be specified. This allows for pmap to chunk better.
- Yields
Mapped values.
See also
pmap_unordered
parallel map that does not preserve order
Notes
If processes is 1, pmap reduces to map, with the added benefit of of using kwargs