Skip to content

Commit 268f8de

Browse files
committed
test/ddt_lib: remove UB/LB tests
Signed-off-by: Nathan Hjelm <[email protected]>
1 parent bc17862 commit 268f8de

File tree

7 files changed

+8
-485
lines changed

7 files changed

+8
-485
lines changed

test/datatype/ddt_lib.c

Lines changed: 2 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
1414
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
15+
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
16+
* reserved.
1517
* $COPYRIGHT$
1618
*
1719
* Additional copyrights may follow
@@ -66,239 +68,6 @@ ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length
6668
return type1;
6769
}
6870

69-
int mpich_typeub( void )
70-
{
71-
int errs = 0;
72-
MPI_Aint extent, lb, extent1, extent2, extent3;
73-
MPI_Aint displ[2];
74-
int blens[2];
75-
ompi_datatype_t *type1, *type2, *type3, *types[2];
76-
77-
ompi_datatype_create_vector( 2, 1, 4, &ompi_mpi_int.dt, &type1 );
78-
ompi_datatype_commit( &type1 );
79-
ompi_datatype_get_extent( type1, &lb, &extent );
80-
extent1 = 5 * sizeof(int);
81-
if (extent != extent1) {
82-
printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1);
83-
errs++;
84-
printf("extent(type1)=%ld\n",(long)extent);
85-
}
86-
87-
blens[0] = 1;
88-
blens[1] = 1;
89-
displ[0] = 0;
90-
displ[1] = sizeof(int)*4;
91-
types[0] = type1;
92-
types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/
93-
extent2 = displ[1];
94-
95-
/* using MPI_UB and Type_struct, monkey with the extent, making it 16
96-
*/
97-
ompi_datatype_create_struct( 2, blens, displ, types, &type2 );
98-
ompi_datatype_commit( &type2 );
99-
ompi_datatype_get_extent( type2, &lb, &extent );
100-
if (extent != extent2) {
101-
printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2);
102-
errs++;
103-
printf("extent(type2)=%ld\n",(long)extent);
104-
}
105-
106-
/* monkey with the extent again, making it 4
107-
* ===> MPICH gives 4
108-
* ===> MPIF gives 16, the old extent
109-
*/
110-
displ[1] = sizeof(int);
111-
types[0] = type2;
112-
types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/
113-
extent3 = extent2;
114-
115-
ompi_datatype_create_struct( 2, blens, displ, types, &type3 );
116-
ompi_datatype_commit( &type3 );
117-
118-
ompi_datatype_get_extent( type3, &lb, &extent );
119-
if (extent != extent3) {
120-
printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3);
121-
errs++;
122-
printf("extent(type3)=%ld\n",(long)extent);
123-
}
124-
125-
OBJ_RELEASE( type1 ); /*assert( type1 == NULL );*/
126-
OBJ_RELEASE( type2 ); /*assert( type2 == NULL );*/
127-
OBJ_RELEASE( type3 ); assert( type3 == NULL );
128-
return errs;
129-
}
130-
131-
int mpich_typeub2( void )
132-
{
133-
int blocklen[3], err = 0;
134-
size_t sz1, sz2, sz3;
135-
MPI_Aint disp[3], lb, ub, ex1, ex2, ex3;
136-
ompi_datatype_t *types[3], *dt1, *dt2, *dt3;
137-
138-
blocklen[0] = 1;
139-
blocklen[1] = 1;
140-
blocklen[2] = 1;
141-
disp[0] = -3;
142-
disp[1] = 0;
143-
disp[2] = 6;
144-
types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */
145-
types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */
146-
types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */
147-
148-
ompi_datatype_create_struct(3,blocklen,disp, types,&dt1);
149-
ompi_datatype_commit(&dt1);
150-
151-
ompi_datatype_type_lb(dt1, &lb); ompi_datatype_type_ub(dt1, &ub);
152-
ompi_datatype_type_extent(dt1,&ex1); ompi_datatype_type_size(dt1,&sz1);
153-
154-
/* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */
155-
if (lb != -3 || ub != 6 || ex1 != 9) {
156-
printf("Example 3.26 type1 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex1, (int)sz1);
157-
err++;
158-
}
159-
else
160-
printf("Example 3.26 type1 correct\n" );
161-
162-
ompi_datatype_create_contiguous(2,dt1,&dt2);
163-
ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub);
164-
ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2);
165-
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
166-
if (lb != -3 || ub != 15 || ex2 != 18) {
167-
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
168-
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
169-
err++;
170-
}
171-
else
172-
printf("Example 3.26 type1 correct\n" );
173-
OBJ_RELEASE( dt2 ); assert( dt2 == NULL );
174-
ompi_datatype_create_contiguous(2,dt1,&dt2);
175-
ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub);
176-
ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2);
177-
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
178-
if (lb != -3 || ub != 15 || ex2 != 18) {
179-
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
180-
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
181-
err++;
182-
}
183-
else
184-
printf( "Example 3.26 type2 correct\n" );
185-
186-
types[0]=dt1; types[1]=dt1;
187-
blocklen[0]=1; blocklen[1]=1;
188-
disp[0]=0; disp[1]=ex1;
189-
190-
ompi_datatype_create_struct(2, blocklen, disp, types, &dt3);
191-
ompi_datatype_commit(&dt3);
192-
193-
ompi_datatype_type_lb(dt3, &lb); ompi_datatype_type_ub(dt3, &ub);
194-
ompi_datatype_type_extent(dt3,&ex3); ompi_datatype_type_size(dt3,&sz3);
195-
/* Another way to express type2 */
196-
if (lb != -3 || ub != 15 || ex3 != 18) {
197-
printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
198-
printf("type3 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex3, (int)sz2);
199-
err++;
200-
}
201-
else
202-
printf( "type3 correct\n" );
203-
204-
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
205-
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
206-
OBJ_RELEASE( dt3 ); assert( dt3 == NULL );
207-
return err;
208-
}
209-
210-
int mpich_typeub3( void )
211-
{
212-
int blocklen[3], err = 0, idisp[3];
213-
size_t sz;
214-
MPI_Aint disp[3], lb, ub, ex;
215-
ompi_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5;
216-
217-
/* Create a datatype with explicit LB and UB */
218-
blocklen[0] = 1;
219-
blocklen[1] = 1;
220-
blocklen[2] = 1;
221-
disp[0] = -3;
222-
disp[1] = 0;
223-
disp[2] = 6;
224-
types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */
225-
types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */
226-
types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */
227-
228-
/* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */
229-
ompi_datatype_create_struct(3,blocklen,disp, types,&dt1);
230-
ompi_datatype_commit(&dt1);
231-
232-
/* This type is the same as in typeub2, and is tested there */
233-
types[0]=dt1; types[1]=dt1;
234-
blocklen[0]=1; blocklen[1]=1;
235-
disp[0]=-4; disp[1]=7;
236-
idisp[0]=-4; idisp[1]=7;
237-
238-
ompi_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 );
239-
ompi_datatype_commit( &dt2 );
240-
241-
ompi_datatype_type_lb( dt2, &lb ); ompi_datatype_type_ub( dt2, &ub );
242-
ompi_datatype_type_extent( dt2, &ex ); ompi_datatype_type_size( dt2, &sz );
243-
244-
if (lb != -7 || ub != 13 || ex != 20) {
245-
printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz);
246-
printf("hindexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
247-
err++;
248-
}
249-
else
250-
printf( "hindexed ok\n" );
251-
252-
ompi_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 );
253-
ompi_datatype_commit( &dt3 );
254-
255-
ompi_datatype_type_lb( dt3, &lb ); ompi_datatype_type_ub( dt3, &ub );
256-
ompi_datatype_type_extent( dt3, &ex ); ompi_datatype_type_size( dt3, &sz );
257-
258-
if (lb != -39 || ub != 69 || ex != 108) {
259-
printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz);
260-
printf("indexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
261-
err++;
262-
}
263-
else
264-
printf( "indexed ok\n" );
265-
266-
ompi_datatype_create_hvector( 2, 1, 14, dt1, &dt4 );
267-
ompi_datatype_commit( &dt4 );
268-
269-
ompi_datatype_type_lb( dt4, &lb ); ompi_datatype_type_ub( dt4, &ub );
270-
ompi_datatype_type_extent( dt4, &ex ); ompi_datatype_type_size( dt4, &sz );
271-
272-
if (lb != -3 || ub != 20 || ex != 23) {
273-
printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz);
274-
printf("hvector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
275-
err++;
276-
}
277-
else
278-
printf( "hvector ok\n" );
279-
280-
ompi_datatype_create_vector( 2, 1, 14, dt1, &dt5 );
281-
ompi_datatype_commit( &dt5 );
282-
283-
ompi_datatype_type_lb( dt5, &lb ); ompi_datatype_type_ub( dt5, &ub );
284-
ompi_datatype_type_extent( dt5, &ex ); ompi_datatype_type_size( dt5, &sz );
285-
286-
if (lb != -3 || ub != 132 || ex != 135) {
287-
printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz);
288-
printf("vector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
289-
err++;
290-
}
291-
else
292-
printf( "vector ok\n" );
293-
294-
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
295-
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
296-
OBJ_RELEASE( dt3 ); /*assert( dt3 == NULL );*/
297-
OBJ_RELEASE( dt4 ); /*assert( dt4 == NULL );*/
298-
OBJ_RELEASE( dt5 ); assert( dt5 == NULL );
299-
return err;
300-
}
301-
30271
void print_double_mat( unsigned int N, double* mat )
30372
{
30473
unsigned int i, j;

test/datatype/ddt_lib.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* Copyright (c) 2004-2006 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
14+
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
15+
* reserved.
1416
* $COPYRIGHT$
1517
*
1618
* Additional copyrights may follow
@@ -46,9 +48,6 @@ extern void cache_trash( void );
4648
*/
4749
ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length );
4850

49-
extern int mpich_typeub( void );
50-
extern int mpich_typeub2( void );
51-
extern int mpich_typeub3( void );
5251
extern void print_double_mat( unsigned int N, double* mat );
5352
extern int init_random_upper_matrix( unsigned int N, double* mat );
5453
extern int check_diag_matrix( unsigned int N, double* mat1, double* mat2 );

test/datatype/ddt_raw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* Copyright (c) 2004-2006 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
14+
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
15+
* reserved.
1416
* $COPYRIGHT$
1517
*
1618
* Additional copyrights may follow
@@ -172,10 +174,6 @@ int main( int argc, char* argv[] )
172174
}
173175
OBJ_RELEASE( pdt ); assert( pdt == NULL );
174176

175-
mpich_typeub();
176-
mpich_typeub2();
177-
mpich_typeub3();
178-
179177
printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" );
180178
rc = test_upper( length );
181179
if( rc == 0 )

test/datatype/ddt_test.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,6 @@ int main( int argc, char* argv[] )
373373
}
374374
OBJ_RELEASE( pdt ); assert( pdt == NULL );
375375

376-
mpich_typeub();
377-
mpich_typeub2();
378-
mpich_typeub3();
379-
380376
printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" );
381377
rc = test_upper( length );
382378
if( rc == 0 )

test/datatype/opal_datatype_test.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1515
* Copyright (c) 2017 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
18+
* reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -531,10 +533,6 @@ int main( int argc, char* argv[] )
531533
}
532534
OBJ_RELEASE( pdt ); assert( pdt == NULL );
533535

534-
mpich_typeub();
535-
mpich_typeub2();
536-
mpich_typeub3();
537-
538536
printf( "\n\n#\n * TEST UPPER MATRIX\n#\n\n" );
539537
rc = test_upper( length );
540538
if( rc == 0 )

0 commit comments

Comments
 (0)