24 #define RUN_TEST_ARG2( A, B ) run_test( &( A ), #A, B )
30 #define CHECKRC( rc, message ) \
33 printf( "Error: %s\n", message ); \
40 int err = MPI_Allreduce( &is_my_error, &result, 1, MPI_INT, MPI_MAX,
MPI_COMM_WORLD );
44 int run_test(
ErrorCode ( *func )(
const char* ),
const char* func_name,
const char* file_name )
46 ErrorCode result = ( *func )( file_name );
53 std::cout << func_name <<
" : FAILED!!" << std::endl;
55 std::cout << func_name <<
" : success" << std::endl;
81 MPI_Group group1, group2;
97 int tagcomm1 = 1, tagcomm2 = 2;
99 MPI_Comm comm1, comm2;
100 ierr = MPI_Comm_create_group(
jcomm, group1, tagcomm1, &comm1 );
103 ierr = MPI_Comm_create_group(
jcomm, group2, tagcomm2, &comm2 );
119 if( comm1 != MPI_COMM_NULL )
124 if( comm2 != MPI_COMM_NULL )
130 if( comm1 != MPI_COMM_NULL )
133 std::string
readopts(
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS" );
144 iMOAB_DumpCommGraph( pid1, &
context, &is_sender,
"MigrateS" );
148 if( comm2 != MPI_COMM_NULL )
153 wopts =
"PARALLEL=WRITE_PART;";
159 iMOAB_DumpCommGraph( pid2, &
context, &is_sender,
"MigrateR" );
163 MPI_Barrier(
jcomm );
167 if( comm1 != MPI_COMM_NULL )
ierr = iMOAB_FreeSenderBuffers( pid1, &context_id );
169 if( comm2 != MPI_COMM_NULL )
172 CHECKRC(
ierr,
"cannot deregister app 2 receiver" )
175 if( comm1 != MPI_COMM_NULL )
184 if( MPI_COMM_NULL != comm1 ) MPI_Comm_free( &comm1 );
185 if( MPI_COMM_NULL != comm2 ) MPI_Comm_free( &comm2 );
187 MPI_Group_free( &group1 );
188 MPI_Group_free( &group2 );
207 int main(
int argc,
char* argv[] )
209 MPI_Init( &argc, &argv );
220 filename = TestDir +
"unittest/field1.h5m";
228 opts.
addOpt<
int >(
"startSender,a",
"start task for source layout", &
startG1 );
229 opts.
addOpt<
int >(
"endSender,b",
"end task for source layout", &
endG1 );
230 opts.
addOpt<
int >(
"startRecv,c",
"start task for receiver layout", &
startG2 );
231 opts.
addOpt<
int >(
"endRecv,d",
"end task for receiver layout", &
endG2 );
233 opts.
addOpt<
int >(
"typeTest,t",
"test types (0 - trivial, 1 graph, 2 geom, 3 both graph and geometry",
240 std::cout <<
" input file : " <<
filename <<
"\n";
241 std::cout <<
" sender on tasks: " <<
startG1 <<
":" <<
endG1 <<
"\n";
242 std::cout <<
" receiver on tasks: " <<
startG2 <<
":" <<
endG2 <<
"\n";
243 std::cout <<
" type migrate: " << typeTest <<
" (0 - trivial, 1 graph , 2 geom, 3 both graph and geom ) \n";
255 std::cout <<
"All tests passed" << std::endl;
257 std::cout << num_errors <<
" TESTS FAILED!" << std::endl;
260 MPI_Group_free( &
jgroup );
261 MPI_Comm_free( &
jcomm );