soupy.collectives

soupy.collectives.collective

class soupy.collectives.collective.MultipleSamePartitioningPDEsCollective(comm, is_serial_check=False)[source]

Bases: object

Parallel reduction utilities when several serial systems of PDEs (one per process) are solved concurrently.

Constructor: :param comm: MPI communicator :type comm : mpi4py.MPI.Comm

allReduce(v, op)[source]

Case handled: - v is a scalar (float, int); - v is a numpy array (NOTE: v will be overwritten) - v is a dolfin.Vector (NOTE: v will be overwritten) Operation: op = "Sum" or “Avg” (case insentive).

bcast(v, root=0)[source]

Case handled: - v is a scalar (float, int); - v is a numpy array (NOTE: v will be overwritten) - v is a dolfin.Vector (NOTE: v will be overwritten) - root refers to the process rank within the communicator for which the data to be broadcasted lives.

rank()[source]
size()[source]
soupy.collectives.collective.MultipleSerialPDEsCollective(comm)[source]
class soupy.collectives.collective.NullCollective[source]

Bases: object

No-overhead “Parallel” reduction utilities when a serial system of PDEs is solved on 1 process.

allReduce(v, op)[source]
bcast(v, root=0)[source]
rank()[source]
size()[source]

soupy.collectives.mpiUtils

soupy.collectives.mpiUtils.allgather_vector_as_numpy(v)[source]

All gather a dolfin vector v such that each process has a full copy of the numpy array representing v

Parameters:

v (dl.Vector) – Vector to gather

Returns:

A numpy vector v_np with the full data of v on every process

soupy.collectives.mpiUtils.allocate_process_sample_sizes(sample_size, comm_sampler)[source]

Compute the number of samples needed in each process Return result as a list

Parameters:
  • sample_size (int) – Total number of samples

  • comm_sampler (mpi4py.MPI.Comm) – MPI communicator for sample allocation

soupy.collectives.mpiUtils.get_global(v)[source]

Retrieves the global representation of v as a numpy array

soupy.collectives.mpiUtils.set_local_from_global(v, v_np)[source]

Set the local components of a dolfin vector v from a global numpy array v_np using its local range

Parameters:
  • v (dl.Vector) – Vector to set

  • v_np (np.ndarray) – numpy array for global entries