pynbody.array.shared.remote_map#
- pynbody.array.shared.remote_map(pool, fn, *iterables)[source]#
Equivalent to pool.map, but turns any shared memory arrays into a reference that can be passed between processes.
The function fn must be wrapped with the
shared_array_remote()decorator for this to work correctly.- Parameters:
pool (multiprocessing.Pool) – The pool to use for parallel processing
fn (function) – The function to apply to each element of the iterable. This function must be wrapped with
shared_array_remote()to use shared arrays.*iterables (iterable) – The iterables to pass to the function. If more than one iterable is passed, the function is called with arguments from each iterable in turn.
- Returns:
The results of applying the function to each element of the iterable. If the function returns shared arrays, these are transferred back to the parent process and returned fully reconstructed.
- Return type:
list