One more test (struct containing a char followed by a double).
Modification to match the new prototypes and remove all warnings. This commit was SVN r5486.
Этот коммит содержится в:
родитель
72502a5d17
Коммит
9b090e7e71
@ -446,21 +446,43 @@ ompi_datatype_t* test_matrix_borders( unsigned int size, unsigned int width )
|
|||||||
|
|
||||||
ompi_datatype_t* test_contiguous( void )
|
ompi_datatype_t* test_contiguous( void )
|
||||||
{
|
{
|
||||||
ompi_datatype_t *pdt, *pdt1, *pdt2;
|
ompi_datatype_t *pdt, *pdt1, *pdt2;
|
||||||
|
|
||||||
printf( "test contiguous (alignement)\n" );
|
printf( "test contiguous (alignement)\n" );
|
||||||
pdt1 = ompi_ddt_create( -1 );
|
pdt1 = ompi_ddt_create( -1 );
|
||||||
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_DOUBLE], 1, 0, -1 );
|
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_DOUBLE], 1, 0, -1 );
|
||||||
ompi_ddt_dump( pdt1 );
|
ompi_ddt_dump( pdt1 );
|
||||||
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_CHAR], 1, 8, -1 );
|
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_CHAR], 1, 8, -1 );
|
||||||
ompi_ddt_dump( pdt1 );
|
ompi_ddt_dump( pdt1 );
|
||||||
ompi_ddt_create_contiguous( 4, pdt1, &pdt2 );
|
ompi_ddt_create_contiguous( 4, pdt1, &pdt2 );
|
||||||
OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/
|
OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/
|
||||||
ompi_ddt_dump( pdt2 );
|
ompi_ddt_dump( pdt2 );
|
||||||
ompi_ddt_create_contiguous( 2, pdt2, &pdt );
|
ompi_ddt_create_contiguous( 2, pdt2, &pdt );
|
||||||
OBJ_RELEASE( pdt2 ); /*assert( pdt2 == NULL );*/
|
OBJ_RELEASE( pdt2 ); /*assert( pdt2 == NULL );*/
|
||||||
ompi_ddt_dump( pdt );
|
ompi_ddt_dump( pdt );
|
||||||
return pdt;
|
return pdt;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct __struct_char_double {
|
||||||
|
char c;
|
||||||
|
double d;
|
||||||
|
} char_double_t;
|
||||||
|
|
||||||
|
ompi_datatype_t* test_struct_char_double( void )
|
||||||
|
{
|
||||||
|
char_double_t data;
|
||||||
|
int lengths[] = {1, 1};
|
||||||
|
long displ[] = {0, 0};
|
||||||
|
ompi_datatype_t *pdt;
|
||||||
|
ompi_datatype_t* types[] = { &ompi_mpi_char, &ompi_mpi_double };
|
||||||
|
|
||||||
|
displ[0] = (char*)&(data.c) - (char*)&(data);
|
||||||
|
displ[1] = (char*)&(data.d) - (char*)&(data);
|
||||||
|
|
||||||
|
ompi_ddt_create_struct( 2, lengths, displ, types, &pdt );
|
||||||
|
ompi_ddt_commit( &pdt );
|
||||||
|
ompi_ddt_dump( pdt );
|
||||||
|
return pdt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ompi_datatype_t* test_struct( void )
|
ompi_datatype_t* test_struct( void )
|
||||||
@ -468,34 +490,34 @@ ompi_datatype_t* test_struct( void )
|
|||||||
ompi_datatype_t* types[] = { &ompi_mpi_float /* ompi_ddt_basicDatatypes[DT_FLOAT] */,
|
ompi_datatype_t* types[] = { &ompi_mpi_float /* ompi_ddt_basicDatatypes[DT_FLOAT] */,
|
||||||
NULL,
|
NULL,
|
||||||
&ompi_mpi_char /* ompi_ddt_basicDatatypes[DT_CHAR] */ };
|
&ompi_mpi_char /* ompi_ddt_basicDatatypes[DT_CHAR] */ };
|
||||||
int lengths[] = { 2, 1, 3 };
|
int lengths[] = { 2, 1, 3 };
|
||||||
long disp[] = { 0, 16, 26 };
|
long disp[] = { 0, 16, 26 };
|
||||||
ompi_datatype_t* pdt, *pdt1;
|
ompi_datatype_t* pdt, *pdt1;
|
||||||
|
|
||||||
printf( "test struct\n" );
|
printf( "test struct\n" );
|
||||||
pdt1 = ompi_ddt_create( -1 );
|
pdt1 = ompi_ddt_create( -1 );
|
||||||
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_DOUBLE], 1, 0, -1 );
|
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_DOUBLE], 1, 0, -1 );
|
||||||
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_CHAR], 1, 8, -1 );
|
ompi_ddt_add( pdt1, ompi_ddt_basicDatatypes[DT_CHAR], 1, 8, -1 );
|
||||||
ompi_ddt_dump( pdt1 );
|
ompi_ddt_dump( pdt1 );
|
||||||
|
|
||||||
types[1] = pdt1;
|
types[1] = pdt1;
|
||||||
|
|
||||||
ompi_ddt_create_struct( 3, lengths, disp, types, &pdt );
|
ompi_ddt_create_struct( 3, lengths, disp, types, &pdt );
|
||||||
OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/
|
OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/
|
||||||
ompi_ddt_dump( pdt );
|
ompi_ddt_dump( pdt );
|
||||||
return pdt;
|
return pdt;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int i1;
|
int i1;
|
||||||
int gap;
|
int gap;
|
||||||
int i2;
|
int i2;
|
||||||
} sdata_intern;
|
} sdata_intern;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int counter;
|
int counter;
|
||||||
sdata_intern v[10];
|
sdata_intern v[10];
|
||||||
int last;
|
int last;
|
||||||
} sstrange;
|
} sstrange;
|
||||||
|
|
||||||
#define SSTRANGE_CNT 10
|
#define SSTRANGE_CNT 10
|
||||||
@ -575,7 +597,7 @@ int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk )
|
|||||||
ompi_convertor_t *pSendConvertor = NULL, *pRecvConvertor = NULL;
|
ompi_convertor_t *pSendConvertor = NULL, *pRecvConvertor = NULL;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
uint32_t iov_count, max_data;
|
uint32_t iov_count, max_data;
|
||||||
int32_t free_after = 0, length = 0, done1, done2;
|
int32_t free_after = 0, length = 0, done1 = 0, done2 = 0;
|
||||||
|
|
||||||
ompi_ddt_type_extent( pdt, &extent );
|
ompi_ddt_type_extent( pdt, &extent );
|
||||||
|
|
||||||
@ -595,21 +617,30 @@ int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk )
|
|||||||
}
|
}
|
||||||
|
|
||||||
while( (done1 & done2) != 1 ) {
|
while( (done1 & done2) != 1 ) {
|
||||||
|
/* They are supposed to finish in exactly the same time. */
|
||||||
|
if( done1 | done2 ) {
|
||||||
|
printf( "WRONG !!! the send is %d but the receive is %d\n", done1, done2 );
|
||||||
|
}
|
||||||
|
|
||||||
max_data = chunk;
|
max_data = chunk;
|
||||||
iov_count = 1;
|
iov_count = 1;
|
||||||
iov.iov_base = ptemp;
|
iov.iov_base = ptemp;
|
||||||
iov.iov_len = chunk;
|
iov.iov_len = chunk;
|
||||||
|
|
||||||
done1 = ompi_convertor_pack( pSendConvertor, &iov, &iov_count, &max_data, &free_after );
|
if( done1 == 0 ) {
|
||||||
assert( free_after == 0 );
|
done1 = ompi_convertor_pack( pSendConvertor, &iov, &iov_count, &max_data, &free_after );
|
||||||
if( 1 == done1 ) {
|
assert( free_after == 0 );
|
||||||
printf( "pack finished\n" );
|
if( 1 == done1 ) {
|
||||||
|
printf( "pack finished\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
done2 = ompi_convertor_unpack( pRecvConvertor, &iov, &iov_count, &max_data, &free_after );
|
if( done2 == 0 ) {
|
||||||
assert( free_after == 0 );
|
done2 = ompi_convertor_unpack( pRecvConvertor, &iov, &iov_count, &max_data, &free_after );
|
||||||
if( 1 == done2 ) {
|
assert( free_after == 0 );
|
||||||
printf( "unpack finished\n" );
|
if( 1 == done2 ) {
|
||||||
|
printf( "unpack finished\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
length += max_data;
|
length += max_data;
|
||||||
@ -635,10 +666,10 @@ int main( int argc, char* argv[] )
|
|||||||
|
|
||||||
ompi_ddt_init();
|
ompi_ddt_init();
|
||||||
|
|
||||||
/*pdt = create_strange_dt();
|
pdt = create_strange_dt();
|
||||||
local_copy_ddt_count(pdt, 1);
|
local_copy_ddt_count(pdt, 1);
|
||||||
local_copy_with_convertor(pdt, 1, 4008);
|
local_copy_with_convertor(pdt, 1, 4008);
|
||||||
OBJ_RELEASE( pdt ); assert( pdt == NULL );*/
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
pdt = upper_matrix(100);
|
pdt = upper_matrix(100);
|
||||||
local_copy_ddt_count(pdt, 1);
|
local_copy_ddt_count(pdt, 1);
|
||||||
@ -690,6 +721,10 @@ int main( int argc, char* argv[] )
|
|||||||
OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL );
|
OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL );
|
||||||
OBJ_RELEASE( pdt3 ); /*assert( pdt3 == NULL );*/
|
OBJ_RELEASE( pdt3 ); /*assert( pdt3 == NULL );*/
|
||||||
|
|
||||||
|
pdt = test_struct_char_double();
|
||||||
|
local_copy_with_convertor( pdt, 4500, 12 );
|
||||||
|
OBJ_RELEASE( pdt ); assert( pdt == NULL );
|
||||||
|
|
||||||
/* clean-ups all data allocations */
|
/* clean-ups all data allocations */
|
||||||
ompi_ddt_finalize();
|
ompi_ddt_finalize();
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user