diff --git a/src/datatype/datatype.h b/src/datatype/datatype.h index 125e9ef551..d3f61b6ba2 100644 --- a/src/datatype/datatype.h +++ b/src/datatype/datatype.h @@ -21,62 +21,11 @@ #include "lfc/lam_hash_table.h" #include "mpi.h" -#define DT_LOOP 0x00 -#define DT_END_LOOP 0x01 -#define DT_LB 0x02 -#define DT_UB 0x03 -#define DT_CHAR 0x04 -#define DT_CHARACTER 0x05 -#define DT_UNSIGNED_CHAR 0x06 -#define DT_BYTE 0x07 -#define DT_SHORT 0x08 -#define DT_UNSIGNED_SHORT 0x09 -#define DT_INT 0x0A -#define DT_UNSIGNED_INT 0x0B -#define DT_LONG 0x0C -#define DT_UNSIGNED_LONG 0x0D -#define DT_LONG_LONG 0x0E -#define DT_LONG_LONG_INT 0x0F -#define DT_UNSIGNED_LONG_LONG 0x10 -#define DT_FLOAT 0x11 -#define DT_DOUBLE 0x12 -#define DT_LONG_DOUBLE 0x13 -#define DT_COMPLEX_FLOAT 0x14 -#define DT_COMPLEX_DOUBLE 0x15 -#define DT_PACKED 0x16 -#define DT_LOGIC 0x17 -#define DT_FLOAT_INT 0x18 -#define DT_DOUBLE_INT 0x19 -#define DT_LONG_INT 0x1A -#define DT_2INT 0x1B -#define DT_SHORT_INT 0x1C -#define DT_INTEGER 0x1D -#define DT_REAL 0x1E -#define DT_DBLPREC 0x1F -#define DT_2REAL 0x20 -#define DT_2DBLPREC 0x21 -#define DT_2INTEGER 0x22 -#define DT_LONGDBL_INT 0x23 -#define DT_WCHAR 0x24 - /* if there are more basic datatypes than the number of bytes in the int type * the bdt_used field of the data description struct should be changed to long. */ #define DT_MAX_PREDEFINED 0x25 -/* flags for the datatypes. */ -#define DT_FLAG_DESTROYED 0x0001 /**< user destroyed but some other layers still have a reference */ -#define DT_FLAG_COMMITED 0x0002 /**< ready to be used for a send/recv operation */ -#define DT_FLAG_CONTIGUOUS 0x0004 /**< contiguous datatype */ -#define DT_FLAG_OVERLAP 0x0008 /**< datatype is unpropper for a recv operation */ -#define DT_FLAG_USER_LB 0x0010 /**< has a user defined LB */ -#define DT_FLAG_USER_UB 0x0020 /**< has a user defined UB */ -#define DT_FLAG_FOREVER 0x0040 /**< cannot be removed: initial and predefined datatypes */ -#define DT_FLAG_IN_LOOP 0x0080 /**< we are inside a loop */ -#define DT_FLAG_INITIAL 0x0100 /**< one of the initial datatype */ -#define DT_FLAG_DATA 0x0200 /**< data or control structure */ -#define DT_FLAG_BASIC (DT_FLAG_INITIAL | DT_FLAG_COMMITED | DT_FLAG_FOREVER | DT_FLAG_CONTIGUOUS) - #define DT_INCREASE_STACK 32 /* the basic element. A data description is composed @@ -128,20 +77,6 @@ typedef struct lam_datatype_t { OBJ_CLASS_DECLARATION( lam_datatype_t ); -typedef struct __dt_stack { - int index; - int count; - int end_loop; - long disp; -} dt_stack_t; - -typedef struct __dt_convert { - char* buf; - unsigned int length; - dt_stack_t* pStack; - dt_desc_t* pDesc; -} dt_convert_t; - int lam_ddt_init( void ); int lam_ddt_finalize( void ); dt_desc_t* lam_ddt_create( int expectedSize ); @@ -201,16 +136,7 @@ typedef int (*conversion_fct_t)( unsigned int count, void* to, unsigned int in_length, long to_extent, unsigned int* used ); -/* keep the last 16 bits free for data flags */ -#define CONVERTOR_USELESS 0x00010000 -#define CONVERTOR_RECV 0x00020000 -#define CONVERTOR_SEND 0x00040000 - -#define CONVERTOR_STATE_MASK 0xFF000000 -#define CONVERTOR_STATE_START 0x01000000 -#define CONVEROTR_STATE_COMPLETE 0x02000000 -#define CONVERTOR_STATE_ALLOC 0x04000000 - +typedef struct __dt_stack dt_stack_t; typedef struct lam_convertor_t lam_convertor_t; typedef int (*convertor_advance_fct_t)( lam_convertor_t* pConvertor, struct iovec* pInputv, @@ -254,8 +180,8 @@ int lam_convertor_init_for_recv( lam_convertor_t* pConv, unsigned int flags, int lam_convertor_need_buffers( lam_convertor_t* pConvertor ); int lam_convertor_pack( lam_convertor_t* pConv, struct iovec* in, unsigned int in_size ); int lam_convertor_unpack( lam_convertor_t* pConv, struct iovec* out, unsigned int out_size ); -int lam_convertor_get_packed_size( lam_convertor_t* pConv, unsigned int* pSize ); -int lam_convertor_get_unpacked_size( lam_convertor_t* pConv, unsigned int* pSize ); +int lam_convertor_get_packed_size( lam_convertor_t* pConv, int* pSize ); +int lam_convertor_get_unpacked_size( lam_convertor_t* pConv, int* pSize ); int lam_create_stack_with_pos( lam_convertor_t* pConv, int local_starting_point, int* local_sizes ); diff --git a/src/datatype/datatype_internal.h b/src/datatype/datatype_internal.h index afd94018fb..d90d55fb9e 100644 --- a/src/datatype/datatype_internal.h +++ b/src/datatype/datatype_internal.h @@ -28,6 +28,77 @@ # endif /* __GNUC__ */ #endif /* VERBOSE */ +#define DT_LOOP 0x00 +#define DT_END_LOOP 0x01 +#define DT_LB 0x02 +#define DT_UB 0x03 +#define DT_CHAR 0x04 +#define DT_CHARACTER 0x05 +#define DT_UNSIGNED_CHAR 0x06 +#define DT_BYTE 0x07 +#define DT_SHORT 0x08 +#define DT_UNSIGNED_SHORT 0x09 +#define DT_INT 0x0A +#define DT_UNSIGNED_INT 0x0B +#define DT_LONG 0x0C +#define DT_UNSIGNED_LONG 0x0D +#define DT_LONG_LONG 0x0E +#define DT_LONG_LONG_INT 0x0F +#define DT_UNSIGNED_LONG_LONG 0x10 +#define DT_FLOAT 0x11 +#define DT_DOUBLE 0x12 +#define DT_LONG_DOUBLE 0x13 +#define DT_COMPLEX_FLOAT 0x14 +#define DT_COMPLEX_DOUBLE 0x15 +#define DT_PACKED 0x16 +#define DT_LOGIC 0x17 +#define DT_FLOAT_INT 0x18 +#define DT_DOUBLE_INT 0x19 +#define DT_LONG_INT 0x1A +#define DT_2INT 0x1B +#define DT_SHORT_INT 0x1C +#define DT_INTEGER 0x1D +#define DT_REAL 0x1E +#define DT_DBLPREC 0x1F +#define DT_2REAL 0x20 +#define DT_2DBLPREC 0x21 +#define DT_2INTEGER 0x22 +#define DT_LONGDBL_INT 0x23 +#define DT_WCHAR 0x24 +/* If the number of basic datatype should change update DT_MAX_PREDEFINED in datatype.h */ + +/* flags for the datatypes. */ +#define DT_FLAG_DESTROYED 0x0001 /**< user destroyed but some other layers still have a reference */ +#define DT_FLAG_COMMITED 0x0002 /**< ready to be used for a send/recv operation */ +#define DT_FLAG_CONTIGUOUS 0x0004 /**< contiguous datatype */ +#define DT_FLAG_OVERLAP 0x0008 /**< datatype is unpropper for a recv operation */ +#define DT_FLAG_USER_LB 0x0010 /**< has a user defined LB */ +#define DT_FLAG_USER_UB 0x0020 /**< has a user defined UB */ +#define DT_FLAG_FOREVER 0x0040 /**< cannot be removed: initial and predefined datatypes */ +#define DT_FLAG_IN_LOOP 0x0080 /**< we are inside a loop */ +#define DT_FLAG_INITIAL 0x0100 /**< one of the initial datatype */ +#define DT_FLAG_DATA 0x0200 /**< data or control structure */ +#define DT_FLAG_BASIC (DT_FLAG_INITIAL | DT_FLAG_COMMITED | DT_FLAG_FOREVER | DT_FLAG_CONTIGUOUS) + +#define DT_INCREASE_STACK 32 + +struct __dt_stack { + int index; + int count; + int end_loop; + long disp; +}; + +/* keep the last 16 bits free for data flags */ +#define CONVERTOR_USELESS 0x00010000 +#define CONVERTOR_RECV 0x00020000 +#define CONVERTOR_SEND 0x00040000 + +#define CONVERTOR_STATE_MASK 0xFF000000 +#define CONVERTOR_STATE_START 0x01000000 +#define CONVEROTR_STATE_COMPLETE 0x02000000 +#define CONVERTOR_STATE_ALLOC 0x04000000 + typedef struct { float r; float i; diff --git a/src/datatype/dt_create.c b/src/datatype/dt_create.c index 5d658fd95c..6951d81131 100644 --- a/src/datatype/dt_create.c +++ b/src/datatype/dt_create.c @@ -118,7 +118,7 @@ void lam_ddt_dump( 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 (", - pData, pData->size, pData->align, pData->id, pData->desc.length, pData->desc.used, + (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 ); @@ -161,16 +161,16 @@ void lam_ddt_dump( dt_desc_t* data ) 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, complex_float_t ); -DUMP_TYPE( complex_double, complex_double_t ); +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, complex_float_t ) +DUMP_TYPE( complex_double, complex_double_t ) static lam_convertor_t* pDumpConv = NULL; @@ -200,7 +200,7 @@ void lam_ddt_dump_complete( 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 (", - pData, pData->size, pData->align, pData->id, pData->desc.length, pData->desc.used, + (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 ); diff --git a/src/datatype/dt_destroy.c b/src/datatype/dt_destroy.c index 0ce8eed15f..6e577a8aa8 100644 --- a/src/datatype/dt_destroy.c +++ b/src/datatype/dt_destroy.c @@ -1,6 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ #include "datatype.h" +#include "datatype_internal.h" /* This function should never be called directly. It's called by the dt_decrease_ref * when the number of references on the data reach ZERO. diff --git a/src/datatype/dt_pack.c b/src/datatype/dt_pack.c index 727037e5f5..81ed652709 100644 --- a/src/datatype/dt_pack.c +++ b/src/datatype/dt_pack.c @@ -489,7 +489,7 @@ lam_convertor_t* lam_convertor_get_copy( lam_convertor_t* pConvertor ) } /* Actually we suppose that we can only do receiver side conversion */ -int lam_convertor_get_packed_size( lam_convertor_t* pConv, unsigned int* pSize ) +int lam_convertor_get_packed_size( lam_convertor_t* pConv, int* pSize ) { if( lam_ddt_type_size( pConv->pDesc, pSize ) != 0 ) return -1; @@ -498,7 +498,7 @@ int lam_convertor_get_packed_size( lam_convertor_t* pConv, unsigned int* pSize ) return 0; } -int lam_convertor_get_unpacked_size( lam_convertor_t* pConv, unsigned int* pSize ) +int lam_convertor_get_unpacked_size( lam_convertor_t* pConv, int* pSize ) { int i; dt_desc_t* pData = pConv->pDesc; diff --git a/src/datatype/dt_unpack.c b/src/datatype/dt_unpack.c index d9dee7fea8..48550d0832 100644 --- a/src/datatype/dt_unpack.c +++ b/src/datatype/dt_unpack.c @@ -10,7 +10,7 @@ static int convertor_unpack_general( lam_convertor_t* pConvertor, void dump_stack( dt_stack_t* pStack, int stack_pos, dt_elem_desc_t* pDesc, char* name ) { - printf( "\nStack %p stack_pos %d name %s\n", pStack, stack_pos, name ); + printf( "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name ); for( ;stack_pos >= 0; stack_pos-- ) { printf( "%d: pos %d count %d disp %ld end_loop %d ", stack_pos, pStack[stack_pos].index, pStack[stack_pos].count, pStack[stack_pos].disp, pStack[stack_pos].end_loop ); @@ -351,16 +351,16 @@ static int copy_##TYPENAME( unsigned int count, \ return res * count; \ } -COPY_TYPE( char, char ); -COPY_TYPE( short, short ); -COPY_TYPE( int, int ); -COPY_TYPE( float, float ); -COPY_TYPE( long, long ); +COPY_TYPE( char, char ) +COPY_TYPE( short, short ) +COPY_TYPE( int, int ) +COPY_TYPE( float, float ) +COPY_TYPE( long, long ) /*COPY_TYPE( double, double );*/ -COPY_TYPE( long_long, long long ); -COPY_TYPE( long_double, long double ); -COPY_TYPE( complex_float, complex_float_t ); -COPY_TYPE( complex_double, complex_double_t ); +COPY_TYPE( long_long, long long ) +COPY_TYPE( long_double, long double ) +COPY_TYPE( complex_float, complex_float_t ) +COPY_TYPE( complex_double, complex_double_t ) static int copy_double( unsigned int count, char* from, unsigned int from_len, long from_extent,