(git:9ccafda)
Loading...
Searching...
No Matches
cp_mpi.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef int cp_mpi_comm_t

Functions

void cp_mpi_init (int *argc, char ***argv)
 Initialize MPI with MPI_THREAD_MULTIPLE or attach to an active MPI.
void cp_mpi_finalize (void)
 Detach from MPI and finalize it only if cp_mpi_init initialized it.
cp_mpi_comm_t cp_mpi_get_comm_world (void)
 Returns MPI_COMM_WORLD.
cp_mpi_comm_t cp_mpi_comm_f2c (const int fortran_comm)
 Wrapper around MPI_Comm_f2c.
int cp_mpi_comm_c2f (const cp_mpi_comm_t comm)
 Wrapper around MPI_Comm_c2f.
int cp_mpi_comm_rank (const cp_mpi_comm_t comm)
 Wrapper around MPI_Comm_rank.
int cp_mpi_comm_size (const cp_mpi_comm_t comm)
 Wrapper around MPI_Comm_size.
void cp_mpi_barrier (const cp_mpi_comm_t comm)
 Wrapper around MPI_Barrier; a null communicator is a no-op.
void cp_mpi_dims_create (const int nnodes, const int ndims, int dims[])
 Wrapper around MPI_Dims_create.
cp_mpi_comm_t cp_mpi_cart_create (const cp_mpi_comm_t comm_old, const int ndims, const int dims[], const int periods[], const int reorder)
 Wrapper around MPI_Cart_create.
void cp_mpi_cart_get (const cp_mpi_comm_t comm, int maxdims, int dims[], int periods[], int coords[])
 Wrapper around MPI_Cart_get.
int cp_mpi_cart_rank (const cp_mpi_comm_t comm, const int coords[])
 Wrapper around MPI_Cart_rank.
cp_mpi_comm_t cp_mpi_cart_sub (const cp_mpi_comm_t comm, const int remain_dims[])
 Wrapper around MPI_Cart_sub.
void cp_mpi_comm_free (cp_mpi_comm_t *comm)
 Wrapper around MPI_Comm_free.
bool cp_mpi_comms_are_similar (const cp_mpi_comm_t comm1, const cp_mpi_comm_t comm2)
 Wrapper around MPI_Comm_compare.
