caput.mpiutil

Utilities for making MPI usage transparent.

This module exposes much of the functionality of mpi4py but will still run in serial if mpi is not present on the system. It is thus useful for writing code that can be run in either parallel or serial. Also it exposes all attributes of the mpi4py.MPI by the SelfWrapper class for convenience (You can just use ‘mpiutil.attr’ instead of ‘from mpi4py import MPI; MPI.attr’).

Functions

active_comm(aprocs) Return a communicator consists of a list of processes in aprocs.
active(aprocs) Make a list of processes in aprocs active, while others wait.
close(aprocs) Send a message to the waiting processes to close their waiting.
partition_list(full_list, i, n[, method]) Partition a list into n pieces.
partition_list_mpi(full_list[, method, comm]) Return the partition of a list specific to the current MPI process.
mpilist(full_list[, method, comm]) Return the partition of a list specific to the current MPI process.
mpirange(*args, **kargs) An MPI aware version of range, each process gets its own sub section.
barrier([comm])
bcast(data[, root, comm])
parallel_map(func, glist[, root, method, comm]) Apply a parallel map using MPI.
typemap(dtype) Map a numpy dtype into an MPI_Datatype.
split_m(n, m) Split a range (0, n-1) into m sub-ranges of similar length
split_all(n[, comm]) Split a range (0, n-1) into sub-ranges for each MPI Process.
split_local(n[, comm]) Split a range (0, n-1) into sub-ranges for each MPI Process.
gather_local(global_array, local_array, ...) Gather data array in each process to the global array in root process.
transpose_blocks(row_array, shape[, comm]) Take a 2D matrix which is split between processes row-wise and split it column wise between processes.
allocate_hdf5_dataset(fname, dsetname, ...) Create a hdf5 dataset and return its offset and size.
lock_and_write_buffer(obj, fname, offset, size) Write the contents of a buffer to disk at a given offset, and explicitly lock the region of the file whilst doing so.
parallel_rows_write_hdf5(fname, dsetname, ...) Write out array (distributed across processes row wise) into a HDF5 in parallel.