Add tests for vector type.
Этот коммит содержится в:
родитель
fb6ecdfd18
Коммит
ee3d1ed5fd
@ -56,9 +56,9 @@ static int test_upper( unsigned int length )
|
|||||||
TIMER_DATA_TYPE start, end;
|
TIMER_DATA_TYPE start, end;
|
||||||
long total_time;
|
long total_time;
|
||||||
|
|
||||||
printf( "test upper matrix\n" );
|
/*printf( "test upper matrix\n" );*/
|
||||||
pdt = upper_matrix( length );
|
pdt = upper_matrix( length );
|
||||||
opal_datatype_dump( pdt );
|
/*opal_datatype_dump( pdt );*/
|
||||||
|
|
||||||
mat1 = malloc( length * length * sizeof(double) );
|
mat1 = malloc( length * length * sizeof(double) );
|
||||||
init_random_upper_matrix( length, mat1 );
|
init_random_upper_matrix( length, mat1 );
|
||||||
@ -346,15 +346,15 @@ int main( int argc, char* argv[] )
|
|||||||
* By default simulate homogeneous architectures.
|
* By default simulate homogeneous architectures.
|
||||||
*/
|
*/
|
||||||
remote_arch = opal_local_arch;
|
remote_arch = opal_local_arch;
|
||||||
printf( "\n\n#\n * TEST CREATE CONTIGUOUS\n #\n\n" );
|
printf( "\n\n#\n * TEST CREATE CONTIGUOUS\n#\n\n" );
|
||||||
pdt = create_contiguous_type( &opal_datatype_int1, 10 );
|
pdt = create_contiguous_type( &opal_datatype_int1, 10 );
|
||||||
if( outputFlags & CHECK_PACK_UNPACK ) {
|
if( outputFlags & CHECK_PACK_UNPACK ) {
|
||||||
local_copy_ddt_count(pdt, 100);
|
local_copy_ddt_count(pdt, 100);
|
||||||
local_copy_with_convertor(pdt, 100, 956);
|
local_copy_with_convertor(pdt, 100, 956);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
printf( "\n\n#\n * TEST STRANGE DATATYPE\n #\n\n" );
|
|
||||||
|
printf( "\n\n#\n * TEST STRANGE DATATYPE\n#\n\n" );
|
||||||
pdt = create_strange_dt();
|
pdt = create_strange_dt();
|
||||||
if( outputFlags & CHECK_PACK_UNPACK ) {
|
if( outputFlags & CHECK_PACK_UNPACK ) {
|
||||||
local_copy_ddt_count(pdt, 1);
|
local_copy_ddt_count(pdt, 1);
|
||||||
@ -362,27 +362,34 @@ int main( int argc, char* argv[] )
|
|||||||
}
|
}
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
|
printf( "\n\n#\n * TEST UPPER TRIANGULAR MATRIX (size 100)\n#\n\n" );
|
||||||
printf( "\n\n#\n * TEST UPPER TRIANGULAR MATRIX (size 100)\n #\n\n" );
|
|
||||||
pdt = upper_matrix(100);
|
pdt = upper_matrix(100);
|
||||||
if( outputFlags & CHECK_PACK_UNPACK ) {
|
if( outputFlags & CHECK_PACK_UNPACK ) {
|
||||||
local_copy_ddt_count(pdt, 1);
|
local_copy_ddt_count(pdt, 1);
|
||||||
local_copy_with_convertor(pdt, 1, 48);
|
local_copy_with_convertor(pdt, 1, 48);
|
||||||
}
|
}
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
|
printf( "\n\n#\n * TEST CREATE STRUCT CONSTANT GAP RESIZED\n#\n\n" );
|
||||||
|
pdt = create_struct_constant_gap_resized_ddt();
|
||||||
|
if( outputFlags & CHECK_PACK_UNPACK ) {
|
||||||
|
local_copy_ddt_count(pdt, 10000);
|
||||||
|
local_copy_with_convertor(pdt, 10000, 956);
|
||||||
|
}
|
||||||
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
mpich_typeub();
|
mpich_typeub();
|
||||||
mpich_typeub2();
|
mpich_typeub2();
|
||||||
mpich_typeub3();
|
mpich_typeub3();
|
||||||
|
|
||||||
printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" );
|
printf( "\n\n#\n * TEST UPPER MATRIX\n#\n\n" );
|
||||||
rc = test_upper( length );
|
rc = test_upper( length );
|
||||||
if( rc == 0 )
|
if( rc == 0 )
|
||||||
printf( "decode [PASSED]\n" );
|
printf( "decode [PASSED]\n" );
|
||||||
else
|
else
|
||||||
printf( "decode [NOT PASSED]\n" );
|
printf( "decode [NOT PASSED]\n" );
|
||||||
|
|
||||||
printf( "\n\n#\n * TEST MATRIX BORDERS\n #\n\n" );
|
printf( "\n\n#\n * TEST MATRIX BORDERS\n#\n\n" );
|
||||||
pdt = test_matrix_borders( length, 100 );
|
pdt = test_matrix_borders( length, 100 );
|
||||||
if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
|
if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
|
||||||
opal_datatype_dump( pdt );
|
opal_datatype_dump( pdt );
|
||||||
@ -390,10 +397,10 @@ int main( int argc, char* argv[] )
|
|||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
|
|
||||||
printf( "\n\n#\n * TEST CONTIGUOUS\n #\n\n" );
|
printf( "\n\n#\n * TEST CONTIGUOUS\n#\n\n" );
|
||||||
pdt = test_contiguous();
|
pdt = test_contiguous();
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
printf( "\n\n#\n * TEST STRUCT\n #\n\n" );
|
printf( "\n\n#\n * TEST STRUCT\n#\n\n" );
|
||||||
pdt = test_struct();
|
pdt = test_struct();
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
|
@ -253,6 +253,27 @@ opal_datatype_t* create_contiguous_type( const opal_datatype_t* type, int length
|
|||||||
return newtype;
|
return newtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a non-contiguous resized datatype */
|
||||||
|
struct structure {
|
||||||
|
double not_transfered;
|
||||||
|
double transfered_1;
|
||||||
|
double transfered_2;
|
||||||
|
};
|
||||||
|
|
||||||
|
opal_datatype_t* create_struct_constant_gap_resized_ddt( void )
|
||||||
|
{
|
||||||
|
opal_datatype_t *struct_type;
|
||||||
|
|
||||||
|
opal_datatype_create_contiguous(0, &opal_datatype_empty, &struct_type);
|
||||||
|
opal_datatype_add( struct_type, &opal_datatype_float8, 1, 8, -1 );
|
||||||
|
opal_datatype_add( struct_type, &opal_datatype_float8, 1, 16, -1 );
|
||||||
|
|
||||||
|
opal_datatype_resize(struct_type, 0, sizeof(struct structure));
|
||||||
|
opal_datatype_commit(struct_type);
|
||||||
|
|
||||||
|
return struct_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Copied Function to get test to work */
|
/* Copied Function to get test to work */
|
||||||
|
@ -49,4 +49,6 @@ extern int mpich_typeub( void );
|
|||||||
extern int mpich_typeub2( void );
|
extern int mpich_typeub2( void );
|
||||||
extern int mpich_typeub3( void );
|
extern int mpich_typeub3( void );
|
||||||
|
|
||||||
|
extern opal_datatype_t* create_struct_constant_gap_resized_ddt( void );
|
||||||
|
|
||||||
#endif /* TEST_OPAL_DDT_LIB_H */
|
#endif /* TEST_OPAL_DDT_LIB_H */
|
||||||
|
@ -23,6 +23,37 @@ extern void ompi_datatype_dump( MPI_Datatype ddt );
|
|||||||
#define MPI_DDT_DUMP(ddt)
|
#define MPI_DDT_DUMP(ddt)
|
||||||
#endif /* OPEN_MPI */
|
#endif /* OPEN_MPI */
|
||||||
|
|
||||||
|
/* Create a non-contiguous resized datatype */
|
||||||
|
struct structure {
|
||||||
|
double not_transfered;
|
||||||
|
double transfered_1;
|
||||||
|
double transfered_2;
|
||||||
|
};
|
||||||
|
|
||||||
|
static MPI_Datatype
|
||||||
|
create_struct_constant_gap_resized_ddt( int number, /* number of repetitions */
|
||||||
|
int contig_size, /* IGNORED: number of elements in a contiguous chunk */
|
||||||
|
int gap_size ) /* IGNORED: number of elements in a gap */
|
||||||
|
{
|
||||||
|
struct structure *data;
|
||||||
|
MPI_Datatype struct_type, temp_type;
|
||||||
|
MPI_Datatype types[2] = {MPI_DOUBLE, MPI_DOUBLE};
|
||||||
|
int blocklens[2] = {1, 1};
|
||||||
|
MPI_Aint disps[3];
|
||||||
|
|
||||||
|
MPI_Get_address(&data[0].transfered_1, &disps[0]);
|
||||||
|
MPI_Get_address(&data[0].transfered_2, &disps[1]);
|
||||||
|
MPI_Get_address(&data[0], &disps[2]);
|
||||||
|
disps[1] -= disps[2]; /* 8 */
|
||||||
|
disps[0] -= disps[2]; /* 16 */
|
||||||
|
|
||||||
|
MPI_Type_create_struct(2, blocklens, disps, types, &temp_type);
|
||||||
|
MPI_Type_create_resized(temp_type, 0, sizeof(data[0]), &struct_type);
|
||||||
|
MPI_Type_commit(&struct_type);
|
||||||
|
|
||||||
|
return struct_type;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a datatype similar to the one use by HPL */
|
/* Create a datatype similar to the one use by HPL */
|
||||||
static MPI_Datatype
|
static MPI_Datatype
|
||||||
create_indexed_constant_gap_ddt( int number, /* number of repetitions */
|
create_indexed_constant_gap_ddt( int number, /* number of repetitions */
|
||||||
@ -328,17 +359,18 @@ static int do_test_for_ddt( MPI_Datatype sddt, MPI_Datatype rddt, int length )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DO_CONTIG 0x01
|
#define DO_CONTIG 0x01
|
||||||
#define DO_CONSTANT_GAP 0x02
|
#define DO_CONSTANT_GAP 0x02
|
||||||
#define DO_INDEXED_GAP 0x04
|
#define DO_INDEXED_GAP 0x04
|
||||||
#define DO_OPTIMIZED_INDEXED_GAP 0x08
|
#define DO_OPTIMIZED_INDEXED_GAP 0x08
|
||||||
|
#define DO_STRUCT_CONSTANT_GAP_RESIZED 0x10
|
||||||
|
|
||||||
int main( int argc, char* argv[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
int length = 1024 * 1024;
|
int length = 111;
|
||||||
int rank, size;
|
int rank, size;
|
||||||
MPI_Datatype ddt;
|
MPI_Datatype ddt;
|
||||||
int run_tests = DO_CONTIG | DO_CONSTANT_GAP | DO_INDEXED_GAP | DO_OPTIMIZED_INDEXED_GAP;
|
int run_tests = 0xffffffff; /* do all tests by default */
|
||||||
/*int run_tests = DO_CONSTANT_GAP;*/
|
/*int run_tests = DO_CONSTANT_GAP;*/
|
||||||
|
|
||||||
MPI_Init (&argc, &argv);
|
MPI_Init (&argc, &argv);
|
||||||
@ -388,6 +420,14 @@ int main( int argc, char* argv[] )
|
|||||||
MPI_Type_free( &ddt );
|
MPI_Type_free( &ddt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( run_tests & DO_STRUCT_CONSTANT_GAP_RESIZED ) {
|
||||||
|
printf( "\nstruct constant gap resized\n\n" );
|
||||||
|
ddt = create_struct_constant_gap_resized_ddt( 80, 0 /* unused */, 0 /* unused */ );
|
||||||
|
MPI_DDT_DUMP( ddt );
|
||||||
|
do_test_for_ddt( ddt, ddt, length );
|
||||||
|
MPI_Type_free( &ddt );
|
||||||
|
}
|
||||||
|
|
||||||
MPI_Finalize ();
|
MPI_Finalize ();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user