Correctly update the flags when we build data-types. Play nicely with the NO_GAP flag.
This commit was SVN r10454.
Этот коммит содержится в:
родитель
48e9a72c47
Коммит
710a49ce79
@ -97,6 +97,9 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
pdtBase->lb = disp;
|
||||
pdtBase->flags |= DT_FLAG_USER_LB;
|
||||
}
|
||||
if( (pdtBase->ub - pdtBase->lb) != (long)pdtBase->size ) {
|
||||
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
} else if( pdtAdd == ompi_ddt_basicDatatypes[DT_UB] ) {
|
||||
pdtBase->bdt_used |= (1<< DT_UB);
|
||||
@ -106,6 +109,9 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
pdtBase->ub = disp;
|
||||
pdtBase->flags |= DT_FLAG_USER_UB;
|
||||
}
|
||||
if( (pdtBase->ub - pdtBase->lb) != (long)pdtBase->size ) {
|
||||
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
place_needed = (extent == (long)pdtAdd->size ? 1 : 3);
|
||||
@ -217,7 +223,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
if( (pdtAdd->flags & (DT_FLAG_PREDEFINED | DT_FLAG_DATA)) == (DT_FLAG_PREDEFINED | DT_FLAG_DATA) ) {
|
||||
pdtBase->btypes[pdtAdd->id] += count;
|
||||
if( (extent != (long)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */
|
||||
localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS);
|
||||
localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS);
|
||||
CREATE_LOOP_START( pLast, count, 2, extent, localFlags );
|
||||
pLast++;
|
||||
pLast->elem.common.type = pdtAdd->id;
|
||||
@ -291,12 +297,11 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
* In other words to avoid having internal gaps between elements. If any of the data are
|
||||
* overlapping then this method will not work.
|
||||
*/
|
||||
localFlags = pdtBase->flags & pdtAdd->flags;
|
||||
UNSET_CONTIGUOUS_FLAG(pdtBase->flags);
|
||||
if( disp != old_true_ub ) { /* is there a gap between the 2 datatypes ? */
|
||||
if( disp < old_true_ub ) pdtBase->flags |= DT_FLAG_OVERLAP;
|
||||
UNSET_CONTIGUOUS_FLAG(pdtBase->flags);
|
||||
} else {
|
||||
localFlags = pdtBase->flags & pdtAdd->flags;
|
||||
UNSET_CONTIGUOUS_FLAG(pdtBase->flags); /* consider it as not contiguous */
|
||||
if( (localFlags & DT_FLAG_CONTIGUOUS) /* both have to be contiguous */
|
||||
&& ( (((long)pdtAdd->size) == extent) /* the size and the extent of the added
|
||||
* type have to match */
|
||||
@ -307,8 +312,9 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||
}
|
||||
}
|
||||
/* If the NO_GAP flag is set the contiguous have to be set too */
|
||||
if( pdtBase->flags & DT_FLAG_NO_GAPS )
|
||||
if( pdtBase->flags & DT_FLAG_NO_GAPS ) {
|
||||
assert( pdtBase->flags & DT_FLAG_CONTIGUOUS );
|
||||
}
|
||||
pdtBase->nbElems += (count * pdtAdd->nbElems);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
|
@ -111,5 +111,10 @@ int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, long lb, long e
|
||||
ompi_ddt_duplicate( oldType, newType );
|
||||
(*newType)->lb = lb;
|
||||
(*newType)->ub = lb + extent;
|
||||
|
||||
(*newType)->flags &= ~DT_FLAG_NO_GAPS;
|
||||
if( (extent == (long)oldType->size) && (oldType->flags & DT_FLAG_CONTIGUOUS) ) {
|
||||
(*newType)->flags |= DT_FLAG_NO_GAPS;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ int ompi_ddt_register_params(void)
|
||||
|
||||
int32_t ompi_ddt_init( void )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) {
|
||||
ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_ddt_basicDatatypes[i];
|
||||
@ -417,6 +417,10 @@ int32_t ompi_ddt_init( void )
|
||||
datatype->opt_desc = datatype->desc;
|
||||
|
||||
datatype->btypes[i] = 1;
|
||||
/* Check if the data contain gaps */
|
||||
if( (datatype->ub - datatype->lb) == (long)datatype->size ) {
|
||||
datatype->desc.desc[0].elem.common.flags |= DT_FLAG_NO_GAPS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the f2c translation table */
|
||||
@ -453,8 +457,7 @@ 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 );
|
||||
|
||||
DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2int, DT_2INT, "MPI_2INT", DT_INT,
|
||||
DT_FLAG_DATA_C | DT_FLAG_DATA_INT );
|
||||
@ -588,6 +591,16 @@ int32_t ompi_ddt_init( void )
|
||||
MOOG(cxx_dblcplex);
|
||||
MOOG(cxx_ldblcplex);
|
||||
|
||||
for( i = 0; i < ompi_mpi_cxx_ldblcplex.d_f_to_c_index; i++ ) {
|
||||
ompi_datatype_t* datatype = ompi_pointer_array_get_item( ompi_datatype_f_to_c_table, i );
|
||||
|
||||
if( (datatype->ub - datatype->lb) == (long)datatype->size ) {
|
||||
datatype->flags |= DT_FLAG_NO_GAPS;
|
||||
} else {
|
||||
datatype->flags &= ~DT_FLAG_NO_GAPS;
|
||||
}
|
||||
}
|
||||
|
||||
ompi_ddt_default_convertors_init();
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user