1
1

This commit should fix the issues with ticket 1065. Now, we correctly

duplicate the MPI_UB and MPI_LB datatypes.

This commit was SVN r16083.
Этот коммит содержится в:
George Bosilca 2007-09-10 22:13:42 +00:00
родитель 45767b038c
Коммит 8622beda54
3 изменённых файлов: 6 добавлений и 12 удалений

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

@ -89,7 +89,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
if( pdtAdd->flags & DT_FLAG_PREDEFINED ) { /* add a basic datatype */ if( pdtAdd->flags & DT_FLAG_PREDEFINED ) { /* add a basic datatype */
/* handle special cases for DT_LB and DT_UB */ /* handle special cases for DT_LB and DT_UB */
if( pdtAdd == ompi_ddt_basicDatatypes[DT_LB] ) { if( DT_LB == pdtAdd->id ) {
pdtBase->bdt_used |= (((uint64_t)1) << DT_LB); pdtBase->bdt_used |= (((uint64_t)1) << DT_LB);
if( pdtBase->flags & DT_FLAG_USER_LB ) { if( pdtBase->flags & DT_FLAG_USER_LB ) {
pdtBase->lb = LMIN( pdtBase->lb, disp ); pdtBase->lb = LMIN( pdtBase->lb, disp );
@ -101,7 +101,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
pdtBase->flags &= ~DT_FLAG_NO_GAPS; pdtBase->flags &= ~DT_FLAG_NO_GAPS;
} }
return OMPI_SUCCESS; return OMPI_SUCCESS;
} else if( pdtAdd == ompi_ddt_basicDatatypes[DT_UB] ) { } else if( DT_UB == pdtAdd->id ) {
pdtBase->bdt_used |= (((uint64_t)1) << DT_UB); pdtBase->bdt_used |= (((uint64_t)1) << DT_UB);
if( pdtBase->flags & DT_FLAG_USER_UB ) { if( pdtBase->flags & DT_FLAG_USER_UB ) {
pdtBase->ub = LMAX( pdtBase->ub, disp ); pdtBase->ub = LMAX( pdtBase->ub, disp );
@ -199,6 +199,8 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
pdtBase->ub += (pdtBase->align - epsilon); pdtBase->ub += (pdtBase->align - epsilon);
} }
} }
/* now we know it contain some data */
pdtBase->flags |= DT_FLAG_DATA;
/* /*
* the count == 0 is LEGAL only for MPI_UB and MPI_LB. Therefore we support it * the count == 0 is LEGAL only for MPI_UB and MPI_LB. Therefore we support it

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

@ -60,7 +60,8 @@ int32_t ompi_ddt_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** ne
memcpy( pdt->opt_desc.desc, oldType->opt_desc.desc, desc_length * sizeof(dt_elem_desc_t) ); memcpy( pdt->opt_desc.desc, oldType->opt_desc.desc, desc_length * sizeof(dt_elem_desc_t) );
} }
} }
pdt->id = 0; pdt->id = oldType->id; /* preserve the default id. This allow us to
* copy predefined types. */
pdt->args = NULL; pdt->args = NULL;
*newType = pdt; *newType = pdt;
return OMPI_SUCCESS; return OMPI_SUCCESS;

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

@ -47,15 +47,6 @@ int MPI_Type_dup (MPI_Datatype type,
} }
} }
/* Don't allow for UB and LB duplication. Instead return the same
* pointer and increase the reference count by one.
*/
if( (MPI_UB == type) || (MPI_LB == type) ) {
OBJ_RETAIN( type );
*newtype = type;
return OMPI_SUCCESS;
}
if (OMPI_SUCCESS != ompi_ddt_duplicate( type, newtype)) { if (OMPI_SUCCESS != ompi_ddt_duplicate( type, newtype)) {
ompi_ddt_destroy( newtype ); ompi_ddt_destroy( newtype );
OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD, OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD,