test/ddt_lib: remove UB/LB tests
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
89da9651bb
Коммит
74563d22a0
@ -12,6 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -66,239 +68,6 @@ ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length
|
||||
return type1;
|
||||
}
|
||||
|
||||
int mpich_typeub( void )
|
||||
{
|
||||
int errs = 0;
|
||||
MPI_Aint extent, lb, extent1, extent2, extent3;
|
||||
MPI_Aint displ[2];
|
||||
int blens[2];
|
||||
ompi_datatype_t *type1, *type2, *type3, *types[2];
|
||||
|
||||
ompi_datatype_create_vector( 2, 1, 4, &ompi_mpi_int.dt, &type1 );
|
||||
ompi_datatype_commit( &type1 );
|
||||
ompi_datatype_get_extent( type1, &lb, &extent );
|
||||
extent1 = 5 * sizeof(int);
|
||||
if (extent != extent1) {
|
||||
printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1);
|
||||
errs++;
|
||||
printf("extent(type1)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
blens[0] = 1;
|
||||
blens[1] = 1;
|
||||
displ[0] = 0;
|
||||
displ[1] = sizeof(int)*4;
|
||||
types[0] = type1;
|
||||
types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/
|
||||
extent2 = displ[1];
|
||||
|
||||
/* using MPI_UB and Type_struct, monkey with the extent, making it 16
|
||||
*/
|
||||
ompi_datatype_create_struct( 2, blens, displ, types, &type2 );
|
||||
ompi_datatype_commit( &type2 );
|
||||
ompi_datatype_get_extent( type2, &lb, &extent );
|
||||
if (extent != extent2) {
|
||||
printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2);
|
||||
errs++;
|
||||
printf("extent(type2)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
/* monkey with the extent again, making it 4
|
||||
* ===> MPICH gives 4
|
||||
* ===> MPIF gives 16, the old extent
|
||||
*/
|
||||
displ[1] = sizeof(int);
|
||||
types[0] = type2;
|
||||
types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/
|
||||
extent3 = extent2;
|
||||
|
||||
ompi_datatype_create_struct( 2, blens, displ, types, &type3 );
|
||||
ompi_datatype_commit( &type3 );
|
||||
|
||||
ompi_datatype_get_extent( type3, &lb, &extent );
|
||||
if (extent != extent3) {
|
||||
printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3);
|
||||
errs++;
|
||||
printf("extent(type3)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
OBJ_RELEASE( type1 ); /*assert( type1 == NULL );*/
|
||||
OBJ_RELEASE( type2 ); /*assert( type2 == NULL );*/
|
||||
OBJ_RELEASE( type3 ); assert( type3 == NULL );
|
||||
return errs;
|
||||
}
|
||||
|
||||
int mpich_typeub2( void )
|
||||
{
|
||||
int blocklen[3], err = 0;
|
||||
size_t sz1, sz2, sz3;
|
||||
MPI_Aint disp[3], lb, ub, ex1, ex2, ex3;
|
||||
ompi_datatype_t *types[3], *dt1, *dt2, *dt3;
|
||||
|
||||
blocklen[0] = 1;
|
||||
blocklen[1] = 1;
|
||||
blocklen[2] = 1;
|
||||
disp[0] = -3;
|
||||
disp[1] = 0;
|
||||
disp[2] = 6;
|
||||
types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */
|
||||
types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */
|
||||
types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */
|
||||
|
||||
ompi_datatype_create_struct(3,blocklen,disp, types,&dt1);
|
||||
ompi_datatype_commit(&dt1);
|
||||
|
||||
ompi_datatype_type_lb(dt1, &lb); ompi_datatype_type_ub(dt1, &ub);
|
||||
ompi_datatype_type_extent(dt1,&ex1); ompi_datatype_type_size(dt1,&sz1);
|
||||
|
||||
/* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */
|
||||
if (lb != -3 || ub != 6 || ex1 != 9) {
|
||||
printf("Example 3.26 type1 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex1, (int)sz1);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf("Example 3.26 type1 correct\n" );
|
||||
|
||||
ompi_datatype_create_contiguous(2,dt1,&dt2);
|
||||
ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub);
|
||||
ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2);
|
||||
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
|
||||
if (lb != -3 || ub != 15 || ex2 != 18) {
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf("Example 3.26 type1 correct\n" );
|
||||
OBJ_RELEASE( dt2 ); assert( dt2 == NULL );
|
||||
ompi_datatype_create_contiguous(2,dt1,&dt2);
|
||||
ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub);
|
||||
ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2);
|
||||
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
|
||||
if (lb != -3 || ub != 15 || ex2 != 18) {
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "Example 3.26 type2 correct\n" );
|
||||
|
||||
types[0]=dt1; types[1]=dt1;
|
||||
blocklen[0]=1; blocklen[1]=1;
|
||||
disp[0]=0; disp[1]=ex1;
|
||||
|
||||
ompi_datatype_create_struct(2, blocklen, disp, types, &dt3);
|
||||
ompi_datatype_commit(&dt3);
|
||||
|
||||
ompi_datatype_type_lb(dt3, &lb); ompi_datatype_type_ub(dt3, &ub);
|
||||
ompi_datatype_type_extent(dt3,&ex3); ompi_datatype_type_size(dt3,&sz3);
|
||||
/* Another way to express type2 */
|
||||
if (lb != -3 || ub != 15 || ex3 != 18) {
|
||||
printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("type3 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex3, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "type3 correct\n" );
|
||||
|
||||
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
|
||||
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
|
||||
OBJ_RELEASE( dt3 ); assert( dt3 == NULL );
|
||||
return err;
|
||||
}
|
||||
|
||||
int mpich_typeub3( void )
|
||||
{
|
||||
int blocklen[3], err = 0, idisp[3];
|
||||
size_t sz;
|
||||
MPI_Aint disp[3], lb, ub, ex;
|
||||
ompi_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5;
|
||||
|
||||
/* Create a datatype with explicit LB and UB */
|
||||
blocklen[0] = 1;
|
||||
blocklen[1] = 1;
|
||||
blocklen[2] = 1;
|
||||
disp[0] = -3;
|
||||
disp[1] = 0;
|
||||
disp[2] = 6;
|
||||
types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */
|
||||
types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */
|
||||
types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */
|
||||
|
||||
/* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */
|
||||
ompi_datatype_create_struct(3,blocklen,disp, types,&dt1);
|
||||
ompi_datatype_commit(&dt1);
|
||||
|
||||
/* This type is the same as in typeub2, and is tested there */
|
||||
types[0]=dt1; types[1]=dt1;
|
||||
blocklen[0]=1; blocklen[1]=1;
|
||||
disp[0]=-4; disp[1]=7;
|
||||
idisp[0]=-4; idisp[1]=7;
|
||||
|
||||
ompi_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 );
|
||||
ompi_datatype_commit( &dt2 );
|
||||
|
||||
ompi_datatype_type_lb( dt2, &lb ); ompi_datatype_type_ub( dt2, &ub );
|
||||
ompi_datatype_type_extent( dt2, &ex ); ompi_datatype_type_size( dt2, &sz );
|
||||
|
||||
if (lb != -7 || ub != 13 || ex != 20) {
|
||||
printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz);
|
||||
printf("hindexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "hindexed ok\n" );
|
||||
|
||||
ompi_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 );
|
||||
ompi_datatype_commit( &dt3 );
|
||||
|
||||
ompi_datatype_type_lb( dt3, &lb ); ompi_datatype_type_ub( dt3, &ub );
|
||||
ompi_datatype_type_extent( dt3, &ex ); ompi_datatype_type_size( dt3, &sz );
|
||||
|
||||
if (lb != -39 || ub != 69 || ex != 108) {
|
||||
printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz);
|
||||
printf("indexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "indexed ok\n" );
|
||||
|
||||
ompi_datatype_create_hvector( 2, 1, 14, dt1, &dt4 );
|
||||
ompi_datatype_commit( &dt4 );
|
||||
|
||||
ompi_datatype_type_lb( dt4, &lb ); ompi_datatype_type_ub( dt4, &ub );
|
||||
ompi_datatype_type_extent( dt4, &ex ); ompi_datatype_type_size( dt4, &sz );
|
||||
|
||||
if (lb != -3 || ub != 20 || ex != 23) {
|
||||
printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz);
|
||||
printf("hvector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "hvector ok\n" );
|
||||
|
||||
ompi_datatype_create_vector( 2, 1, 14, dt1, &dt5 );
|
||||
ompi_datatype_commit( &dt5 );
|
||||
|
||||
ompi_datatype_type_lb( dt5, &lb ); ompi_datatype_type_ub( dt5, &ub );
|
||||
ompi_datatype_type_extent( dt5, &ex ); ompi_datatype_type_size( dt5, &sz );
|
||||
|
||||
if (lb != -3 || ub != 132 || ex != 135) {
|
||||
printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz);
|
||||
printf("vector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "vector ok\n" );
|
||||
|
||||
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
|
||||
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
|
||||
OBJ_RELEASE( dt3 ); /*assert( dt3 == NULL );*/
|
||||
OBJ_RELEASE( dt4 ); /*assert( dt4 == NULL );*/
|
||||
OBJ_RELEASE( dt5 ); assert( dt5 == NULL );
|
||||
return err;
|
||||
}
|
||||
|
||||
void print_double_mat( unsigned int N, double* mat )
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
@ -11,6 +11,8 @@
|
||||
* Copyright (c) 2004-2006 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -46,9 +48,6 @@ extern void cache_trash( void );
|
||||
*/
|
||||
ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length );
|
||||
|
||||
extern int mpich_typeub( void );
|
||||
extern int mpich_typeub2( void );
|
||||
extern int mpich_typeub3( void );
|
||||
extern void print_double_mat( unsigned int N, double* mat );
|
||||
extern int init_random_upper_matrix( unsigned int N, double* mat );
|
||||
extern int check_diag_matrix( unsigned int N, double* mat1, double* mat2 );
|
||||
|
@ -11,6 +11,8 @@
|
||||
* Copyright (c) 2004-2006 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Sun Microsystems Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -172,10 +174,6 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||
|
||||
mpich_typeub();
|
||||
mpich_typeub2();
|
||||
mpich_typeub3();
|
||||
|
||||
printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" );
|
||||
rc = test_upper( length );
|
||||
if( rc == 0 )
|
||||
|
@ -373,10 +373,6 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||
|
||||
mpich_typeub();
|
||||
mpich_typeub2();
|
||||
mpich_typeub3();
|
||||
|
||||
printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" );
|
||||
rc = test_upper( length );
|
||||
if( rc == 0 )
|
||||
|
@ -14,6 +14,8 @@
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -531,10 +533,6 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||
|
||||
mpich_typeub();
|
||||
mpich_typeub2();
|
||||
mpich_typeub3();
|
||||
|
||||
printf( "\n\n#\n * TEST UPPER MATRIX\n#\n\n" );
|
||||
rc = test_upper( length );
|
||||
if( rc == 0 )
|
||||
|
@ -635,236 +635,3 @@ opal_datatype_t* test_contiguous( void )
|
||||
}
|
||||
|
||||
|
||||
|
||||
int mpich_typeub( void )
|
||||
{
|
||||
int errs = 0;
|
||||
ptrdiff_t extent, lb, extent1, extent2, extent3;
|
||||
ptrdiff_t displ[2];
|
||||
int blens[2];
|
||||
opal_datatype_t *type1, *type2, *type3, *types[2];
|
||||
|
||||
opal_datatype_create_vector( 2, 1, 4, &opal_datatype_int4, &type1 );
|
||||
opal_datatype_commit( type1 );
|
||||
opal_datatype_get_extent( type1, &lb, &extent );
|
||||
extent1 = 5 * sizeof(int);
|
||||
if (extent != extent1) {
|
||||
printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1);
|
||||
errs++;
|
||||
printf("extent(type1)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
blens[0] = 1;
|
||||
blens[1] = 1;
|
||||
displ[0] = 0;
|
||||
displ[1] = sizeof(int)*4;
|
||||
types[0] = type1;
|
||||
types[1] = (opal_datatype_t*)&opal_datatype_ub;
|
||||
extent2 = displ[1];
|
||||
|
||||
/* using MPI_UB and Type_struct, monkey with the extent, making it 16
|
||||
*/
|
||||
opal_datatype_create_struct( 2, blens, displ, types, &type2 );
|
||||
opal_datatype_commit( type2 );
|
||||
opal_datatype_get_extent( type2, &lb, &extent );
|
||||
if (extent != extent2) {
|
||||
printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2);
|
||||
errs++;
|
||||
printf("extent(type2)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
/* monkey with the extent again, making it 4
|
||||
* ===> MPICH gives 4
|
||||
* ===> MPIF gives 16, the old extent
|
||||
*/
|
||||
displ[1] = sizeof(int);
|
||||
types[0] = type2;
|
||||
types[1] = (opal_datatype_t*)&opal_datatype_ub;
|
||||
extent3 = extent2;
|
||||
|
||||
opal_datatype_create_struct( 2, blens, displ, types, &type3 );
|
||||
opal_datatype_commit( type3 );
|
||||
|
||||
opal_datatype_get_extent( type3, &lb, &extent );
|
||||
if (extent != extent3) {
|
||||
printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3);
|
||||
errs++;
|
||||
printf("extent(type3)=%ld\n",(long)extent);
|
||||
}
|
||||
|
||||
OBJ_RELEASE( type1 ); /*assert( type1 == NULL );*/
|
||||
OBJ_RELEASE( type2 ); /*assert( type2 == NULL );*/
|
||||
OBJ_RELEASE( type3 ); assert( type3 == NULL );
|
||||
return errs;
|
||||
}
|
||||
|
||||
int mpich_typeub2( void )
|
||||
{
|
||||
int blocklen[3], err = 0;
|
||||
size_t sz1, sz2, sz3;
|
||||
ptrdiff_t disp[3], lb, ub, ex1, ex2, ex3;
|
||||
opal_datatype_t *types[3], *dt1, *dt2, *dt3;
|
||||
|
||||
blocklen[0] = 1;
|
||||
blocklen[1] = 1;
|
||||
blocklen[2] = 1;
|
||||
disp[0] = -3;
|
||||
disp[1] = 0;
|
||||
disp[2] = 6;
|
||||
types[0] = (opal_datatype_t*)&opal_datatype_lb;
|
||||
types[1] = (opal_datatype_t*)&opal_datatype_int4;
|
||||
types[2] = (opal_datatype_t*)&opal_datatype_ub;
|
||||
|
||||
opal_datatype_create_struct(3, blocklen, disp, types, &dt1);
|
||||
opal_datatype_commit( dt1 );
|
||||
|
||||
opal_datatype_type_lb(dt1, &lb); opal_datatype_type_ub(dt1, &ub);
|
||||
opal_datatype_type_extent(dt1,&ex1); opal_datatype_type_size(dt1,&sz1);
|
||||
|
||||
/* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */
|
||||
if (lb != -3 || ub != 6 || ex1 != 9) {
|
||||
printf("Example 3.26 type1 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex1, (int)sz1);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf("Example 3.26 type1 correct\n" );
|
||||
|
||||
opal_datatype_create_contiguous(2, dt1, &dt2);
|
||||
opal_datatype_type_lb(dt2, &lb); opal_datatype_type_ub(dt2, &ub);
|
||||
opal_datatype_type_extent(dt2,&ex2); opal_datatype_type_size(dt2,&sz2);
|
||||
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
|
||||
if (lb != -3 || ub != 15 || ex2 != 18) {
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf("Example 3.26 type1 correct\n" );
|
||||
OBJ_RELEASE( dt2 ); assert( dt2 == NULL );
|
||||
opal_datatype_create_contiguous(2,dt1,&dt2);
|
||||
opal_datatype_type_lb(dt2, &lb); opal_datatype_type_ub(dt2, &ub);
|
||||
opal_datatype_type_extent(dt2,&ex2); opal_datatype_type_size(dt2,&sz2);
|
||||
/* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */
|
||||
if (lb != -3 || ub != 15 || ex2 != 18) {
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "Example 3.26 type2 correct\n" );
|
||||
|
||||
types[0]=dt1; types[1]=dt1;
|
||||
blocklen[0]=1; blocklen[1]=1;
|
||||
disp[0]=0; disp[1]=ex1;
|
||||
|
||||
opal_datatype_create_struct(2, blocklen, disp, types, &dt3);
|
||||
opal_datatype_commit( dt3 );
|
||||
|
||||
opal_datatype_type_lb(dt3, &lb); opal_datatype_type_ub(dt3, &ub);
|
||||
opal_datatype_type_extent(dt3,&ex3); opal_datatype_type_size(dt3,&sz3);
|
||||
/* Another way to express type2 */
|
||||
if (lb != -3 || ub != 15 || ex3 != 18) {
|
||||
printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8);
|
||||
printf("type3 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex3, (int)sz2);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "type3 correct\n" );
|
||||
|
||||
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
|
||||
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
|
||||
OBJ_RELEASE( dt3 ); assert( dt3 == NULL );
|
||||
return err;
|
||||
}
|
||||
|
||||
int mpich_typeub3( void )
|
||||
{
|
||||
int blocklen[3], err = 0, idisp[3];
|
||||
size_t sz;
|
||||
ptrdiff_t disp[3], lb, ub, ex;
|
||||
opal_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5;
|
||||
|
||||
/* Create a datatype with explicit LB and UB */
|
||||
blocklen[0] = 1;
|
||||
blocklen[1] = 1;
|
||||
blocklen[2] = 1;
|
||||
disp[0] = -3;
|
||||
disp[1] = 0;
|
||||
disp[2] = 6;
|
||||
types[0] = (opal_datatype_t*)&opal_datatype_lb;
|
||||
types[1] = (opal_datatype_t*)&opal_datatype_int4;
|
||||
types[2] = (opal_datatype_t*)&opal_datatype_ub;
|
||||
|
||||
/* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */
|
||||
opal_datatype_create_struct(3, blocklen, disp, types, &dt1);
|
||||
opal_datatype_commit( dt1 );
|
||||
|
||||
/* This type is the same as in typeub2, and is tested there */
|
||||
types[0]=dt1; types[1]=dt1;
|
||||
blocklen[0]=1; blocklen[1]=1;
|
||||
disp[0]=-4; disp[1]=7;
|
||||
idisp[0]=-4; idisp[1]=7;
|
||||
|
||||
opal_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 );
|
||||
opal_datatype_commit( dt2 );
|
||||
|
||||
opal_datatype_type_lb( dt2, &lb ); opal_datatype_type_ub( dt2, &ub );
|
||||
opal_datatype_type_extent( dt2, &ex ); opal_datatype_type_size( dt2, &sz );
|
||||
|
||||
if (lb != -7 || ub != 13 || ex != 20) {
|
||||
printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz);
|
||||
printf("hindexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "hindexed ok\n" );
|
||||
|
||||
opal_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 );
|
||||
opal_datatype_commit( dt3 );
|
||||
|
||||
opal_datatype_type_lb( dt3, &lb ); opal_datatype_type_ub( dt3, &ub );
|
||||
opal_datatype_type_extent( dt3, &ex ); opal_datatype_type_size( dt3, &sz );
|
||||
|
||||
if (lb != -39 || ub != 69 || ex != 108) {
|
||||
printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz);
|
||||
printf("indexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "indexed ok\n" );
|
||||
|
||||
opal_datatype_create_hvector( 2, 1, 14, dt1, &dt4 );
|
||||
opal_datatype_commit( dt4 );
|
||||
|
||||
opal_datatype_type_lb( dt4, &lb ); opal_datatype_type_ub( dt4, &ub );
|
||||
opal_datatype_type_extent( dt4, &ex ); opal_datatype_type_size( dt4, &sz );
|
||||
|
||||
if (lb != -3 || ub != 20 || ex != 23) {
|
||||
printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz);
|
||||
printf("hvector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "hvector ok\n" );
|
||||
|
||||
opal_datatype_create_vector( 2, 1, 14, dt1, &dt5 );
|
||||
opal_datatype_commit( dt5 );
|
||||
|
||||
opal_datatype_type_lb( dt5, &lb ); opal_datatype_type_ub( dt5, &ub );
|
||||
opal_datatype_type_extent( dt5, &ex ); opal_datatype_type_size( dt5, &sz );
|
||||
|
||||
if (lb != -3 || ub != 132 || ex != 135) {
|
||||
printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz);
|
||||
printf("vector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf( "vector ok\n" );
|
||||
|
||||
OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/
|
||||
OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/
|
||||
OBJ_RELEASE( dt3 ); /*assert( dt3 == NULL );*/
|
||||
OBJ_RELEASE( dt4 ); /*assert( dt4 == NULL );*/
|
||||
OBJ_RELEASE( dt5 ); assert( dt5 == NULL );
|
||||
return err;
|
||||
}
|
||||
|
@ -48,10 +48,6 @@ extern opal_datatype_t* test_create_blacs_type( void );
|
||||
extern opal_datatype_t* test_create_blacs_type1( opal_datatype_t const * const base_type );
|
||||
extern opal_datatype_t* test_create_blacs_type2( opal_datatype_t const * const base_type );
|
||||
|
||||
extern int mpich_typeub( void );
|
||||
extern int mpich_typeub2( void );
|
||||
extern int mpich_typeub3( void );
|
||||
|
||||
extern opal_datatype_t* create_struct_constant_gap_resized_ddt( const opal_datatype_t* type );
|
||||
|
||||
#endif /* TEST_OPAL_DDT_LIB_H */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user