35 #ifndef communicator_h 36 #define communicator_h 80 return processCommBuffs [ i ];
141 return processComms [ i ];
153 template<
class T >
int packAllData( T *ptr,
int ( T :: *packFunc )(
ProcessCommunicator & ) );
162 template<
class T,
class P >
int packAllData( T *ptr, P *src,
int ( T :: *packFunc )( P *,
ProcessCommunicator & ) );
170 template<
class T >
int unpackAllData( T *ptr,
int ( T :: *unpackFunc )(
ProcessCommunicator & ) );
180 template<
class T,
class P >
int unpackAllData( T *ptr, P *src,
int ( T :: *unpackFunc )( P *,
ProcessCommunicator & ) );
186 int initExchange(
int tag);
193 int initSend(
int tag);
200 int initReceive(
int tag);
205 int finishExchange();
219 std :: string
errorInfo(
const char *func)
const;
222 template<
class T >
int 225 int i = size, result = 1;
228 for ( i = 0; i < size; i++ ) {
229 result &= giveProcessCommunicator(i)->packData(ptr, packFunc);
247 template<
class T,
class P >
int 250 int i = size, result = 1;
253 for ( i = 0; i < size; i++ ) {
254 result &= giveProcessCommunicator(i)->packData(ptr, src, packFunc);
261 template<
class T >
int 264 int i, received, num_recv = 0, result = 1;
268 for ( i = 0; i < size; i++ ) {
270 if ( ( giveProcessCommunicator(i)->giveToRecvMap()->giveSize() ) ||
272 recvFlag.
at(i + 1) = 1;
277 while ( num_recv-- ) {
281 for ( i = 0; i < size; i++ ) {
282 if ( recvFlag.
at(i + 1) ) {
284 if ( giveProcessCommunicator(i)->receiveCompleted() ) {
285 #ifdef __VERBOSE_PARALLEL 286 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Received data from partition %3d\n",
287 rank,
"Communicator :: unpackAllData", i);
290 recvFlag.
at(i + 1) = 0;
291 result &= giveProcessCommunicator(i)->unpackData(ptr, unpackFunc);
304 #ifdef __VERBOSE_PARALLEL 308 MPI_Barrier(MPI_COMM_WORLD);
310 #ifdef __VERBOSE_PARALLEL 376 template<
class T,
class P >
int 379 int i, received, num_recv = 0, result = 1;
383 for ( i = 0; i < size; i++ ) {
385 if ( ( giveProcessCommunicator(i)->giveToRecvMap()->giveSize() ) ||
387 recvFlag.
at(i + 1) = 1;
392 while ( num_recv-- ) {
396 for ( i = 0; i < size; i++ ) {
397 if ( recvFlag.
at(i + 1) ) {
399 if ( giveProcessCommunicator(i)->receiveCompleted() ) {
400 #ifdef __VERBOSE_PARALLEL 401 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Received data from partition %3d\n",
402 rank,
"Communicator :: unpackAllData", i);
405 recvFlag.
at(i + 1) = 0;
406 result &= giveProcessCommunicator(i)->unpackData(ptr, dest, unpackFunc);
419 #ifdef __VERBOSE_PARALLEL 423 MPI_Barrier(MPI_COMM_WORLD);
425 #ifdef __VERBOSE_PARALLEL 432 #endif // communicator_h ProcessCommunicatorBuff * giveProcessCommunicatorBuff(int i)
Returns i-th process communicator buff.
virtual void setUpCommunicationMaps(EngngModel *pm)
Service for setting up the communication patterns with other remote processes.
int size
Number of processes.
int packAllData(T *ptr, int(T::*packFunc)(ProcessCommunicator &))
Pack all problemCommunicators data to their send buffers.
The mode can be static, meaning that each node can assemble its communication maps independently (or ...
The ProcessCommunicator and corresponding buffers (represented by this class) are separated in order ...
#define OOFEM_LOG_DEBUG(...)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
CommunicatorMode
The communicator mode determines the communication.
CommunicatorMode mode
Mode.
#define VERBOSEPARALLEL_PRINT(service, str, rank)
ProcessCommunicator ** processComms
Array of process communicators.
Class representing process communicator for engineering model.
EngngModel * engngModel
Engineering model.
(Dynamic) In this case the communication pattern and the amount of data sent between nodes is not kno...
int unpackAllData(T *ptr, int(T::*unpackFunc)(ProcessCommunicator &))
Unpack all problemCommuncators data from recv buffers.
Class representing communicator.
int size
Number of processes.
std::string errorInfo(const char *func)
ProcessCommunicator * giveProcessCommunicator(int i)
Returns i-th problem communicator.
ProcessCommunicatorBuff ** processCommBuffs
Array of process communicators.
The Communicator and corresponding buffers (represented by this class) are separated in order to allo...
Abstract base class representing the "problem" under consideration.
the oofem namespace is to define a context or scope in which all oofem names are defined.