Collective Communication

Located in file: MEL.hpp

void MEL::Bcast(void *ptr, const int num, const Datatype &datatype, const int root, const Comm &comm)

Broadcast an array to all processes in comm, where all processes know how many elements to expect.

See
MPI_Bcast
Parameters
  • ptr -

    Pointer to the memory receive into

  • num -

    The number of elements to broadcast

  • datatype -

    The derived datatype of the elements to broadcast

  • root -

    The rank of the process to send from

  • comm -

    The comm world to broadcast within

void MEL::Scatter(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int rnum, const Datatype &rdatatype, const int root, const Comm &comm)

Scatter an array to all processes in comm, where all processes know how many elements to expect.

See
MPI_Scatter
Parameters
  • sptr -

    Pointer to the memory to scatter, significant only on root

  • snum -

    The number of elements to scatter, significant only on root

  • sdatatype -

    The derived datatype of the elements to send, significant only on root

  • rptr -

    Pointer to the memory to receive into

  • rnum -

    The number of elements to receive

  • rdatatype -

    The derived datatype of the elements to receive

  • root -

    The rank of the process to send from

  • comm -

    The comm world to scatter within

void MEL::Scatterv(void *sptr, const int *snum, const int *displs, const Datatype &sdatatype, void *rptr, const int rnum, const Datatype &rdatatype, const int root, const Comm &comm)

Scatter an array to all processes in comm, where all processes have an independent number of elements to expect.

See
MPI_Scatterv
Parameters
  • sptr -

    Pointer to the memory to scatter, significant only on root

  • snum -

    Pointer to an array of number of elements to send to each process, significant only on root

  • displs -

    Pointer to an array of the element displacements of where each processes data is to be sent, significant only on root

  • sdatatype -

    The derived datatype of the elements to send, significant only on root

  • rptr -

    Pointer to the memory to receive into

  • rnum -

    The number of elements to receive

  • rdatatype -

    The derived datatype of the elements to receive

  • root -

    The rank of the process to send from

  • comm -

    The comm world to scatter within

void MEL::Gather(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int rnum, const Datatype &rdatatype, const int root, const Comm &comm)

Gather an array from all processes in comm.

See
MPI_Gather
Parameters
  • sptr -

    Pointer to the memory to gather

  • snum -

    The number of elements to gather

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to the memory to receive into, significant only on root

  • rnum -

    The number of elements to receive, significant only on root

  • rdatatype -

    The derived datatype of the elements to receive, significant only on root

  • root -

    The rank of the process to send to

  • comm -

    The comm world to gather within

void MEL::Gatherv(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int *rnum, const int *displs, const Datatype &rdatatype, const int root, const Comm &comm)

Gather an array from all processes in comm, where all processes have an independent number of elements to send.

See
MPI_Gatherv
Parameters
  • sptr -

    Pointer to the memory to gather

  • snum -

    The number of elements to gather

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to the memory to receive into, significant only on root

  • rnum -

    Pointer to an array of the number of elements to receive from each process, significant only on root

  • displs -

    Pointer to an array of the displacements of elements to be received from each process, significant only on root

  • rdatatype -

    The derived datatype of the elements to receive, significant only on root

  • root -

    The rank of the process to send to

  • comm -

    The comm world to gather within

void MEL::Allgather(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int rnum, const Datatype &rdatatype, const Comm &comm)

Gather an array from all processes in comm and distribute it to all processes.

See
MPI_Allgather
Parameters
  • sptr -

    Pointer to the memory to gather

  • snum -

    The number of elements to gather

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to the memory to receive into

  • rnum -

    The number of elements to receive

  • rdatatype -

    The derived datatype of the elements to receive

  • comm -

    The comm world to gather within

void MEL::Allgatherv(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int *rnum, const int *displ, const Datatype &rdatatype, const Comm &comm)

Gather an array from all processes in comm and distribute it to all processes, where all processes have an independent number of elements to send.

