Bringing trunk in sync with the beta.
Split the datatypes in 3 categories: 1. basic datatypes: count always one and the datatype is always contiguous 2. complex datatypes composed on one basic type with a count. Most of the time these datatypes will be contiguous. 3. complex datatypes composed by 2 basic types. Depending on the architecture these types can be non contiguous. Reorder the defines to match the previous categories. Add some comment to describe the changes in the files. Clean-up the flags: - DT_FLAG_PREDEFINED is attached to all predefined datatypes. - DT_FLAG_CONTIGUOUS is attached to all contiguous one. This flag is detected at runtime depending on the architecture. This commit was SVN r5946.
Этот коммит содержится в:
родитель
e830442d04
Коммит
43876d080c
@ -59,12 +59,10 @@ OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_datatype_f_to_c_table;
|
||||
#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_PREDEFINED 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_ONE_SIDED 0x0400 /**< datatype can be used for one sided operations */
|
||||
#define DT_FLAG_BASIC (DT_FLAG_INITIAL | DT_FLAG_COMMITED | DT_FLAG_FOREVER | DT_FLAG_CONTIGUOUS)
|
||||
#define DT_FLAG_DATA 0x0100 /**< data or control structure */
|
||||
#define DT_FLAG_ONE_SIDED 0x0200 /**< datatype can be used for one sided operations */
|
||||
/* Keep trace of the type of the predefined datatypes */
|
||||
#define DT_FLAG_DATA_INT 0x1000
|
||||
#define DT_FLAG_DATA_FLOAT 0x2000
|
||||
@ -75,6 +73,11 @@ OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_datatype_f_to_c_table;
|
||||
#define DT_FLAG_DATA_CPP 0x8000
|
||||
#define DT_FLAG_DATA_FORTRAN 0xC000
|
||||
#define DT_FLAG_DATA_LANGUAGE 0xC000
|
||||
/*
|
||||
* 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)
|
||||
|
||||
typedef union dt_elem_desc dt_elem_desc_t;
|
||||
|
||||
|
@ -55,6 +55,16 @@ static inline void DUMP( char* fmt, ... )
|
||||
# endif /* ACCEPT_C99 */
|
||||
#endif /* VERBOSE */
|
||||
|
||||
/* There 3 types of predefined data types.
|
||||
* - the basic one composed by just one basic datatype which are definitively contiguous
|
||||
* - the derived ones where the same basic type is used multiple times. They should be most
|
||||
* of the time contiguous.
|
||||
* - and finally the derived one where multiple basic types are used. Depending on the architecture
|
||||
* they can be contiguous or not.
|
||||
*
|
||||
* At this level we do not care from which language the datatype came from (C, C++ or FORTRAN),
|
||||
* we only focus on their internal representation in the host memory.
|
||||
*/
|
||||
#define DT_LOOP 0x00
|
||||
#define DT_END_LOOP 0x01
|
||||
#define DT_LB 0x02
|
||||
@ -75,36 +85,46 @@ static inline void DUMP( char* fmt, ... )
|
||||
#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_COMPLEX_LONG_DOUBLE 0x16
|
||||
#define DT_PACKED 0x17
|
||||
#define DT_LOGIC 0x18
|
||||
#define DT_FLOAT_INT 0x19
|
||||
#define DT_DOUBLE_INT 0x1A
|
||||
#define DT_LONG_DOUBLE_INT 0x1B
|
||||
#define DT_LONG_INT 0x1C
|
||||
#define DT_2INT 0x1D
|
||||
#define DT_SHORT_INT 0x1E
|
||||
#define DT_INTEGER 0x1F
|
||||
#define DT_REAL 0x20
|
||||
#define DT_DBLPREC 0x21
|
||||
#define DT_2REAL 0x22
|
||||
#define DT_2DBLPREC 0x23
|
||||
#define DT_2INTEGER 0x24
|
||||
#define DT_WCHAR 0x25
|
||||
#define DT_2COMPLEX 0x26
|
||||
#define DT_2DOUBLE_COMPLEX 0x27
|
||||
#define DT_CXX_BOOL 0x28
|
||||
#define DT_PACKED 0x14
|
||||
#define DT_WCHAR 0x15
|
||||
#define DT_CXX_BOOL 0x16
|
||||
#define DT_LOGIC 0x17
|
||||
#define DT_INTEGER 0x18
|
||||
#define DT_REAL 0x19
|
||||
#define DT_DBLPREC 0x1A
|
||||
/*
|
||||
* This is not a datatype. It contain the number of basic datatypes.
|
||||
*/
|
||||
#define DT_MAX_BASIC 0x1B
|
||||
/*
|
||||
* Derived datatypes supposely contiguous
|
||||
*/
|
||||
#define DT_COMPLEX_FLOAT 0x1B
|
||||
#define DT_COMPLEX_DOUBLE 0x1C
|
||||
#define DT_COMPLEX_LONG_DOUBLE 0x1D
|
||||
#define DT_2INT 0x1E
|
||||
#define DT_2INTEGER 0x1F
|
||||
#define DT_2REAL 0x20
|
||||
#define DT_2DBLPREC 0x21
|
||||
#define DT_2COMPLEX 0x22
|
||||
#define DT_2DOUBLE_COMPLEX 0x23
|
||||
/*
|
||||
* Derived datatypes which will definitively be non contiguous on some architectures.
|
||||
*/
|
||||
#define DT_FLOAT_INT 0x24
|
||||
#define DT_DOUBLE_INT 0x25
|
||||
#define DT_LONG_DOUBLE_INT 0x26
|
||||
#define DT_LONG_INT 0x27
|
||||
#define DT_SHORT_INT 0x28
|
||||
#define DT_UNAVAILABLE 0x29
|
||||
/* If the number of basic datatype should change update
|
||||
* DT_MAX_PREDEFINED in datatype.h
|
||||
*/
|
||||
#if DT_MAX_PREDEFINED <= DT_UNAVAILABLE
|
||||
#error DT_MAX_PREDEFINED should be updated
|
||||
#error DT_MAX_PREDEFINED should be updated to the next value after the DT_UNAVAILABLE define
|
||||
#endif /* safe check for max predefined datatypes. */
|
||||
|
||||
#define DT_INCREASE_STACK 32
|
||||
#define DT_INCREASE_STACK 8
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
@ -86,7 +86,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
|
||||
/* first make sure that we have enought place to
|
||||
* put the new element inside */
|
||||
if( (pdtAdd->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) {
|
||||
if( pdtAdd->flags & DT_FLAG_PREDEFINED ) {
|
||||
/* handle special cases for DT_LB and DT_UB */
|
||||
if( pdtAdd == ompi_ddt_basicDatatypes[DT_LB] ) {
|
||||
pdtBase->bdt_used |= (1<< DT_LB);
|
||||
@ -200,10 +200,10 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
pdtBase->desc.length = newLength;
|
||||
}
|
||||
pLast = &(pdtBase->desc.desc[pdtBase->desc.used]);
|
||||
if( (pdtAdd->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) { /* add a basic datatype */
|
||||
if( pdtAdd->flags & DT_FLAG_PREDEFINED ) { /* add a basic datatype */
|
||||
pdtBase->btypes[pdtAdd->id] += count;
|
||||
if( (extent != (long)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */
|
||||
localFlags = pdtAdd->flags & ~(DT_FLAG_FOREVER | DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS);
|
||||
localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS);
|
||||
CREATE_LOOP_START( pLast, count, 2, extent, localFlags );
|
||||
pLast++;
|
||||
pLast->elem.common.type = pdtAdd->id;
|
||||
@ -222,7 +222,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
pLast->elem.disp = disp;
|
||||
pLast->elem.extent = extent;
|
||||
pdtBase->desc.used++;
|
||||
pLast->elem.common.flags = pdtAdd->flags & ~(DT_FLAG_FOREVER | DT_FLAG_COMMITED);
|
||||
pLast->elem.common.flags = pdtAdd->flags & ~(DT_FLAG_COMMITED);
|
||||
}
|
||||
} else {
|
||||
/* We handle a user defined datatype. We should make sure that the user will not have the
|
||||
@ -242,39 +242,39 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
if( pdtAdd->btypes[i] != 0 ) pdtBase->btypes[i] += (count * pdtAdd->btypes[i]);
|
||||
|
||||
if( (1 == pdtAdd->desc.used) && (extent == (pdtAdd->ub - pdtAdd->lb)) &&
|
||||
(extent == pdtAdd->desc.desc[0].elem.extent) ){
|
||||
pLast->elem = pdtAdd->desc.desc[0].elem;
|
||||
pLast->elem.count *= count;
|
||||
pLast->elem.disp += disp;
|
||||
pdtBase->desc.used++;
|
||||
} else {
|
||||
/* if the extent of the datatype if the same as the extent of the loop
|
||||
* description of the datatype then we simply have to update the main loop.
|
||||
*/
|
||||
if( count != 1 ) {
|
||||
pLoop = pLast;
|
||||
CREATE_LOOP_START( pLast, count, (long)pdtAdd->desc.used + 1, extent,
|
||||
(pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_FOREVER)) );
|
||||
localFlags = DT_FLAG_IN_LOOP;
|
||||
pdtBase->btypes[DT_LOOP] += 2;
|
||||
pdtBase->desc.used += 2;
|
||||
pLast++;
|
||||
}
|
||||
(extent == pdtAdd->desc.desc[0].elem.extent) ){
|
||||
pLast->elem = pdtAdd->desc.desc[0].elem;
|
||||
pLast->elem.count *= count;
|
||||
pLast->elem.disp += disp;
|
||||
pdtBase->desc.used++;
|
||||
} else {
|
||||
/* if the extent of the datatype if the same as the extent of the loop
|
||||
* description of the datatype then we simply have to update the main loop.
|
||||
*/
|
||||
if( count != 1 ) {
|
||||
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++;
|
||||
}
|
||||
|
||||
for( i = 0; i < pdtAdd->desc.used; i++ ) {
|
||||
pLast->elem = pdtAdd->desc.desc[i].elem;
|
||||
pLast->elem.common.flags |= localFlags;
|
||||
if( DT_FLAG_DATA & pdtAdd->desc.desc[i].elem.common.flags )
|
||||
pLast->elem.disp += disp;
|
||||
pLast++;
|
||||
}
|
||||
pdtBase->desc.used += pdtAdd->desc.used;
|
||||
if( pLoop != NULL ) {
|
||||
CREATE_LOOP_END( pLast, pdtAdd->desc.used + 1, true_ub - true_lb,
|
||||
pdtAdd->size, pLoop->loop.common.flags );
|
||||
for( i = 0; i < pdtAdd->desc.used; i++ ) {
|
||||
pLast->elem = pdtAdd->desc.desc[i].elem;
|
||||
pLast->elem.common.flags |= localFlags;
|
||||
if( DT_FLAG_DATA & pdtAdd->desc.desc[i].elem.common.flags )
|
||||
pLast->elem.disp += disp;
|
||||
pLast++;
|
||||
}
|
||||
pdtBase->desc.used += pdtAdd->desc.used;
|
||||
if( pLoop != NULL ) {
|
||||
CREATE_LOOP_END( pLast, pdtAdd->desc.used + 1, true_ub - true_lb,
|
||||
pdtAdd->size, pLoop->loop.common.flags );
|
||||
}
|
||||
}
|
||||
/* should I add some space until the extent of this datatype ? */
|
||||
}
|
||||
}
|
||||
|
||||
/* Is the data still contiguous ?
|
||||
|
@ -181,7 +181,7 @@ int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which,
|
||||
{
|
||||
ompi_ddt_args_t* pArgs = pData->args;
|
||||
|
||||
if( (pData->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) {
|
||||
if( pData->flags & DT_FLAG_PREDEFINED ) {
|
||||
switch(which){
|
||||
case 0:
|
||||
*ci = 0;
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
int32_t ompi_ddt_destroy( ompi_datatype_t** dt )
|
||||
{
|
||||
ompi_datatype_t* pData = *dt;
|
||||
ompi_datatype_t* pData = *dt;
|
||||
|
||||
if( pData->flags & DT_FLAG_FOREVER )
|
||||
return OMPI_ERROR;
|
||||
if( pData->flags & DT_FLAG_PREDEFINED )
|
||||
return OMPI_ERROR;
|
||||
|
||||
OBJ_RELEASE( pData );
|
||||
*dt = NULL;
|
||||
return OMPI_SUCCESS;
|
||||
OBJ_RELEASE( pData );
|
||||
*dt = NULL;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -28,28 +28,33 @@ int ompi_ddt_dfd = -1;
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
#define EMPTY_DATA(NAME) NULL, 0, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, ZERO_DDT_ARRAY
|
||||
#define BASEOBJ_DATA { OBJ_CLASS(ompi_datatype_t), 1 }
|
||||
#define INIT_BASIC_DATA( TYPE, ALIGN, NAME, FLAGS ) \
|
||||
{ BASEOBJ_DATA, sizeof(TYPE), ALIGN, 0, sizeof(TYPE), \
|
||||
0, sizeof(TYPE), DT_FLAG_BASIC | DT_FLAG_DATA | (FLAGS), DT_##NAME, 1, \
|
||||
(((unsigned long long)1)<<(DT_##NAME)), EMPTY_DATA(NAME) }
|
||||
|
||||
/* Using this macro implies that at this point not all informations needed
|
||||
* to fill up the datatype are known. We fill them with zeros and then later
|
||||
* when the datatype engine will be initialized we complete with the
|
||||
* correct information.
|
||||
* correct information. This macro should be used for all composed types.
|
||||
*/
|
||||
#define INIT_BASIC_TYPE( TYPE, NAME ) \
|
||||
{ BASEOBJ_DATA, 0/*size*/, 0 /*align*/, 0/*true_lb*/, 0/*true_ub*/, \
|
||||
0/*lb*/, 0/*ub*/, DT_FLAG_BASIC | DT_FLAG_DATA, TYPE, 1, \
|
||||
#define INIT_BASIC_TYPE( TYPE, NAME ) \
|
||||
{ BASEOBJ_DATA, 0/*size*/, 0 /*align*/, 0/*true_lb*/, 0/*true_ub*/, \
|
||||
0/*lb*/, 0/*ub*/, DT_FLAG_PREDEFINED, TYPE, 1, \
|
||||
(((unsigned long long)1)<<(TYPE)), EMPTY_DATA(NAME) }
|
||||
/* The upeer bound and the true UB are set to the size of the datatype.
|
||||
|
||||
|
||||
#define INIT_BASIC_DATA( TYPE, ALIGN, NAME, FLAGS ) \
|
||||
{ BASEOBJ_DATA, sizeof(TYPE), ALIGN, 0, sizeof(TYPE), \
|
||||
0, sizeof(TYPE), DT_FLAG_BASIC | (FLAGS), \
|
||||
DT_##NAME, 1, (((unsigned long long)1)<<(DT_##NAME)), EMPTY_DATA(NAME) }
|
||||
|
||||
/* The upper bound and the true UB are set to the size of the datatype.
|
||||
* If it's not the case then they should be modified in the initialization
|
||||
* function.
|
||||
*/
|
||||
#if OMPI_WANT_F77_BINDINGS
|
||||
#define INIT_BASIC_FORTRAN_TYPE( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
|
||||
{ BASEOBJ_DATA, SIZE, ALIGN, 0/*true_lb*/, SIZE/*true_ub*/, \
|
||||
0/*lb*/, SIZE/*ub*/, DT_FLAG_BASIC | DT_FLAG_DATA | DT_FLAG_DATA_FORTRAN | (FLAGS), (TYPE), 1, \
|
||||
(((unsigned long long)1)<<(TYPE)), EMPTY_DATA(NAME) }
|
||||
#define INIT_BASIC_FORTRAN_TYPE( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
|
||||
{ BASEOBJ_DATA, SIZE, ALIGN, 0/*true_lb*/, SIZE/*true_ub*/, \
|
||||
0/*lb*/, SIZE/*ub*/, \
|
||||
DT_FLAG_CONTIGUOUS | DT_FLAG_PREDEFINED | DT_FLAG_DATA | DT_FLAG_COMMITED | DT_FLAG_DATA_FORTRAN | (FLAGS), \
|
||||
(TYPE), 1, (((unsigned long long)1)<<(TYPE)), EMPTY_DATA(NAME) }
|
||||
#else
|
||||
#define INIT_BASIC_FORTRAN_TYPE( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
|
||||
INIT_BASIC_TYPE( TYPE, NAME )
|
||||
@ -57,7 +62,7 @@ int ompi_ddt_dfd = -1;
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_datatype_null =
|
||||
{ BASEOBJ_DATA, 0, 0, 0, 0,
|
||||
0, 0, DT_FLAG_BASIC, 0, 1,
|
||||
0, 0, DT_FLAG_PREDEFINED, 0, 1,
|
||||
((long long)0), EMPTY_DATA(DATATYPE_NULL) };
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_loop = INIT_BASIC_TYPE( DT_LOOP, LOOP );
|
||||
@ -85,17 +90,27 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_unsigned_long_long = INIT_BASIC_DATA( voi
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_float = INIT_BASIC_DATA( float, OMPI_ALIGNMENT_FLOAT, FLOAT, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_double = INIT_BASIC_DATA( double, OMPI_ALIGNMENT_DOUBLE, DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cplex = INIT_BASIC_DATA( ompi_complex_float_t, OMPI_ALIGNMENT_FLOAT, COMPLEX_FLOAT, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_dblcplex = INIT_BASIC_DATA( ompi_complex_double_t, OMPI_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
#if HAVE_LONG_DOUBLE
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_long_double = INIT_BASIC_DATA( long double, OMPI_ALIGNMENT_LONG_DOUBLE, LONG_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_ldblcplex = INIT_BASIC_DATA( ompi_complex_long_double_t, OMPI_ALIGNMENT_LONG_DOUBLE, COMPLEX_LONG_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_long_double = INIT_BASIC_DATA( void*, 0, UNAVAILABLE, 0 );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_ldblcplex = INIT_BASIC_DATA( void*, 0, UNAVAILABLE, 0 );
|
||||
#endif /* HAVE_LONG_DOUBLE */
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_packed = INIT_BASIC_DATA( char, OMPI_ALIGNMENT_CHAR, PACKED, 0 );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_wchar = INIT_BASIC_TYPE( DT_WCHAR, WCHAR );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_bool = INIT_BASIC_DATA( SIZEOF_BOOL, OMPI_ALIGNMENT_CXX_BOOL, CXX_BOOL, DT_FLAG_DATA_CPP );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logic = INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGIC, OMPI_SIZEOF_FORTRAN_LOGICAL, OMPI_ALIGNMENT_FORTRAN_LOGICAL, 0 );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_integer = INIT_BASIC_FORTRAN_TYPE( DT_INTEGER, INTEGER, OMPI_SIZEOF_FORTRAN_INTEGER, OMPI_ALIGNMENT_FORTRAN_INTEGER, DT_FLAG_DATA_INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real = INIT_BASIC_FORTRAN_TYPE( DT_REAL, REAL, OMPI_SIZEOF_FORTRAN_REAL, OMPI_ALIGNMENT_FORTRAN_REAL, DT_FLAG_DATA_FLOAT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_dblprec = INIT_BASIC_FORTRAN_TYPE( DT_DBLPREC, DBLPREC, OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION, OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION, DT_FLAG_DATA_FLOAT );
|
||||
|
||||
#if HAVE_LONG_DOUBLE
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_ldblcplex = INIT_BASIC_DATA( ompi_complex_long_double_t, OMPI_ALIGNMENT_LONG_DOUBLE, COMPLEX_LONG_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_ldblcplex = INIT_BASIC_DATA( void*, 0, UNAVAILABLE, 0 );
|
||||
#endif /* HAVE_LONG_DOUBLE */
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cplex = INIT_BASIC_DATA( ompi_complex_float_t, OMPI_ALIGNMENT_FLOAT, COMPLEX_FLOAT, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_dblcplex = INIT_BASIC_DATA( ompi_complex_double_t, OMPI_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_float_int = INIT_BASIC_TYPE( DT_FLOAT_INT, FLOAT_INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_double_int = INIT_BASIC_TYPE( DT_DOUBLE_INT, DOUBLE_INT );
|
||||
#if HAVE_LONG_DOUBLE
|
||||
@ -104,16 +119,13 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_longdbl_int = INIT_BASIC_TYPE( DT_LONG_DO
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_longdbl_int = INIT_BASIC_DATA( void*, 0, UNAVAILABLE, 0 );
|
||||
#endif /* HAVE_LONG_DOUBLE */
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_long_int = INIT_BASIC_TYPE( DT_LONG_INT, LONG_INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2int = INIT_BASIC_TYPE( DT_2INT, 2INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_short_int = INIT_BASIC_TYPE( DT_SHORT_INT, SHORT_INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_integer = INIT_BASIC_FORTRAN_TYPE( DT_INTEGER, INTEGER, OMPI_SIZEOF_FORTRAN_INTEGER, OMPI_ALIGNMENT_FORTRAN_INTEGER, DT_FLAG_DATA_INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real = INIT_BASIC_FORTRAN_TYPE( DT_REAL, REAL, OMPI_SIZEOF_FORTRAN_REAL, OMPI_ALIGNMENT_FORTRAN_REAL, DT_FLAG_DATA_FLOAT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_dblprec = INIT_BASIC_FORTRAN_TYPE( DT_DBLPREC, DBLPREC, OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION, OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION, DT_FLAG_DATA_FLOAT );
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2int = INIT_BASIC_TYPE( DT_2INT, 2INT );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2real = INIT_BASIC_TYPE( DT_2REAL, 2REAL );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2dblprec = INIT_BASIC_TYPE( DT_2DBLPREC, 2DBLPREC );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2integer = INIT_BASIC_TYPE( DT_2INTEGER, 2INTEGER );
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_wchar = INIT_BASIC_TYPE( DT_WCHAR, WCHAR );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_cplex = INIT_BASIC_DATA( ompi_complex_float_t, OMPI_ALIGNMENT_FLOAT, COMPLEX_FLOAT, DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_dblcplex = INIT_BASIC_DATA( ompi_complex_double_t, OMPI_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE, DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX );
|
||||
#if HAVE_LONG_DOUBLE
|
||||
@ -122,7 +134,6 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_ldblcplex = INIT_BASIC_DATA( ompi_com
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_ldblcplex = INIT_BASIC_DATA( void*, 0, UNAVAILABLE, 0 );
|
||||
#endif /* HAVE_LONG_DOUBLE */
|
||||
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_cxx_bool = INIT_BASIC_DATA( SIZEOF_BOOL, OMPI_ALIGNMENT_CXX_BOOL, CXX_BOOL, DT_FLAG_DATA_CPP );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2cplex = INIT_BASIC_TYPE( DT_2COMPLEX, 2COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2dblcplex = INIT_BASIC_TYPE( DT_2DOUBLE_COMPLEX, 2DOUBLE_COMPLEX );
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_unavailable = INIT_BASIC_TYPE( DT_UNAVAILABLE, UNAVAILABLE );
|
||||
@ -210,27 +221,27 @@ const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED] = {
|
||||
&ompi_mpi_float,
|
||||
&ompi_mpi_double,
|
||||
&ompi_mpi_long_double,
|
||||
&ompi_mpi_packed,
|
||||
&ompi_mpi_wchar,
|
||||
&ompi_mpi_cxx_bool,
|
||||
&ompi_mpi_logic,
|
||||
&ompi_mpi_integer,
|
||||
&ompi_mpi_real,
|
||||
&ompi_mpi_dblprec,
|
||||
&ompi_mpi_cplex,
|
||||
&ompi_mpi_dblcplex,
|
||||
&ompi_mpi_ldblcplex,
|
||||
&ompi_mpi_packed,
|
||||
&ompi_mpi_logic,
|
||||
&ompi_mpi_2int,
|
||||
&ompi_mpi_2integer,
|
||||
&ompi_mpi_2real,
|
||||
&ompi_mpi_2dblprec,
|
||||
&ompi_mpi_2cplex,
|
||||
&ompi_mpi_2dblcplex,
|
||||
&ompi_mpi_float_int,
|
||||
&ompi_mpi_double_int,
|
||||
&ompi_mpi_longdbl_int,
|
||||
&ompi_mpi_long_int,
|
||||
&ompi_mpi_2int,
|
||||
&ompi_mpi_short_int,
|
||||
&ompi_mpi_integer,
|
||||
&ompi_mpi_real,
|
||||
&ompi_mpi_dblprec,
|
||||
&ompi_mpi_2real,
|
||||
&ompi_mpi_2dblprec,
|
||||
&ompi_mpi_2integer,
|
||||
&ompi_mpi_wchar,
|
||||
&ompi_mpi_2cplex,
|
||||
&ompi_mpi_2dblcplex,
|
||||
&ompi_mpi_cxx_bool,
|
||||
&ompi_mpi_unavailable
|
||||
};
|
||||
|
||||
@ -281,7 +292,7 @@ int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
||||
displ[0] -= base; \
|
||||
if( displ[0] != (displ[1] + (long)sizeof(type2)) ) \
|
||||
ptype->ub = displ[0]; /* force a new extent for the datatype */ \
|
||||
ptype->flags |= DT_FLAG_FOREVER | (FLAGS); \
|
||||
ptype->flags |= DT_FLAG_PREDEFINED | (FLAGS); \
|
||||
ptype->id = MPIDDT; \
|
||||
ompi_ddt_commit( &ptype ); \
|
||||
COPY_DATA_DESC( PDATA, ptype ); \
|
||||
@ -289,13 +300,15 @@ int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
||||
ptype->opt_desc.desc = NULL; \
|
||||
OBJ_RELEASE( ptype ); \
|
||||
strncpy( (PDATA)->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \
|
||||
if( (PDATA)->flags & DT_FLAG_CONTIGUOUS ) \
|
||||
(PDATA)->flags |= DT_FLAG_BASIC; \
|
||||
} while(0)
|
||||
|
||||
#define DECLARE_MPI2_COMPOSED_BLOCK_DDT( PDATA, MPIDDT, MPIDDTNAME, MPIType, FLAGS ) \
|
||||
do { \
|
||||
ompi_datatype_t *ptype; \
|
||||
ompi_ddt_create_contiguous( 2, ompi_ddt_basicDatatypes[MPIType], &ptype ); \
|
||||
ptype->flags |= DT_FLAG_FOREVER | (FLAGS); \
|
||||
ptype->flags |= DT_FLAG_PREDEFINED | (FLAGS); \
|
||||
ptype->id = (MPIDDT); \
|
||||
ompi_ddt_commit( &ptype ); \
|
||||
COPY_DATA_DESC( (PDATA), ptype ); \
|
||||
@ -303,6 +316,8 @@ int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
||||
ptype->opt_desc.desc = NULL; \
|
||||
OBJ_RELEASE( ptype ); \
|
||||
strncpy( (PDATA)->name, (MPIDDTNAME), MPI_MAX_OBJECT_NAME ); \
|
||||
if( (PDATA)->flags & DT_FLAG_CONTIGUOUS ) \
|
||||
(PDATA)->flags |= DT_FLAG_BASIC; \
|
||||
} while(0)
|
||||
|
||||
#define DECLARE_MPI_SYNONYM_DDT( PDATA, MPIDDTNAME, PORIGDDT) \
|
||||
@ -320,7 +335,7 @@ int32_t ompi_ddt_init( void )
|
||||
ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_ddt_basicDatatypes[i];
|
||||
|
||||
datatype->desc.desc = (dt_elem_desc_t*)malloc(2*sizeof(dt_elem_desc_t));
|
||||
datatype->desc.desc[0].elem.common.flags = DT_FLAG_BASIC | DT_FLAG_CONTIGUOUS | DT_FLAG_DATA;
|
||||
datatype->desc.desc[0].elem.common.flags = DT_FLAG_PREDEFINED | DT_FLAG_DATA | DT_FLAG_CONTIGUOUS;
|
||||
datatype->desc.desc[0].elem.common.type = i;
|
||||
datatype->desc.desc[0].elem.count = 1;
|
||||
datatype->desc.desc[0].elem.disp = 0;
|
||||
@ -371,7 +386,8 @@ int32_t ompi_ddt_init( void )
|
||||
DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_short_int, DT_SHORT_INT, "MPI_SHORT_INT",
|
||||
short, int, DT_SHORT, DT_INT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT );
|
||||
DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_longdbl_int, DT_LONG_DOUBLE_INT, "MPI_LONG_DOUBLE_INT",
|
||||
long double, int, DT_LONG_DOUBLE, DT_INT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT );
|
||||
long double, int, DT_LONG_DOUBLE, DT_INT,
|
||||
DT_FLAG_DATA_C | DT_FLAG_DATA_INT );
|
||||
|
||||
DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2int, DT_2INT, "MPI_2INT", DT_INT,
|
||||
DT_FLAG_DATA_C | DT_FLAG_DATA_INT );
|
||||
@ -383,8 +399,8 @@ int32_t ompi_ddt_init( void )
|
||||
DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT );
|
||||
DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2cplex, DT_2COMPLEX, "MPI_2COMPLEX", DT_COMPLEX_FLOAT,
|
||||
DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT);
|
||||
DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblcplex, DT_2DOUBLE_COMPLEX, "MPI_2DOUBLE_COMPLEX", DT_COMPLEX_DOUBLE,
|
||||
DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT );
|
||||
DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblcplex, DT_2DOUBLE_COMPLEX, "MPI_2DOUBLE_COMPLEX",
|
||||
DT_COMPLEX_DOUBLE, DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT );
|
||||
|
||||
for( i = 0; i < DT_MAX_PREDEFINED; ++i ) {
|
||||
ompi_ddt_local_sizes[i] = ompi_ddt_basicDatatypes[i]->size;
|
||||
@ -551,11 +567,10 @@ static int _dump_data_flags( unsigned short usflags, char* ptr, size_t length )
|
||||
if( usflags & DT_FLAG_OVERLAP ) ptr[3] = 'o';
|
||||
if( usflags & DT_FLAG_USER_LB ) ptr[4] = 'l';
|
||||
if( usflags & DT_FLAG_USER_UB ) ptr[5] = 'u';
|
||||
if( usflags & DT_FLAG_FOREVER ) ptr[6] = 'F';
|
||||
if( usflags & DT_FLAG_PREDEFINED ) ptr[6] = 'P';
|
||||
if( usflags & DT_FLAG_IN_LOOP ) ptr[7] = 'L';
|
||||
if( usflags & DT_FLAG_DATA ) ptr[8] = 'D';
|
||||
if( usflags & DT_FLAG_INITIAL ) ptr[9] = '*';
|
||||
if( (usflags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) ptr[10] = 'B';
|
||||
if( (usflags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) ptr[9] = 'B';
|
||||
/* Which kind of datatype is that */
|
||||
switch( usflags & DT_FLAG_DATA_LANGUAGE ) {
|
||||
case DT_FLAG_DATA_C:
|
||||
@ -565,7 +580,7 @@ static int _dump_data_flags( unsigned short usflags, char* ptr, size_t length )
|
||||
case DT_FLAG_DATA_FORTRAN:
|
||||
ptr[12] = 'F'; ptr[13] = '7'; ptr[14] = '7'; break;
|
||||
default:
|
||||
if( usflags & DT_FLAG_INITIAL ) {
|
||||
if( usflags & DT_FLAG_PREDEFINED ) {
|
||||
ptr[12] = 'E'; ptr[13] = 'R'; ptr[14] = 'R'; break;
|
||||
}
|
||||
}
|
||||
@ -577,7 +592,7 @@ static int _dump_data_flags( unsigned short usflags, char* ptr, size_t length )
|
||||
case DT_FLAG_DATA_COMPLEX:
|
||||
ptr[17] = 'C'; ptr[18] = 'P'; ptr[19] = 'L'; break;
|
||||
default:
|
||||
if( usflags & DT_FLAG_INITIAL ) {
|
||||
if( usflags & DT_FLAG_PREDEFINED ) {
|
||||
ptr[17] = 'E'; ptr[18] = 'R'; ptr[19] = 'R'; break;
|
||||
}
|
||||
}
|
||||
@ -647,7 +662,8 @@ void ompi_ddt_dump( const ompi_datatype_t* pData )
|
||||
pData->lb, pData->ub, pData->ub - pData->lb,
|
||||
(int)pData->nbElems, (int)pData->btypes[DT_LOOP], (int)pData->flags );
|
||||
/* dump the flags */
|
||||
if( pData->flags == DT_FLAG_BASIC ) index += snprintf( buffer + index, length - index, "basic datatype " );
|
||||
if( pData->flags == DT_FLAG_PREDEFINED )
|
||||
index += snprintf( buffer + index, length - index, "predefined " );
|
||||
else {
|
||||
if( pData->flags & DT_FLAG_DESTROYED ) index += snprintf( buffer + index, length - index, "destroyed " );
|
||||
if( pData->flags & DT_FLAG_COMMITED ) index += snprintf( buffer + index, length - index, "commited " );
|
||||
|
@ -105,9 +105,10 @@ int32_t ompi_ddt_optimize_short( ompi_datatype_t* pData, int32_t count,
|
||||
*/
|
||||
CREATE_LOOP_START( pElemDesc, counter, (long)2, loop->extent, loop->common.flags );
|
||||
pElemDesc++; nbElems++;
|
||||
CREATE_ELEM( pElemDesc, DT_BYTE, DT_FLAG_CONTIGUOUS, end_loop->size, loop_disp, lastExtent );
|
||||
CREATE_ELEM( pElemDesc, DT_BYTE, DT_FLAG_BASIC, end_loop->size, loop_disp, lastExtent );
|
||||
pElemDesc++; nbElems++;
|
||||
CREATE_LOOP_END( pElemDesc, 2, end_loop->total_extent, end_loop->size, end_loop->common.flags );
|
||||
CREATE_LOOP_END( pElemDesc, 2, end_loop->total_extent, end_loop->size,
|
||||
end_loop->common.flags );
|
||||
pElemDesc++; nbElems++;
|
||||
}
|
||||
pos_desc += pData->desc.desc[pos_desc].loop.items + 1;
|
||||
|
@ -49,7 +49,7 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)
|
||||
*count = status->_count / size;
|
||||
size = status->_count - (*count) * size;
|
||||
/* if basic type we should return the same result as MPI_Get_count */
|
||||
if( (datatype->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) {
|
||||
if( datatype->flags & DT_FLAG_PREDEFINED ) {
|
||||
if( size != 0 ) {
|
||||
*count = MPI_UNDEFINED;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int MPI_Type_get_contents(MPI_Datatype mtype,
|
||||
/* if we have a predefined datatype then we return directly a pointer to
|
||||
* the datatype, otherwise we should create a copy and give back the copy.
|
||||
*/
|
||||
if( DT_FLAG_BASIC != (array_of_datatypes[i]->flags & DT_FLAG_BASIC) ) {
|
||||
if( !(array_of_datatypes[i]->flags & DT_FLAG_PREDEFINED) ) {
|
||||
if( (rc = ompi_ddt_duplicate( array_of_datatypes[i], &newtype )) != MPI_SUCCESS ) {
|
||||
ompi_ddt_destroy( &newtype );
|
||||
OMPI_ERRHANDLER_RETURN( MPI_ERR_INTERN, MPI_COMM_WORLD,
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user