CoMD
A Mini-app for Co-Design of Classical Molecular Dynamics.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
parallel.h File Reference

Wrappers for MPI functions. More...

#include "mytype.h"
Include dependency graph for parallel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RankReduceDataSt
 Structure for use with MPI_MINLOC and MPI_MAXLOC operations. More...
 

Typedefs

typedef struct RankReduceDataSt RankReduceData
 Structure for use with MPI_MINLOC and MPI_MAXLOC operations. More...
 

Functions

int getNRanks (void)
 Return total number of processors. More...
 
int getMyRank (void)
 Return local rank. More...
 
int printRank (void)
 Return non-zero if printing occurs from this rank. More...
 
void timestampBarrier (const char *msg)
 Print a timestamp and message when all tasks arrive. More...
 
void initParallel (int *argc, char ***argv)
 Wrapper for MPI_Init. More...
 
void destroyParallel (void)
 Wrapper for MPI_Finalize. More...
 
void barrierParallel (void)
 Wrapper for MPI_Barrier(MPI_COMM_WORLD). More...
 
int sendReceiveParallel (void *sendBuf, int sendLen, int dest, void *recvBuf, int recvLen, int source)
 Wrapper for MPI_Sendrecv. More...
 
void addIntParallel (int *sendBuf, int *recvBuf, int count)
 Wrapper for MPI_Allreduce integer sum. More...
 
void addRealParallel (real_t *sendBuf, real_t *recvBuf, int count)
 Wrapper for MPI_Allreduce real sum. More...
 
void addDoubleParallel (double *sendBuf, double *recvBuf, int count)
 Wrapper for MPI_Allreduce double sum. More...
 
void maxIntParallel (int *sendBuf, int *recvBuf, int count)
 Wrapper for MPI_Allreduce integer max. More...
 
void minRankDoubleParallel (RankReduceData *sendBuf, RankReduceData *recvBuf, int count)
 Wrapper for MPI_Allreduce double min with rank. More...
 
void maxRankDoubleParallel (RankReduceData *sendBuf, RankReduceData *recvBuf, int count)
 Wrapper for MPI_Allreduce double max with rank. More...
 
void bcastParallel (void *buf, int len, int root)
 Wrapper for MPI_Bcast. More...
 
int builtWithMpi (void)
 Return non-zero if code was built with MPI active. More...
 

Detailed Description

Wrappers for MPI functions.

Definition in file parallel.h.

Typedef Documentation

Structure for use with MPI_MINLOC and MPI_MAXLOC operations.

Function Documentation

void addDoubleParallel ( double *  sendBuf,
double *  recvBuf,
int  count 
)

Wrapper for MPI_Allreduce double sum.

Definition at line 133 of file parallel.c.

Here is the caller graph for this function:

void addIntParallel ( int *  sendBuf,
int *  recvBuf,
int  count 
)

Wrapper for MPI_Allreduce integer sum.

Definition at line 113 of file parallel.c.

Here is the caller graph for this function:

void addRealParallel ( real_t sendBuf,
real_t recvBuf,
int  count 
)

Wrapper for MPI_Allreduce real sum.

Definition at line 123 of file parallel.c.

Here is the caller graph for this function:

void barrierParallel ( void  )

Wrapper for MPI_Barrier(MPI_COMM_WORLD).

Definition at line 79 of file parallel.c.

Here is the caller graph for this function:

void bcastParallel ( void *  buf,
int  count,
int  root 
)

Wrapper for MPI_Bcast.

Parameters
[in]countLength of buf in bytes.

Definition at line 181 of file parallel.c.

Here is the caller graph for this function:

int builtWithMpi ( void  )

Return non-zero if code was built with MPI active.

Definition at line 188 of file parallel.c.

Here is the caller graph for this function:

void destroyParallel ( void  )

Wrapper for MPI_Finalize.

Definition at line 72 of file parallel.c.

Here is the caller graph for this function:

int getMyRank ( void  )

Return local rank.

Definition at line 36 of file parallel.c.

Here is the caller graph for this function:

int getNRanks ( void  )

Return total number of processors.

Definition at line 31 of file parallel.c.

Here is the caller graph for this function:

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

Wrapper for MPI_Init.

Definition at line 63 of file parallel.c.

Here is the caller graph for this function:

void maxIntParallel ( int *  sendBuf,
int *  recvBuf,
int  count 
)

Wrapper for MPI_Allreduce integer max.

Definition at line 143 of file parallel.c.

Here is the caller graph for this function:

void maxRankDoubleParallel ( RankReduceData sendBuf,
RankReduceData recvBuf,
int  count 
)

Wrapper for MPI_Allreduce double max with rank.

Definition at line 167 of file parallel.c.

Here is the caller graph for this function:

void minRankDoubleParallel ( RankReduceData sendBuf,
RankReduceData recvBuf,
int  count 
)

Wrapper for MPI_Allreduce double min with rank.

Definition at line 154 of file parallel.c.

Here is the caller graph for this function:

int printRank ( void  )

Return non-zero if printing occurs from this rank.

For now this is just a check for rank 0 but in principle it could be more complex. It is also possible to suppress practically all output by causing this function to return 0 for all ranks.

Definition at line 45 of file parallel.c.

Here is the caller graph for this function:

int sendReceiveParallel ( void *  sendBuf,
int  sendLen,
int  dest,
void *  recvBuf,
int  recvLen,
int  source 
)

Wrapper for MPI_Sendrecv.

Parameters
[in]sendBufData to send.
[in]sendLenNumber of bytes to send.
[in]destRank in MPI_COMM_WORLD where data will be sent.
[out]recvBufReceived data.
[in]recvLenMaximum number of bytes to receive.
[in]sourceRank in MPI_COMM_WORLD from which to receive.
Returns
Number of bytes received.

Definition at line 93 of file parallel.c.

Here is the caller graph for this function:

void timestampBarrier ( const char *  msg)

Print a timestamp and message when all tasks arrive.

Definition at line 51 of file parallel.c.

Here is the call graph for this function:

Here is the caller graph for this function: