Allow correct duplication for MPI_UB and MPI_LB. The problem is that we cannot
create a duplicate type, because any duplicate type lose the PREDEFINED flag. An MPI_LB (respectively MPI_UB) without the PREDEFINED tag is useless, as it's not the a marker anymore. The solution is to return the same pointer, but once the reference count has been increased. In order for this to work, I allowed the destruction to check for the reference count of an object before complaining about destroying a predefined type. This fixed ticket #317. This commit was SVN r13942.
Этот коммит содержится в:
родитель
21f014f5f6
Коммит
4b63631535
@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
|
||||
@ -25,7 +25,7 @@ int32_t ompi_ddt_destroy( ompi_datatype_t** dt )
|
||||
{
|
||||
ompi_datatype_t* pData = *dt;
|
||||
|
||||
if( pData->flags & DT_FLAG_PREDEFINED )
|
||||
if( (pData->flags & DT_FLAG_PREDEFINED) && (pData->super.obj_reference_count <= 1) )
|
||||
return OMPI_ERROR;
|
||||
|
||||
OBJ_RELEASE( pData );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -47,6 +47,14 @@ 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( (rc = ompi_ddt_duplicate( type, newtype )) != MPI_SUCCESS ) {
|
||||
ompi_ddt_destroy( newtype );
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user