mantidimaging.core.parallel.shared module

mantidimaging.core.parallel.shared.create_partial(func, fwd_function, **kwargs)[source]

Create a partial using functools.partial, to forward the kwargs to the parallel execution of imap.

If you seem to be getting nans, check if the correct fwd_function is set!

  • func – Function that will be executed

  • fwd_function – The function will be forwarded through function.

  • kwargs – kwargs to forward to the function func that will be executed


The decorated forwarded function, ready for further execution

mantidimaging.core.parallel.shared.execute(partial_func: partial, arrays: List[SharedArray], num_operations: int, progress=None, msg: str = '') None[source]

Executes a function a given number of times using the provided list of SharedArray objects.

If all the arrays in the list use shared memory then the execution is done in parallel, with each process accessing the data in shared memory. If any arrays in the list do not use shared memory then the execution will be performed synchronously.

  • partial_func – A function constructed using create_partial

  • arrays – The list of SharedArray objects that the operations should be performed on

  • num_operations – The expected number of operations - should match the number of images being processed Also used to set the number of progress steps

  • progress – Progress instance to use for progress reporting (optional)

  • msg – Message to be shown on the progress bar


mantidimaging.core.parallel.shared.inplace1(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.inplace2(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.inplace3(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.inplace_second_2d(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.return_to_second_at_i(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.return_to_self(func, data: List[SharedArray] | List[SharedArrayProxy], i, **kwargs)[source]
mantidimaging.core.parallel.shared.run_compute_func(func: Callable[[int, List[ndarray], Dict[str, Any]], None] | Callable[[int, ndarray, Dict[str, Any]], None], num_operations: int, arrays: List[SharedArray] | SharedArray, params: Dict[str, Any], progress=None)[source]