npstreams.pmap_unordered

npstreams.pmap_unordered(func, iterable, args=None, kwargs=None, processes=1, ntotal=None)

Parallel application of a function with keyword arguments in no particular order. This can reduce memory usage because results are not accumulated so that the order is preserved.

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()
parallel map that preserves order

Notes

If processes is 1, pmap_unordered reduces to map, with the added benefit of of using kwargs