void cp_mpi_max_int (int *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_INT.
void cp_mpi_max_uint64 (uint64_t *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_UINT64_T.
void cp_mpi_max_double (double *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_DOUBLE.
void cp_mpi_sum_int (int *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_INT.
void cp_mpi_sum_long (long *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_LONG.
void cp_mpi_sum_int64 (int64_t *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_INT64_T.
void cp_mpi_sum_double (double *values, const int count, const cp_mpi_comm_t comm)
 Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_DOUBLE.
int cp_mpi_sendrecv_byte (const void *sendbuf, const int sendcount, const int dest, const int sendtag, void *recvbuf, const int recvcount, const int source, const int recvtag, const cp_mpi_comm_t comm)
 Wrapper around MPI_Sendrecv for datatype MPI_BYTE.
int cp_mpi_sendrecv_double (const double *sendbuf, const int sendcount, const int dest, const int sendtag, double *recvbuf, const int recvcount, const int source, const int recvtag, const cp_mpi_comm_t comm)
 Wrapper around MPI_Sendrecv for datatype MPI_DOUBLE.
void cp_mpi_alltoall_int (const int *sendbuf, const int sendcount, int *recvbuf, const int recvcount, const cp_mpi_comm_t comm)
 Wrapper around MPI_Alltoall for datatype MPI_INT.
void cp_mpi_alltoallv_byte (const void *sendbuf, const int *sendcounts, const int *sdispls, void *recvbuf, const int *recvcounts, const int *rdispls, const cp_mpi_comm_t comm)
 Wrapper around MPI_Alltoallv for datatype MPI_BYTE.
void cp_mpi_alltoallv_double (const double *sendbuf, const int *sendcounts, const int *sdispls, double *recvbuf, const int *recvcounts, const int *rdispls, const cp_mpi_comm_t comm)
 Wrapper around MPI_Alltoallv for datatype MPI_DOUBLE.
void * cp_mpi_alloc_mem (size_t size)
 Wrapper around MPI_Alloc_mem.
void cp_mpi_free_mem (void *ptr)
 Wrapper around MPI_Free_mem.

Typedef Documentation

◆ cp_mpi_comm_t

typedef int cp_mpi_comm_t

Definition at line 18 of file cp_mpi.h.

Function Documentation

◆ cp_mpi_init()

void cp_mpi_init ( int * argc,
char *** argv )

Initialize MPI with MPI_THREAD_MULTIPLE or attach to an active MPI.

Must be called outside OpenMP parallel regions and paired with cp_mpi_finalize.

Author
Ole Schuett
Ole Schuett

Definition at line 78 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_finalize()

void cp_mpi_finalize ( void )

Detach from MPI and finalize it only if cp_mpi_init initialized it.

Must be called outside OpenMP parallel regions.

Author
Ole Schuett
Ole Schuett

Definition at line 112 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_get_comm_world()

cp_mpi_comm_t cp_mpi_get_comm_world ( void )

Returns MPI_COMM_WORLD.

Author
Ole Schuett

Definition at line 138 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comm_f2c()

cp_mpi_comm_t cp_mpi_comm_f2c ( const int fortran_comm)

Wrapper around MPI_Comm_f2c.

Author
Ole Schuett

Definition at line 150 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comm_c2f()

int cp_mpi_comm_c2f ( const cp_mpi_comm_t comm)

Wrapper around MPI_Comm_c2f.

Author
Ole Schuett

Definition at line 164 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comm_rank()

int cp_mpi_comm_rank ( const cp_mpi_comm_t comm)

Wrapper around MPI_Comm_rank.

Author
Ole Schuett

Definition at line 177 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comm_size()

int cp_mpi_comm_size ( const cp_mpi_comm_t comm)

Wrapper around MPI_Comm_size.

Author
Ole Schuett

Definition at line 194 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_barrier()

void cp_mpi_barrier ( const cp_mpi_comm_t comm)

Wrapper around MPI_Barrier; a null communicator is a no-op.

Definition at line 210 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_dims_create()

void cp_mpi_dims_create ( const int nnodes,
const int ndims,
int dims[] )

Wrapper around MPI_Dims_create.

Author
Ole Schuett

Definition at line 224 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_cart_create()

cp_mpi_comm_t cp_mpi_cart_create ( const cp_mpi_comm_t comm_old,
const int ndims,
const int dims[],
const int periods[],
const int reorder )

Wrapper around MPI_Cart_create.

Author
Ole Schuett

Definition at line 239 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_cart_get()

void cp_mpi_cart_get ( const cp_mpi_comm_t comm,
int maxdims,
int dims[],
int periods[],
int coords[] )

Wrapper around MPI_Cart_get.

Author
Ole Schuett

Definition at line 261 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_cart_rank()

int cp_mpi_cart_rank ( const cp_mpi_comm_t comm,
const int coords[] )

Wrapper around MPI_Cart_rank.

Author
Ole Schuett

Definition at line 279 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_cart_sub()

cp_mpi_comm_t cp_mpi_cart_sub ( const cp_mpi_comm_t comm,
const int remain_dims[] )

Wrapper around MPI_Cart_sub.

Author
Ole Schuett

Definition at line 295 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comm_free()

void cp_mpi_comm_free ( cp_mpi_comm_t * comm)

Wrapper around MPI_Comm_free.

Author
Ole Schuett

Definition at line 313 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_comms_are_similar()

bool cp_mpi_comms_are_similar ( const cp_mpi_comm_t comm1,
const cp_mpi_comm_t comm2 )

Wrapper around MPI_Comm_compare.

Author
Ole Schuett

Definition at line 326 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_max_int()

void cp_mpi_max_int ( int * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_INT.

Author
Ole Schuett

Definition at line 343 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_max_uint64()

void cp_mpi_max_uint64 ( uint64_t * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_UINT64_T.

Author
Hans Pabst
Ole Schuett

Definition at line 366 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_max_double()

void cp_mpi_max_double ( double * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_MAX and datatype MPI_DOUBLE.

Author
Ole Schuett

Definition at line 390 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_sum_int()

void cp_mpi_sum_int ( int * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_INT.

Author
Ole Schuett

Definition at line 414 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_sum_long()

void cp_mpi_sum_long ( long * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_LONG.

Author
Hans Pabst

Definition at line 437 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_sum_int64()

void cp_mpi_sum_int64 ( int64_t * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_INT64_T.

Author
Ole Schuett

Definition at line 460 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_sum_double()

void cp_mpi_sum_double ( double * values,
const int count,
const cp_mpi_comm_t comm )

Wrapper around MPI_Allreduce for op MPI_SUM and datatype MPI_DOUBLE.

Author
Ole Schuett

Definition at line 484 of file cp_mpi.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_mpi_sendrecv_byte()

int cp_mpi_sendrecv_byte ( const void * sendbuf,
const int sendcount,
const int dest,
const int sendtag,
void * recvbuf,
const int recvcount,
const int source,
const int recvtag,
const cp_mpi_comm_t comm )

Wrapper around MPI_Sendrecv for datatype MPI_BYTE.

Author
Ole Schuett

Definition at line 508 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_sendrecv_double()

int cp_mpi_sendrecv_double ( const double * sendbuf,
const int sendcount,
const int dest,
const int sendtag,
double * recvbuf,
const int recvcount,
const int source,
const int recvtag,
const cp_mpi_comm_t comm )

Wrapper around MPI_Sendrecv for datatype MPI_DOUBLE.

Author
Ole Schuett

Definition at line 538 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_alltoall_int()

void cp_mpi_alltoall_int ( const int * sendbuf,
const int sendcount,
int * recvbuf,
const int recvcount,
const cp_mpi_comm_t comm )

Wrapper around MPI_Alltoall for datatype MPI_INT.

Author
Ole Schuett

Definition at line 568 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_alltoallv_byte()

void cp_mpi_alltoallv_byte ( const void * sendbuf,
const int * sendcounts,
const int * sdispls,
void * recvbuf,
const int * recvcounts,
const int * rdispls,
const cp_mpi_comm_t comm )

Wrapper around MPI_Alltoallv for datatype MPI_BYTE.

Author
Ole Schuett

Definition at line 584 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_alltoallv_double()

void cp_mpi_alltoallv_double ( const double * sendbuf,
const int * sendcounts,
const int * sdispls,
double * recvbuf,
const int * recvcounts,
const int * rdispls,
const cp_mpi_comm_t comm )

Wrapper around MPI_Alltoallv for datatype MPI_DOUBLE.

Author
Ole Schuett

Definition at line 603 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_alloc_mem()

void * cp_mpi_alloc_mem ( size_t size)

Wrapper around MPI_Alloc_mem.

Author
Hans Pabst

Definition at line 622 of file cp_mpi.c.

Here is the caller graph for this function:

◆ cp_mpi_free_mem()

void cp_mpi_free_mem ( void * mem)

Wrapper around MPI_Free_mem.

Author
Hans Pabst

Definition at line 638 of file cp_mpi.c.

Here is the caller graph for this function: