mpiutils¶
MPI utility class function.
- class shift.mpiutils.MPI[source]¶
-
- set_loop(loop_size)[source]¶
Sets the size of a distributed loop.
- Parameters:
loop_size (int)
- Yields:
Size of the MPI_loop.
- mpi_ind2ind(mpi_ind)[source]¶
Converts the MPI_ind of a distributed loop to the index of a full loop.
- Parameters:
mpi_ind (int)
- Yields:
Index of a full loop.
- split(length, size=None)[source]¶
For splitting an array across nodes.
- Parameters:
- Returns:
split1 (array_like) – The indices of the first element of the split array.
split2 (array_like) – The indices of the last element of the split array.
- split_array(array)[source]¶
Returns the values of the split array.
- Parameters:
array (array_like) – Array to be split.
- Yields:
Split array.
- check_partition(NDshape, NDshape_split)[source]¶
Returns a boolean array showing the axes that an array will be split along.
- mpi_print(*value)[source]¶
Python print function using flush=True so print statements are outputed immediately in an MPI setting.
- send(data, to_rank=None, tag=11)[source]¶
Sends data from current core to other specified or all cores.
- collect(data, outlist=False)[source]¶
Collects a distributed data to the processor with rank=0.
- Parameters:
data (array) – Distributed data set.
outlist (bool, optional) – If outlist is False, we collect and concatenate, if True then we do not concatenate the list.
- collect_noNone(data)[source]¶
Same as collect function, but removes data=None to the combined data set. :param data: Distributed data set. :type data: array
- distribute(data)[source]¶
Distribute and split data from rank 0.
- Parameters:
data (array) – Full data set which will be split across the cores.
- sum(data)[source]¶
Sums a distributed data set to the processor with rank=0.
- Parameters:
data (array) – distributed data set.
- mean(data)[source]¶
Finds the mean of a distributed data set, which is broadcasted to all nodes.
- Parameters:
data (array) – distributed data set.
- min(data)[source]¶
Finds the minimum of a distributed data set, which is broadcasted to all nodes.
- Parameters:
data (array) – distributed data set.