37#ifndef __PARA_COMM_MPI_H__
38#define __PARA_COMM_MPI_H__
62#include "ugs/ugsParaCommMpi.h"
68#define MPI_CALL( mpicall ) do \
71 _error_value_ = ( mpicall ); \
72 if( _error_value_ != MPI_SUCCESS ) \
74 std::cout << "[MPI ERROR: " << __FILE__ << "] func = " \
75 << __func__ << ", line = " << __LINE__ << ": " \
76 << "error_code = " << _error_value_ << std::endl; \
77 MPI_Abort(MPI_COMM_WORLD, 1); \
81#define TAG_TRACE( call, fromTo, sourceDest, tag ) \
84 *tos << (MPI_Wtime() - startTime) << " [Rank = " << myRank << "] " << #call << " " << #fromTo \
85 << " " << sourceDest << " with Tag = " << getTagString(tag) << std::endl; \
88class ParaIsendRequest;
121 UGS::UgsParaCommMpi *commUgs;
353 const int datatypeId,
364 const int datatypeId,
376 const int datatypeId,
389 const int datatypeId,
428 MPI_Datatype datatype,
439 MPI_Datatype datatype,
451 MPI_Datatype datatype,
464 MPI_Datatype datatype,
484#define DEF_PARA_COMM( para_comm, comm ) ParaCommMpi *para_comm = dynamic_cast< ParaCommMpi* >(comm)
Communicator object for MPI communications.
double startTime
start time of this communicator
virtual void lockApp()
lock UG application to synchronize with other threads
bool probe(int *source, int *tag)
probe function which waits a new message
virtual int send(void *bufer, int count, const int datatypeId, int dest, const int tag)
send function for standard ParaData types
bool iProbe(int *source, int *tag)
iProbe function which checks if a new message is arrived or not
void solverInit(ParaParamSet *paraParamSet)
initializer for Solvers
static MPI_Datatype datatypes[TYPE_LIST_SIZE]
data type mapping table to MPI data type
int receive(void *bufer, int count, const int datatypeId, int source, const int tag)
receive function for standard ParaData types
int token[2]
index 0: token index 1: token color -1: green > 0: yellow ( termination origin solver number ) -2: re...
MPI_Comm myComm
MPI communicator.
int getSize()
get size of this communicator, which indicates how many threads in a UG process
virtual bool tagStringTableIsSetUpCoorectly()
check if tag string table (for debugging) set up correctly
bool tagTraceFlag
indicate if tags are traced or not
std::deque< ParaIsendRequest * > iSendRequestDeque
int myRank
rank of this process
ParaCommMpi()
default constructor of ParaCommMpi
ParaCommMpi(MPI_Comm comm)
constructor of ParaCommMpi with MPI communicator
std::mutex applicationLockMutex
mutex for applications
std::ostream * tos
output file stream for tag trace to change file name
virtual const char * getTagString(int tag)
get Tag string for debugging
int iSend(void *bufer, int count, const int datatypeId, int dest, const int tag, MPI_Request *req)
send function for standard ParaData types
virtual void passToken(int rank)
pass token to from the rank to the next
char procName[MPI_MAX_PROCESSOR_NAME]
process name
int ubcast(void *buffer, int count, MPI_Datatype datatype, int root)
User type bcast for created data type.
int namelen
length of this process name
static const char * tagStringTable[]
table for tag name string
int ureceive(void *bufer, int count, MPI_Datatype datatype, int source, int tag)
User type receive for created data type.
pthread_mutex_t tokenAccessLock
mutex for pthread thread
int iUsend(void *bufer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Request *req)
User type send for created data type.
double getStartTime()
get start time of this communicator
int getRank()
get rank of caller's thread
int myCommSize
communicator size : number of processes joined in this system
virtual void init(int argc, char **argv)
initializer of this communicator
int getNumOfMessagesWaitingToSend(int dest=-1)
get size of the messageQueueTable
ParaTimer * createParaTimer()
create ParaTimer object
virtual ~ParaCommMpi()
destructor of this communicator
virtual bool waitTerminatedMessage()
function to wait Terminated message (This function is not used currently)
virtual void unlockApp()
unlock UG application to synchronize with other threads
void abort()
abort. How it works sometimes depends on communicator used
MPI_Comm & getMpiComm()
getter of MPI_Comm
virtual bool passTermToken(int rank)
pass termination token from the rank to the next
int bcast(void *buffer, int count, const int datatypeId, int root)
broadcast function for standard ParaData types
void waitSpecTagFromSpecSource(const int source, const int tag, int *receivedTag)
wait function for a specific tag from a specific source coming from
void lcInit(ParaParamSet *paraParamSet)
initializer for LoadCoordinator
virtual void setToken(int rank, int *inToken)
set received token to this communicator
int usend(void *bufer, int count, MPI_Datatype datatype, int dest, int tag)
User type send for created data type.
std::ofstream ofs
output file stream for tag trace
virtual bool waitToken(int rank)
wait token when UG runs with deterministic mode
Base class of communicator object.
virtual void lockApp()=0
lock UG application to synchronize with other threads
virtual void unlockApp()=0
unlock UG application to synchronize with other threads
class ParaTimerMpi (Timer used in MPI communication)
static ScipParaCommTh * comm
static ScipParaParamSet * paraParamSet
static const int TYPE_LIST_SIZE
Base class of communicator for UG Framework.
Defines for UG Framework.
Base class for a container which has difference between instance and subproblem.
Base class for instance data.
ParaParamSet extension for MPI communication.
ParaTimer extension for MPI timer.