libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
sc_allgather.h File Reference

Self-contained implementation of MPI_Allgather. More...

#include <sc.h>
Include dependency graph for sc_allgather.h:

Go to the source code of this file.

Macros

#define SC_ALLGATHER_ALLTOALL_MAX   5
 The largest group size that uses direct all-to-all.
 

Functions

void sc_allgather_alltoall (sc_MPI_Comm mpicomm, char *data, int datasize, int groupsize, int myoffset, int myrank)
 Allgather by direct point-to-point communication. More...
 
void sc_allgather_recursive (sc_MPI_Comm mpicomm, char *data, int datasize, int groupsize, int myoffset, int myrank)
 Perform recursive bisection allgather. More...
 
int sc_allgather (void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, void *recvbuf, int recvcount, sc_MPI_Datatype recvtype, sc_MPI_Comm mpicomm)
 Drop-in allgather replacement. More...
 

Detailed Description

Self-contained implementation of MPI_Allgather.

The algorithm uses a binary communication tree. The recursion terminates at a specified depth by an all-to-all step.

Function Documentation

◆ sc_allgather()

int sc_allgather ( void *  sendbuf,
int  sendcount,
sc_MPI_Datatype  sendtype,
void *  recvbuf,
int  recvcount,
sc_MPI_Datatype  recvtype,
sc_MPI_Comm  mpicomm 
)

Drop-in allgather replacement.

Parameters
[in]sendbufSend buffer conforming to MPI specification.
[in]sendcountNumber of data items to send.
[in]sendtypeValid MPI Datatype.
[out]recvbufReceive buffer conforming to MPI specification.
[in]recvcountNumber of data items to receive.
[in]recvtypeValid MPI Datatype.
[in]mpicommValid MPI communicator.
Returns
int sc_MPI_SUCCESS if not aborting on MPI error.

◆ sc_allgather_alltoall()

void sc_allgather_alltoall ( sc_MPI_Comm  mpicomm,
char *  data,
int  datasize,
int  groupsize,
int  myoffset,
int  myrank 
)

Allgather by direct point-to-point communication.

This function is only efficient for small group sizes.

Parameters
[in]mpicommValid MPI communicator.
[in,out]dataSend and receive buffer for a subgroup of the communicator.
[in]datasizeNumber of bytes to send.
[in]groupsizeNumber of processes in the subgroup.
[in]myoffsetOffset of the subgroup in the communicator.
[in]myrankMPI rank in the communicator.

◆ sc_allgather_recursive()

void sc_allgather_recursive ( sc_MPI_Comm  mpicomm,
char *  data,
int  datasize,
int  groupsize,
int  myoffset,
int  myrank 
)

Perform recursive bisection allgather.

When size becomes less equal SC_ALLGATHER_ALLTOALL_MAX, call sc_allgather_alltoall.

Parameters
[in]mpicommValid MPI communicator.
[in,out]dataSend and receive buffer for a subgroup of the communicator.
[in]datasizeNumber of bytes to send.
[in]groupsizeNumber of processes in the subgroup.
[in]myoffsetOffset of the subgroup in the communicator.
[in]myrankMPI rank in the communicator.