diff --git a/ompi/datatype/datatype.h b/ompi/datatype/datatype.h index f6e6974a6b..761654e314 100644 --- a/ompi/datatype/datatype.h +++ b/ompi/datatype/datatype.h @@ -59,10 +59,12 @@ OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_datatype_f_to_c_table; #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_PREDEFINED 0x0040 /**< cannot be removed: initial and predefined datatypes */ -#define DT_FLAG_IN_LOOP 0x0080 /**< we are inside a loop */ +#define DT_FLAG_NO_GAPS 0x0080 /**< we are inside a loop */ #define DT_FLAG_DATA 0x0100 /**< data or control structure */ #define DT_FLAG_ONE_SIDED 0x0200 /**< datatype can be used for one sided operations */ -#define DT_FLAG_UNAVAILABLE 0x0400 /**< datatypes unavailable on thie build (OS or compiler dependant) */ +#define DT_FLAG_UNAVAILABLE 0x0400 /**< datatypes unavailable on the build (OS or compiler dependant) */ +#define DT_FLAG_VECTOR 0x0800 /**< valid only for loops. The loop contain only one element + **< without extent. It correspond to the vector type. */ /* Keep trace of the type of the predefined datatypes */ #define DT_FLAG_DATA_INT 0x1000 #define DT_FLAG_DATA_FLOAT 0x2000 @@ -78,7 +80,7 @@ OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_datatype_f_to_c_table; * We should make the difference here between the predefined contiguous and non contiguous * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes. */ -#define DT_FLAG_BASIC (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_DATA | DT_FLAG_COMMITED) +#define DT_FLAG_BASIC (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED) typedef union dt_elem_desc dt_elem_desc_t; diff --git a/ompi/datatype/dt_add.c b/ompi/datatype/dt_add.c index 5ef6513c49..924ca93964 100644 --- a/ompi/datatype/dt_add.c +++ b/ompi/datatype/dt_add.c @@ -23,7 +23,8 @@ /* macros to play with the flags */ #define SET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (DT_FLAG_CONTIGUOUS) -#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(DT_FLAG_CONTIGUOUS)) +#define SET_NO_GAP_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (DT_FLAG_NO_GAPS) +#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS)) #if defined(__GNUC__) && !defined(__STDC__) #define LMAX(A,B) ({ long _a = (A), _b = (B); (_a < _b ? _b : _a) }) @@ -259,7 +260,6 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, pLoop = pLast; CREATE_LOOP_START( pLast, count, (long)pdtAdd->desc.used + 1, extent, (pdtAdd->flags & ~(DT_FLAG_COMMITED)) ); - localFlags = DT_FLAG_IN_LOOP; pdtBase->btypes[DT_LOOP] += 2; pdtBase->desc.used += 2; pLast++; @@ -267,7 +267,6 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, for( i = 0; i < pdtAdd->desc.used; i++ ) { pLast->elem = pdtAdd->desc.desc[i].elem; - pLast->elem.common.flags |= localFlags; if( DT_FLAG_DATA & pLast->elem.common.flags ) pLast->elem.disp += disp; else if( DT_END_LOOP == pLast->elem.common.type ) { @@ -302,9 +301,13 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * type have to match */ || (count < 2)) ) { /* - if the count is bigger than 2 */ SET_CONTIGUOUS_FLAG(pdtBase->flags); + if( ((long)pdtAdd->size) == extent ) + SET_NO_GAP_FLAG(pdtBase->flags); } } - + /* If the NO_GAP flag is set the contiguous have to be set too */ + if( pdtBase->flags & DT_FLAG_NO_GAPS ) + assert( pdtBase->flags & DT_FLAG_CONTIGUOUS ); pdtBase->nbElems += (count * pdtAdd->nbElems); return OMPI_SUCCESS; diff --git a/ompi/datatype/dt_module.c b/ompi/datatype/dt_module.c index a245966b9c..be543fffce 100644 --- a/ompi/datatype/dt_module.c +++ b/ompi/datatype/dt_module.c @@ -654,7 +654,7 @@ static int _dump_data_flags( unsigned short usflags, char* ptr, size_t length ) if( usflags & DT_FLAG_USER_LB ) ptr[4] = 'l'; if( usflags & DT_FLAG_USER_UB ) ptr[5] = 'u'; if( usflags & DT_FLAG_PREDEFINED ) ptr[6] = 'P'; - if( usflags & DT_FLAG_IN_LOOP ) ptr[7] = 'L'; + if( !(usflags & DT_FLAG_NO_GAPS) ) ptr[7] = 'G'; if( usflags & DT_FLAG_DATA ) ptr[8] = 'D'; if( (usflags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) ptr[9] = 'B'; /* Which kind of datatype is that */