Parallel execution

unified_map.multivariate.parallel.dask(function, argument_list, num_cores=None)

Apply a multivariate function to a list of arguments in a parallel fashion.

Uses Dask’s delayed() function to build a task graph and compute() function to calculate results.

Parameters:
  • function – A callable object that accepts more than one argument
  • argument_list – An iterable object of input argument collections
  • num_cores (optional) – Number of cores to use for calculation.
Returns:

List of output results

Example

>>> def add(x, y, z):
...     return x+y+z
...
>>> dask(add, [(1, 2, 3), (10, 20, 30)])
[6, 60]

References

unified_map.multivariate.parallel.futures(function, argument_list, num_cores=None)

Apply a multivariate function to a list of arguments in a parallel fashion.

Uses Python’s built-in futures with a process pool executor.

Parameters:
  • function – A callable object that accepts more than one argument
  • argument_list – An iterable object of input argument collections
  • num_cores (optional) – Number of cores to use for calculation.
Returns:

List of output results

Example

>>> def add(x, y, z):
...     return x+y+z
...
>>> futures(add, [(1, 2, 3), (10, 20, 30)])
[6, 60]

References

unified_map.multivariate.parallel.joblib(function, argument_list, num_cores=None)

Apply a multivariate function to a list of arguments in a parallel fashion.

Uses Joblib’s delayed() function with a parallel executor that starts multiple processes.

Parameters:
  • function – A callable object that accepts more than one argument
  • argument_list – An iterable object of input argument collections
  • num_cores (optional) – Number of cores to use for calculation.
Returns:

List of output results

Example

>>> def add(x, y, z):
...     return x+y+z
...
>>> joblib(add, [(1, 2, 3), (10, 20, 30)])
[6, 60]

References

unified_map.multivariate.parallel.multiprocessing(function, argument_list, num_cores=None)

Apply a multivariate function to a list of arguments in a parallel fashion.

Uses the parallel map() function with a pool of processes from multiprocessing in Python’s standard library.

Parameters:
  • function – A callable object that accepts more than one argument
  • argument_list – An iterable object of input argument collections
  • num_cores (optional) – Number of cores to use for calculation.
Returns:

List of output results

Example

>>> def add(x, y, z):
...     return x+y+z
...
>>> multiprocessing(add, [(1, 2, 3), (10, 20, 30)])
[6, 60]

References