pyuoi.mpi_utils
Helper functions for loading data and managing arrays across ranks with MPI.
- pyuoi.mpi_utils.Bcast_from_root(send, comm=None, root=0)[source]
Broadcast an array from root to all MPI ranks.
- pyuoi.mpi_utils.Gatherv_rows(send, comm=None, root=0)[source]
Concatenate arrays along the first axis using Gatherv on root.
- pyuoi.mpi_utils.check_valid_ndarray(X)[source]
Checks whether X is a ndarray and returns a contiguous version.
- Parameters
X (ndarray, None, or other) – Variable to check
- Returns
X – If X is an ndarray, returns a contiguous potential copy. If X is None returns None. If X is anything else, raises a ValueError
- Return type
ndarray or None
- pyuoi.mpi_utils.load_data_MPI(h5_name, X_key='X', y_key='y', comm=None, root=0)[source]
Load data from an HDF5 file and broadcast it across MPI ranks.
This is a helper function. It is also possible to load the data without this function.
- Parameters
- Returns
X (ndarray) – Features on all MPI ranks.
y (ndarray) – Targets on all MPI ranks.