@@ -24,6 +24,26 @@ extern void ompi_datatype_dump( MPI_Datatype ddt );
2424#define MPI_DDT_DUMP (ddt )
2525#endif /* OPEN_MPI */
2626
27+ static MPI_Datatype
28+ create_merged_contig_with_gaps (int count ) /* count of the basic datatype */
29+ {
30+ int array_of_blocklengths [] = {1 , 1 , 1 };
31+ MPI_Aint array_of_displacements [] = {0 , 8 , 16 };
32+ MPI_Datatype array_of_types [] = {MPI_DOUBLE , MPI_LONG , MPI_CHAR };
33+ MPI_Datatype type ;
34+
35+ MPI_Type_create_struct (3 , array_of_blocklengths ,
36+ array_of_displacements , array_of_types ,
37+ & type );
38+ if ( 1 < count ) {
39+ MPI_Datatype temp = type ;
40+ MPI_Type_contiguous (count , temp , & type );
41+ }
42+ MPI_Type_commit (& type );
43+ MPI_DDT_DUMP ( type );
44+ return type ;
45+ }
46+
2747/* Create a non-contiguous resized datatype */
2848struct structure {
2949 double not_transfered ;
@@ -183,11 +203,12 @@ create_indexed_gap_optimized_ddt( void )
183203/********************************************************************
184204 *******************************************************************/
185205
186- #define DO_CONTIG 0x00000001
187- #define DO_CONSTANT_GAP 0x00000002
188- #define DO_INDEXED_GAP 0x00000004
189- #define DO_OPTIMIZED_INDEXED_GAP 0x00000008
190- #define DO_STRUCT_CONSTANT_GAP_RESIZED 0x00000010
206+ #define DO_CONTIG 0x00000001
207+ #define DO_CONSTANT_GAP 0x00000002
208+ #define DO_INDEXED_GAP 0x00000004
209+ #define DO_OPTIMIZED_INDEXED_GAP 0x00000008
210+ #define DO_STRUCT_CONSTANT_GAP_RESIZED 0x00000010
211+ #define DO_STRUCT_MERGED_WITH_GAP_RESIZED 0x00000020
191212
192213#define DO_PACK 0x01000000
193214#define DO_UNPACK 0x02000000
@@ -483,7 +504,7 @@ static int do_test_for_ddt( int doop, MPI_Datatype sddt, MPI_Datatype rddt, int
483504
484505int main ( int argc , char * argv [] )
485506{
486- int run_tests = 0xffff ; /* do all datatype tests by default */
507+ int run_tests = DO_STRUCT_MERGED_WITH_GAP_RESIZED ; /* do all datatype tests by default */
487508 int rank , size ;
488509 MPI_Datatype ddt ;
489510
@@ -544,6 +565,14 @@ int main( int argc, char* argv[] )
544565 MPI_Type_free ( & ddt );
545566 }
546567
568+ if ( run_tests & DO_STRUCT_MERGED_WITH_GAP_RESIZED ) {
569+ printf ( "\nstruct constant gap resized\n\n" );
570+ ddt = create_merged_contig_with_gaps ( 1 );
571+ MPI_DDT_DUMP ( ddt );
572+ do_test_for_ddt ( run_tests , ddt , ddt , MAX_LENGTH );
573+ MPI_Type_free ( & ddt );
574+ }
575+
547576 MPI_Finalize ();
548577 exit (0 );
549578}
0 commit comments