@@ -24,6 +24,26 @@ extern void ompi_datatype_dump( MPI_Datatype ddt );
24
24
#define MPI_DDT_DUMP (ddt )
25
25
#endif /* OPEN_MPI */
26
26
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
+
27
47
/* Create a non-contiguous resized datatype */
28
48
struct structure {
29
49
double not_transfered ;
@@ -183,11 +203,12 @@ create_indexed_gap_optimized_ddt( void )
183
203
/********************************************************************
184
204
*******************************************************************/
185
205
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
191
212
192
213
#define DO_PACK 0x01000000
193
214
#define DO_UNPACK 0x02000000
@@ -483,7 +504,7 @@ static int do_test_for_ddt( int doop, MPI_Datatype sddt, MPI_Datatype rddt, int
483
504
484
505
int main ( int argc , char * argv [] )
485
506
{
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 */
487
508
int rank , size ;
488
509
MPI_Datatype ddt ;
489
510
@@ -544,6 +565,14 @@ int main( int argc, char* argv[] )
544
565
MPI_Type_free ( & ddt );
545
566
}
546
567
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
+
547
576
MPI_Finalize ();
548
577
exit (0 );
549
578
}
0 commit comments