See
MPI_Allgatherv
Parameters
  • sptr -

    Pointer to the memory to gather

  • snum -

    The number of elements to gather

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to the memory to receive into

  • rnum -

    Pointer to an array of the number of elements to receive from each process

  • displ -

    Pointer to an array of the element displacements of where each processes data is to be received

  • rdatatype -

    The derived datatype of the elements to receive

  • comm -

    The comm world to gather within

void MEL::Alltoall(void *sptr, const int snum, const Datatype &sdatatype, void *rptr, const int rnum, const Datatype &rdatatype, const Comm &comm)

Broadcast from all processes to all processes.

See
MPI_Alltoall
Parameters
  • sptr -

    Pointer to snum elements to send

  • snum -

    The number of elements to send

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to rnum * commsize elements to receive

  • rnum -

    The number of elements to receive from each process in comm

  • rdatatype -

    The derived datatype of the elements to receive

  • comm -

    The comm world to broadcast within

void MEL::Alltoallv(void *sptr, const int *snum, const int *sdispl, const Datatype &sdatatype, void *rptr, const int *rnum, const int *rdispl, const Datatype &rdatatype, const Comm &comm)

Broadcast from all processes to all processes with independent number of elements for each process.

See
MPI_Alltoallv
Parameters
  • sptr -

    Pointer to snum elements to send

  • snum -

    Pointer to an array of the number of elements to send from each process

  • sdispl -

    Pointer to an array of element displacements of where each processes data is to be sent from

  • sdatatype -

    The derived datatype of the elements to send

  • rptr -

    Pointer to the receive buffer

  • rnum -

    Pointer to an array of the number of elements to receive from each process

  • rdispl -

    Pointer to an array of element displacements of where each processes data is to be recieved to

  • rdatatype -

    The derived datatype of the elements to receive

  • comm -

    The comm world to broadcast within

void MEL::Alltoallw(void *sptr, const int *snum, const int *sdispl, const Datatype *sdatatype, void *rptr, const int *rnum, const int *rdispl, const Datatype *rdatatype, const Comm &comm)

Broadcast from all processes to all processes with independent derived datatypes and number of elements for each process.

See
MPI_Alltoallw
Parameters
  • sptr -

    Pointer to snum elements to send

  • snum -

    Pointer to an array of the number of elements to send from each process

  • sdispl -

    Pointer to an array of element displacements of where each processes data is to be sent from

  • sdatatype -

    Pointer to an array of the derived datatypes of the elements to send for each process

  • rptr -

    Pointer to the receive buffer

  • rnum -

    Pointer to an array of the number of elements to receive from each process

  • rdispl -

    Pointer to an array of element displacements of where each processes data is to be recieved to

  • rdatatype -

    Pointer to an array of the derived datatypes of the elements to receive for each process

  • comm -

    The comm world to broadcast within

void MEL::Reduce(void *sptr, void *rptr, const int num, const Datatype &datatype, const Op &op, const int root, const Comm &comm)

Reduce an array of known length across all processes in comm using the given operation.

See
MPI_Reduce
Parameters
  • sptr -

    Pointer to num elements to send

  • rptr -

    Pointer to the receive buffer, significant only on root

  • num -

    The number of elements in the array

  • datatype -

    The derived datatype of the elements to reduce

  • op -

    The operation to perform for the reduction

  • root -

    The process to receive the result

  • comm -

    The comm world to reduce within

void MEL::Allreduce(void *sptr, void *rptr, const int num, const Datatype &datatype, const Op &op, const Comm &comm)

Reduce an array of known length across all processes in comm using the given operation, and distribute the result to all processes.

See
MPI_Allreduce
Parameters
  • sptr -

    Pointer to num elements to send

  • rptr -

    Pointer to the receive buffer

  • num -

    The number of elements in the array

  • datatype -

    The derived datatype of the elements to reduce

  • op -

    The operation to perform for the reduction

  • comm -

    The comm world to reduce within

template <typename T>
void MEL::Bcast(T *ptr, const int num, const int root, const Comm &comm)

Broadcast an array to all processes in comm, where all processes know how many elements to expect.

Parameters
  • ptr -

    Pointer to the memory receive into

  • num -

    The number of elements to broadcast

  • root -

    The rank of the process to send from

  • comm -

    The comm world to broadcast within