11 #ifndef TEST_PARALLEL_IMOAB_COUPLER_UTILS_HPP_
12 #define TEST_PARALLEL_IMOAB_COUPLER_UTILS_HPP_
14 #define CHECKIERR( rc, message ) \
17 printf( "%s. ErrorCode = %d\n", message, rc ); \
21 #define PUSH_TIMER( operation ) \
23 timer_ops = timer.time_since_birth(); \
26 #define POP_TIMER( localcomm, localrank ) \
28 double locElapsed = timer.time_since_birth() - timer_ops, minElapsed = 0, maxElapsed = 0; \
29 MPI_Reduce( &locElapsed, &maxElapsed, 1, MPI_DOUBLE, MPI_MAX, 0, localcomm ); \
30 MPI_Reduce( &locElapsed, &minElapsed, 1, MPI_DOUBLE, MPI_MIN, 0, localcomm ); \
31 if( !( localrank ) ) \
32 std::cout << "[LOG] Time taken to " << opName.c_str() << ": max = " << maxElapsed \
33 << ", avg = " << ( maxElapsed + minElapsed ) / 2 << "\n"; \
44 for(
int i = start; i <= end; i++ )
47 int ierr = MPI_Group_incl( worldGroup, end - start + 1, &
groupTasks[0], group );
58 int ierr = MPI_Group_union( agroup, bgroup, abgroup );
62 CHECKIERR(
ierr,
"Cannot create joint communicator from union group" )
72 MPI_Group* cmpPEGroup,
74 MPI_Group* cplPEGroup,
79 int repartitioner_scheme )
82 if( *cmpcomm != MPI_COMM_NULL )
89 ierr = iMOAB_SendMesh( cmpId, cmpcoucomm, cplPEGroup, &cmpcouTag,
90 &repartitioner_scheme );
94 if( *coucomm != MPI_COMM_NULL )
97 ierr = iMOAB_ReceiveMesh( cplCmpId, cmpcoucomm, cmpPEGroup,
103 if( *cmpcomm != MPI_COMM_NULL )
105 int context_id = cmpcouTag;
106 ierr = iMOAB_FreeSenderBuffers( cmpId, &context_id );
107 CHECKIERR(
ierr,
"cannot free buffers used to send atm mesh" )