1
1

- Move all dumping functions in dt_module.c. Now we are able to free the fake convertor used to

dump the datatype contents.
- Rewrite the macros DECLARE_MPI2_COMPOSED_STRUCT_DDT and  DECLARE_MPI2_COMPOSED_BLOCK_DDT used to instantiate
some predefined MPI datatypes to allow them to overwrite the statically allocated basic datatype. (I know it's ugly
but it work).
- Add a new macro COPY_DATA_DESC who can copy a data description and flags from one datatype to another.

This commit was SVN r1087.
Этот коммит содержится в:
George Bosilca 2004-04-27 17:57:52 +00:00
родитель b9a0e941b4
Коммит 9a9bf88781

Просмотреть файл

@ -5,7 +5,7 @@
/* other fields starting after bdt_used (index of DT_LOOP should be ONE) */
#define EMPTY_DATA(NAME) NULL, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define BASEOBJ_DATA { OBJ_CLASS(lam_object_t), 1 }
#define BASEOBJ_DATA { OBJ_CLASS(lam_datatype_t), 1 }
#define INIT_BASIC_DATA( TYPE, ALIGN, NAME ) \
{ BASEOBJ_DATA, sizeof(TYPE), 0, sizeof(TYPE), ALIGN, \
0, sizeof(TYPE), DT_FLAG_BASIC | DT_FLAG_DATA, DT_##NAME, 1, \
@ -15,7 +15,7 @@
0, 0, DT_FLAG_BASIC, DT_##NAME, 1, \
(((long long)1)<<(DT_##NAME)), EMPTY_DATA(NAME) }
dt_desc_t basicDatatypes[DT_MAX_PREDEFINED] = {
lam_datatype_t basicDatatypes[DT_MAX_PREDEFINED] = {
INIT_BASIC_TYPE( DT_LOOP, LOOP ),
INIT_BASIC_TYPE( DT_END_LOOP, END_LOOP ),
INIT_BASIC_TYPE( DT_LB, LB ),
@ -30,18 +30,34 @@ dt_desc_t basicDatatypes[DT_MAX_PREDEFINED] = {
INIT_BASIC_DATA( unsigned int, LAM_ALIGNMENT_INT, UNSIGNED_INT ),
INIT_BASIC_DATA( long, LAM_ALIGNMENT_LONG, LONG ),
INIT_BASIC_DATA( unsigned long, LAM_ALIGNMENT_LONG, UNSIGNED_LONG ),
#if HAVE_LONG_LONG
INIT_BASIC_DATA( long long, LAM_ALIGNMENT_LONG_LONG, LONG_LONG ),
INIT_BASIC_DATA( long long, LAM_ALIGNMENT_LONG_LONG, LONG_LONG_INT ),
INIT_BASIC_DATA( unsigned long long, LAM_ALIGNMENT_LONG_LONG, UNSIGNED_LONG_LONG ),
#else
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
#endif /* HAVE_LONG_LONG */
INIT_BASIC_DATA( float, LAM_ALIGNMENT_FLOAT, FLOAT ),
INIT_BASIC_DATA( double, LAM_ALIGNMENT_DOUBLE, DOUBLE ),
INIT_BASIC_DATA( long double, LAM_ALIGNMENT_LONG_DOUBLE, LONG_DOUBLE ),
INIT_BASIC_DATA( lam_complex_float_t, LAM_ALIGNMENT_FLOAT, COMPLEX_FLOAT ),
INIT_BASIC_DATA( lam_complex_double_t, LAM_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE ),
#if HAVE_LONG_DOUBLE
INIT_BASIC_DATA( lam_complex_long_double_t, LAM_ALIGNMENT_LONG_DOUBLE, COMPLEX_LONG_DOUBLE ),
#else
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
#endif /* HAVE_LONG_DOUBLE */
INIT_BASIC_DATA( char, LAM_ALIGNMENT_CHAR, PACKED ),
INIT_BASIC_DATA( int, LAM_ALIGNMENT_INT, LOGIC ),
INIT_BASIC_TYPE( DT_FLOAT_INT, FLOAT_INT ),
INIT_BASIC_TYPE( DT_DOUBLE_INT, DOUBLE_INT ),
#if HAVE_LONG_DOUBLE
INIT_BASIC_TYPE( DT_LONG_DOUBLE_INT, LONG_DOUBLE_INT ),
#else
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
#endif /* HAVE_LONG_DOUBLE */
INIT_BASIC_TYPE( DT_LONG_INT, LONG_INT ),
INIT_BASIC_TYPE( DT_2INT, 2INT ),
INIT_BASIC_TYPE( DT_SHORT_INT, SHORT_INT ),
@ -51,8 +67,15 @@ dt_desc_t basicDatatypes[DT_MAX_PREDEFINED] = {
INIT_BASIC_TYPE( DT_2REAL, 2REAL ),
INIT_BASIC_TYPE( DT_2DBLPREC, 2DBLPREC ),
INIT_BASIC_TYPE( DT_2INTEGER, 2INTEGER ),
#if HAVE_LONG_DOUBLE
INIT_BASIC_TYPE( DT_LONGDBL_INT, LONGDBL_INT ),
INIT_BASIC_TYPE( DT_WCHAR, WCHAR )
#else
INIT_BASIC_DATA( void*, 0, UNAVAILABLE ),
#endif /* HAVE_LONG_DOUBLE */
INIT_BASIC_TYPE( DT_WCHAR, WCHAR ),
INIT_BASIC_TYPE( DT_2COMPLEX, 2COMPLEX ),
INIT_BASIC_TYPE( DT_2DOUBLE_COMPLEX, 2DOUBLE_COMPLEX ),
INIT_BASIC_TYPE( DT_UNAVAILABLE, UNAVAILABLE )
};
lam_datatype_t* lam_mpi_char = basicDatatypes + DT_CHAR;
@ -87,61 +110,86 @@ lam_datatype_t* lam_mpi_2dblprec = basicDatatypes + DT_2DBLPREC;
lam_datatype_t* lam_mpi_2integer = basicDatatypes + DT_2INTEGER;
lam_datatype_t* lam_mpi_longdbl_int = basicDatatypes + DT_LONGDBL_INT;
lam_datatype_t* lam_mpi_wchar = basicDatatypes + DT_WCHAR;
#if HAVE_LONG_LONG
lam_datatype_t* lam_mpi_long_long_int = basicDatatypes + DT_LONG_LONG_INT;
lam_datatype_t* lam_mpi_long_long = basicDatatypes + DT_LONG_LONG;
lam_datatype_t* lam_mpi_unsigned_long_long = basicDatatypes + DT_UNSIGNED_LONG_LONG;
#else
lam_datatype_t* lam_mpi_long_long_int = NULL;
lam_datatype_t* lam_mpi_long_long = NULL;
lam_datatype_t* lam_mpi_unsigned_long_long = NULL;
#endif /* HAVE_LONG_LONG */
lam_datatype_t* lam_mpi_cxx_cplex = basicDatatypes + DT_COMPLEX_FLOAT;
lam_datatype_t* lam_mpi_cxx_dblcplex = basicDatatypes + DT_COMPLEX_DOUBLE;
lam_datatype_t* lam_mpi_cxx_ldblcplex;
lam_datatype_t* lam_mpi_cxx_ldblcplex = basicDatatypes + DT_COMPLEX_LONG_DOUBLE;
lam_datatype_t* lam_mpi_cxx_bool;
lam_datatype_t* lam_mpi_2cplex = basicDatatypes + DT_2COMPLEX;
lam_datatype_t* lam_mpi_2dblcplex = basicDatatypes + DT_2DOUBLE_COMPLEX;
int local_sizes[DT_MAX_PREDEFINED];
#define DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPIDDT, type1, type2, MPIType1, MPIType2 ) \
do { \
struct { type1 v1; type2 v2; } s[2]; \
dt_id_t types[2]; \
dt_desc_t* pData; \
int bLength[2] = {1, 1}; \
MPI_Aint base, displ[2]; \
\
types[0] = _data_ids[MPIType1]; \
types[1] = _data_ids[MPIType2]; \
base = (MPI_Aint)(&(s[0])); \
displ[0] = (MPI_Aint)(&(s[0].v1)); \
displ[0] -= base; \
displ[1] = (MPI_Aint)(&(s[0].v2)); \
displ[1] -= base; \
\
dt_create_struct( 2, bLength, displ, types, &pData ); \
displ[0] = (MPI_Aint)(&(s[1])); \
displ[0] -= base; \
if( displ[0] != sizeof(s[0]) ) \
pData->ub = displ[0]; /* force a new extent for the datatype */ \
pData->flags |= DT_FLAG_FOREVER; \
pData->name = #MPIDDT; \
dt_commit( &pData ); \
_data_ids[MPIDDT] = pData; \
pData->id = MPIDDT; \
} while(0);
static lam_convertor_t* pDumpConv = NULL;
#define COPY_DATA_DESC( PDST, PSRC ) \
do { \
(PDST)->size = (PSRC)->size; \
(PDST)->true_lb = (PSRC)->true_lb; \
(PDST)->true_ub = (PSRC)->true_ub; \
(PDST)->align = (PSRC)->align; \
(PDST)->lb = (PSRC)->lb; \
(PDST)->ub = (PSRC)->ub; \
(PDST)->flags = (PSRC)->flags; \
(PDST)->id = (PSRC)->id; \
(PDST)->nbElems = (PSRC)->nbElems; \
(PDST)->bdt_used = (PSRC)->bdt_used; \
if( (PDST)->desc.desc != NULL ) \
free( (PDST)->desc.desc ); \
(PDST)->desc = (PSRC)->desc; \
if( (PDST)->opt_desc.desc != NULL ) \
free( (PDST)->opt_desc.desc ); \
(PDST)->opt_desc = (PSRC)->opt_desc; \
memcpy( (PDST)->btypes, (PSRC)->btypes, \
DT_MAX_PREDEFINED * sizeof(u_int32_t) ); \
} while(0)
#define DECLARE_MPI2_COMPOSED_STRUCT_DDT( PDATA, MPIDDT, MPIDDTNAME, type1, type2, MPIType1, MPIType2 ) \
do { \
struct { type1 v1; type2 v2; } s[2]; \
lam_datatype_t *types[2], *ptype; \
int bLength[2] = {1, 1}; \
long base, displ[2]; \
\
types[0] = basicDatatypes + MPIType1; \
types[1] = basicDatatypes + MPIType2; \
base = (long)(&(s[0])); \
displ[0] = (long)(&(s[0].v1)); \
displ[0] -= base; \
displ[1] = (long)(&(s[0].v2)); \
displ[1] -= base; \
\
lam_ddt_create_struct( 2, bLength, displ, types, &ptype ); \
displ[0] = (long)(&(s[1])); \
displ[0] -= base; \
if( displ[0] != sizeof(s[0]) ) \
ptype->ub = displ[0]; /* force a new extent for the datatype */ \
ptype->flags |= DT_FLAG_FOREVER; \
ptype->id = MPIDDT; \
lam_ddt_commit( &ptype ); \
COPY_DATA_DESC( PDATA, ptype ); \
ptype->desc.desc = NULL; \
ptype->opt_desc.desc = NULL; \
OBJ_RELEASE( ptype ); \
strncpy( (PDATA)->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \
} while(0)
#define DECLARE_MPI2_COMPOSED_BLOCK_DDT( PDATA, MPIDDT, MPIDDTNAME, MPIType ) \
do { \
lam_datatype_t *ptype; \
lam_ddt_create_contiguous( 2, &(basicDatatypes[MPIType]), &ptype ); \
ptype->flags |= DT_FLAG_FOREVER; \
ptype->id = MPIDDT; \
lam_ddt_commit( &ptype ); \
COPY_DATA_DESC( PDATA, ptype ); \
ptype->desc.desc = NULL; \
ptype->opt_desc.desc = NULL; \
OBJ_RELEASE( ptype ); \
strncpy( PDATA->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \
} while(0)
#define DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPIDDT, MPIType ) \
do { \
dt_desc_t* pData; \
dt_create_contiguous( 2, _data_ids[MPIType], &pData ); \
pData->flags |= DT_FLAG_FOREVER; \
pData->name = #MPIDDT; \
dt_commit( &pData ); \
_data_ids[MPIDDT] = pData; \
pData->id = MPIDDT; \
} while(0)
int lam_ddt_init( void )
{
int i;
@ -158,25 +206,28 @@ int lam_ddt_init( void )
basicDatatypes[i].btypes[i] = 1;
}
#ifdef TOTO
/* the 2 complex datatypes (float and double) */
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_COMPLEX, float, float, MPI_FLOAT, MPI_FLOAT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_DOUBLE_COMPLEX, double, double, MPI_DOUBLE, MPI_DOUBLE );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_cplex, DT_COMPLEX_FLOAT, "MPI_COMPLEX", float, float, DT_FLOAT, DT_FLOAT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_dblcplex, DT_COMPLEX_DOUBLE, "MPI_DOUBLE_COMPLEX", double, double, DT_DOUBLE, DT_DOUBLE );
/* C++ complex types */
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_cxx_cplex, DT_COMPLEX_FLOAT, "MPI_CXX_COMPLEX", float, float, DT_FLOAT, DT_FLOAT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_cxx_dblcplex, DT_COMPLEX_DOUBLE, "MPI_CXX_DOUBLE_COMPLEX", double, double, DT_DOUBLE, DT_DOUBLE );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_cxx_ldblcplex, DT_COMPLEX_LONG_DOUBLE, "MPI_CXX_LONG_DOUBLE_COMPLEX", long double, long double, DT_LONG_DOUBLE, DT_LONG_DOUBLE );
/* Now the predefined MPI2 datatypes (they should last forever!) */
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_FLOAT_INT, float, int, MPI_FLOAT, MPI_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_DOUBLE_INT, double, int, MPI_DOUBLE, MPI_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_LONG_INT, long, int, MPI_LONG, MPI_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_SHORT_INT, short, int, MPI_SHORT, MPI_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( MPI_LONG_DOUBLE_INT, long double, int, MPI_LONG_DOUBLE, MPI_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_float_int, DT_FLOAT_INT, "MPI_FLOAT_INT", float, int, DT_FLOAT, DT_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_double_int, DT_DOUBLE_INT, "MPI_DOUBLE_INT", double, int, DT_DOUBLE, DT_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_long_int, DT_LONG_INT, "MPI_LONG_INT", long, int, DT_LONG, DT_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_short_int, DT_SHORT_INT, "MPI_SHORT_INT", short, int, DT_SHORT, DT_INT );
DECLARE_MPI2_COMPOSED_STRUCT_DDT( lam_mpi_longdbl_int, DT_LONG_DOUBLE_INT, "MPI_LONG_DOUBLE_INT", long double, int, DT_LONG_DOUBLE, DT_INT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2int, DT_2INT, "MPI_2INT", DT_INT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2integer, DT_2INTEGER, "MPI_2INTEGER", DT_INT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2real, DT_2REAL, "MPI_2REAL", DT_FLOAT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2dblprec, DT_2DBLPREC, "MPI_2DOUBLE_PRECISION", DT_DOUBLE );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2cplex, DT_2COMPLEX, "MPI_2COMPLEX", DT_COMPLEX_FLOAT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( lam_mpi_2dblcplex, DT_2DOUBLE_COMPLEX, "MPI_2DOUBLE_COMPLEX", DT_COMPLEX_DOUBLE );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2INT, MPI_INT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2REAL, MPI_FLOAT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2DOUBLE_PRECISION, MPI_DOUBLE );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2INTEGER, MPI_INT );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2COMPLEX, MPI_COMPLEX );
DECLARE_MPI2_COMPOSED_BLOCK_DDT( MPI_2DOUBLE_COMPLEX, MPI_DOUBLE_COMPLEX );
#endif /* TOTO */
for( i = 0; i < DT_MAX_PREDEFINED; i++ )
local_sizes[i] = basicDatatypes[i].size;
@ -187,28 +238,191 @@ int lam_ddt_finalize( void )
{
int i;
for( i =0; i < DT_MAX_PREDEFINED; i++ ) {
free( basicDatatypes[i].desc.desc );
basicDatatypes[i].desc.desc = NULL;
basicDatatypes[i].desc.length = 0;
basicDatatypes[i].desc.used = 0;
/* As they are statically allocated they cannot be released. But we
* can call OBJ_DESTRUCT, just to free all internally allocated ressources.
*/
for( i = 0; i < DT_MAX_PREDEFINED; i++ ) {
OBJ_DESTRUCT( &(basicDatatypes[i]) );
}
#ifdef TOTO
OBJ_RELEASE( _data_ids[MPI_COMPLEX] );
OBJ_RELEASE( _data_ids[MPI_DOUBLE_COMPLEX] );
OBJ_RELEASE( _data_ids[MPI_FLOAT_INT] );
OBJ_RELEASE( _data_ids[MPI_DOUBLE_INT] );
OBJ_RELEASE( _data_ids[MPI_LONG_INT] );
OBJ_RELEASE( _data_ids[MPI_SHORT_INT] );
OBJ_RELEASE( _data_ids[MPI_LONG_DOUBLE_INT] );
OBJ_RELEASE( _data_ids[MPI_2INT] );
OBJ_RELEASE( _data_ids[MPI_2REAL] );
OBJ_RELEASE( _data_ids[MPI_2DOUBLE_PRECISION] );
OBJ_RELEASE( _data_ids[MPI_2INTEGER] );
OBJ_RELEASE( _data_ids[MPI_2COMPLEX] );
OBJ_RELEASE( _data_ids[MPI_2DOUBLE_COMPLEX] );
#endif /* TOTO */
if( pDumpConv != NULL ) {
OBJ_RELEASE( pDumpConv );
}
return 0;
}
/********************************************************
* Data dumping functions
********************************************************/
static void _dump_data_flags( unsigned short usflags )
{
char flags[12] = "-----------";
if( usflags & DT_FLAG_DESTROYED ) flags[0] = 'd';
if( usflags & DT_FLAG_COMMITED ) flags[1] = 'c';
if( usflags & DT_FLAG_CONTIGUOUS ) flags[2] = 'C';
if( usflags & DT_FLAG_OVERLAP ) flags[3] = 'o';
if( usflags & DT_FLAG_USER_LB ) flags[4] = 'l';
if( usflags & DT_FLAG_USER_UB ) flags[5] = 'u';
if( usflags & DT_FLAG_FOREVER ) flags[6] = 'F';
if( usflags & DT_FLAG_IN_LOOP ) flags[7] = 'L';
if( usflags & DT_FLAG_DATA ) flags[8] = 'D';
if( usflags & DT_FLAG_INITIAL ) flags[9] = 'I';
if( (usflags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) flags[10] = 'B';
flags[11] = 0;
printf( "%s\t", flags );
}
static int __dump_data_desc( dt_elem_desc_t* pDesc, int nbElems )
{
int i;
for( i = 0; i < nbElems; i++ ) {
_dump_data_flags( pDesc->flags );
if( pDesc->type == DT_LOOP )
printf( "%15s %d times the next %d elements extent %d\n",
basicDatatypes[pDesc->type].name,
pDesc->count, (int)pDesc->disp, pDesc->extent );
else
printf( "%15s count %d disp 0x%lx (%ld) extent %d\n",
basicDatatypes[pDesc->type].name,
pDesc->count, pDesc->disp, pDesc->disp, pDesc->extent );
pDesc++;
}
return 0;
}
static void __dt_contain_basic_datatypes( dt_desc_t* pData )
{
int i, mask = 1;
if( pData->flags & DT_FLAG_USER_LB ) printf( "lb " );
if( pData->flags & DT_FLAG_USER_UB ) printf( "ub " );
for( i = 0; i < DT_MAX_PREDEFINED; i++ ) {
if( pData->bdt_used & mask )
printf( "%s ", basicDatatypes[i].name );
mask <<= 1;
}
}
void lam_ddt_dump( dt_desc_t* data )
{
dt_desc_t* pData = (dt_desc_t*)data;
printf( "Datatype %p size %d align %d id %d length %d used %d\n\
true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n\
nbElems %d loops %d flags %X (",
(void*)pData, pData->size, pData->align, pData->id, pData->desc.length, pData->desc.used,
pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb,
pData->lb, pData->ub, pData->ub - pData->lb,
pData->nbElems, pData->btypes[DT_LOOP], pData->flags );
/* dump the flags */
if( pData->flags == DT_FLAG_BASIC ) printf( "basic datatype " );
else {
if( pData->flags & DT_FLAG_DESTROYED ) printf( "destroyed " );
if( pData->flags & DT_FLAG_COMMITED ) printf( "commited " );
if( pData->flags & DT_FLAG_CONTIGUOUS) printf( "contiguous " );
}
printf( ")" ); _dump_data_flags( pData->flags );
printf( "\n contain " ); __dt_contain_basic_datatypes( pData ); printf( "\n" );
__dump_data_desc( pData->desc.desc, pData->desc.used );
if( pData->opt_desc.desc != NULL ) {
printf( "Optimized description \n" );
__dump_data_desc( pData->opt_desc.desc, pData->opt_desc.used );
}
}
#define DUMP_TYPE( TYPENAME, TYPE ) \
static int dump_##TYPENAME( unsigned int count, \
char* from, unsigned int from_len, long from_extent, \
char* to, unsigned int to_len, long to_extent, \
int* used ) \
{ \
int remote_type_size = sizeof(TYPE), res = 1; \
if( (remote_type_size * count) > from_len ) { \
count = from_len / remote_type_size; \
if( (count * remote_type_size) != from_len ) { \
printf( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
from_len - (count * remote_type_size) ); \
res = -1; \
} \
printf( "correct: %s count %d from %p with length %d to %p space %d\n", \
#TYPE, count, from, from_len, to, to_len ); \
} else \
printf( " %s count %d from %p with length %d to %p space %d\n", \
#TYPE, count, from, from_len, to, to_len ); \
\
*used = count * to_extent; \
return res * count; \
}
DUMP_TYPE( char, char )
DUMP_TYPE( short, short )
DUMP_TYPE( int, int )
DUMP_TYPE( float, float )
DUMP_TYPE( long, long )
DUMP_TYPE( double, double )
DUMP_TYPE( long_long, long long )
DUMP_TYPE( long_double, long double )
DUMP_TYPE( complex_float, lam_complex_float_t )
DUMP_TYPE( complex_double, lam_complex_double_t )
static conversion_fct_t dump_functions[DT_MAX_PREDEFINED] = {
(conversion_fct_t)NULL, /* DT_LOOP */
(conversion_fct_t)NULL, /* DT_LB */
(conversion_fct_t)NULL, /* DT_UB */
(conversion_fct_t)NULL, /* DT_SPACE */
(conversion_fct_t)dump_char, /* DT_CHAR */
(conversion_fct_t)dump_char, /* DT_BYTE */
(conversion_fct_t)dump_short, /* DT_SHORT */
(conversion_fct_t)dump_int, /* DT_INT */
(conversion_fct_t)dump_float, /* DT_FLOAT */
(conversion_fct_t)dump_long, /* DT_LONG */
(conversion_fct_t)dump_double, /* DT_DOUBLE */
(conversion_fct_t)dump_long_long, /* DT_LONG_LONG */
(conversion_fct_t)dump_long_double, /* DT_LONG_DOUBLE */
(conversion_fct_t)dump_complex_float, /* DT_COMPLEX_FLOAT */
(conversion_fct_t)dump_complex_double, /* DT_COMPLEX_DOUBLE */
};
void lam_ddt_dump_complete( dt_desc_t* data )
{
dt_desc_t* pData = (dt_desc_t*)data;
struct iovec fake = { (void*)0, 0 };
printf( "Datatype %p size %d align %d id %d length %d used %d\n\
true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n\
nbElems %d loops %d flags %X (",
(void*)pData, pData->size, pData->align, pData->id, pData->desc.length, pData->desc.used,
pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb,
pData->lb, pData->ub, pData->ub - pData->lb,
pData->nbElems, pData->btypes[DT_LOOP], pData->flags );
/* dump the flags */
if( pData->flags == DT_FLAG_BASIC ) printf( "basic datatype " );
else {
if( pData->flags & DT_FLAG_DESTROYED ) printf( "destroyed " );
if( pData->flags & DT_FLAG_COMMITED ) printf( "commited " );
if( pData->flags & DT_FLAG_CONTIGUOUS) printf( "contiguous " );
if( pData->flags & DT_FLAG_OVERLAP ) printf( "overlap " );
}
printf( ")\n contain " ); __dt_contain_basic_datatypes( pData );
printf( "\n{\n" );
if( pDumpConv == NULL ) {
pDumpConv = lam_convertor_create( 0, 0 );
}
lam_convertor_init_for_recv( pDumpConv, 0, pData, 1, NULL, 0 );
pDumpConv->pFunctions = dump_functions;
fake.iov_len = pData->size;
lam_convertor_unpack( pDumpConv, &fake, 1 );
/* As this convertor wii be here forever (at least until the end of the
* application, we should release the ddt pointer and free the stack.
*/
OBJ_RELEASE( pData );
pDumpConv->pDesc = NULL;
free( pDumpConv->pStack );
pDumpConv->pStack = NULL;
printf( "}\n" );
}