1
1

Mainly cleanups + some variable rename.

Help the compiler a little bit : add const to all arguments non modified inside the
functions.

This commit was SVN r3586.
Этот коммит содержится в:
George Bosilca 2004-11-16 23:50:31 +00:00
родитель b73c7ae6c9
Коммит 6c9f27a2f5
15 изменённых файлов: 230 добавлений и 227 удалений

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

@ -105,60 +105,60 @@ int ompi_ddt_finalize( void );
dt_desc_t* ompi_ddt_create( int expectedSize );
int ompi_ddt_commit( dt_desc_t** );
int ompi_ddt_destroy( dt_desc_t** );
static inline int ompi_ddt_is_committed( ompi_datatype_t* type )
static inline int ompi_ddt_is_committed( const ompi_datatype_t* type )
{ return ((type->flags & DT_FLAG_COMMITED) == DT_FLAG_COMMITED); }
static inline int ompi_ddt_is_overlapped( ompi_datatype_t* type )
static inline int ompi_ddt_is_overlapped( const ompi_datatype_t* type )
{ return ((type->flags & DT_FLAG_OVERLAP) == DT_FLAG_OVERLAP); }
static inline int ompi_ddt_is_acceptable_for_one_sided( ompi_datatype_t* type )
static inline int ompi_ddt_is_acceptable_for_one_sided( const ompi_datatype_t* type )
{ return ((type->flags & DT_FLAG_ONE_SIDED) == DT_FLAG_ONE_SIDED); }
void ompi_ddt_dump( dt_desc_t* pData );
void ompi_ddt_dump( const dt_desc_t* pData );
/* data creation functions */
OMPI_DECLSPEC int ompi_ddt_duplicate( dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_contiguous( int count, dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_duplicate( const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_contiguous( int count, const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_vector( int count, int bLength, long stride,
dt_desc_t* oldType, dt_desc_t** newType );
const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_hvector( int count, int bLength, long stride,
dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_indexed( int count, int* pBlockLength, int* pDisp,
dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_hindexed( int count, int* pBlockLength, long* pDisp,
dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_indexed_block( int count, int bLength, int* pDisp,
dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
dt_desc_t** pTypes, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_resized( dt_desc_t* oldType, long lb, long extent, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_subarray( int ndims, int* pSizes, int* pSubSizes, int* pStarts,
int order, dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_darray( int size, int rank, int ndims, int* pGSizes, int *pDistrib,
int* pDArgs, int* pPSizes, int order, dt_desc_t* oldType,
const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_indexed( int count, const int* pBlockLength, const int* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_hindexed( int count, const int* pBlockLength, const long* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_indexed_block( int count, int bLength, const int* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_struct( int count, const int* pBlockLength, const long* pDisp,
const dt_desc_t** pTypes, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_resized( const dt_desc_t* oldType, long lb, long extent, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_subarray( int ndims, const int* pSizes, const int* pSubSizes, const int* pStarts,
int order, const dt_desc_t* oldType, dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_create_darray( int size, int rank, int ndims, const int* pGSizes, const int *pDistrib,
const int* pDArgs, const int* pPSizes, int order, const dt_desc_t* oldType,
dt_desc_t** newType );
OMPI_DECLSPEC int ompi_ddt_add( dt_desc_t* pdtBase, dt_desc_t* pdtNew, unsigned int count, long disp, long extent );
OMPI_DECLSPEC int ompi_ddt_add( dt_desc_t* pdtBase, const dt_desc_t* pdtAdd, unsigned int count, long disp, long extent );
static inline int ompi_ddt_type_lb( dt_desc_t* pData, long* disp )
static inline int ompi_ddt_type_lb( const dt_desc_t* pData, long* disp )
{ *disp = pData->lb; return 0; }
static inline int ompi_ddt_type_ub( dt_desc_t* pData, long* disp )
static inline int ompi_ddt_type_ub( const dt_desc_t* pData, long* disp )
{ *disp = pData->ub; return 0; }
static inline int ompi_ddt_type_size ( dt_desc_t* pData, int *size )
static inline int ompi_ddt_type_size ( const dt_desc_t* pData, int *size )
{ *size = pData->size; return 0; }
static inline int ompi_ddt_type_extent( dt_desc_t* pData, long* extent )
static inline int ompi_ddt_type_extent( const dt_desc_t* pData, long* extent )
{ *extent = (pData->ub - pData->lb); return 0; }
static inline int ompi_ddt_get_extent( dt_desc_t* pData, long* lb, long* extent)
static inline int ompi_ddt_get_extent( const dt_desc_t* pData, long* lb, long* extent)
{ *lb = pData->lb; *extent = pData->ub - pData->lb; return 0; }
static inline int ompi_ddt_get_true_extent( dt_desc_t* pData, long* true_lb, long* true_extent)
static inline int ompi_ddt_get_true_extent( const dt_desc_t* pData, long* true_lb, long* true_extent)
{ *true_lb = pData->true_lb; *true_extent = (pData->true_ub - pData->true_lb); return 0; }
OMPI_DECLSPEC int ompi_ddt_get_element_count( dt_desc_t* pData, int iSize );
OMPI_DECLSPEC int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count, char* pDestBuf, char* pSrcBuf );
OMPI_DECLSPEC int ompi_ddt_get_element_count( const dt_desc_t* pData, int iSize );
OMPI_DECLSPEC int ompi_ddt_copy_content_same_ddt( const dt_desc_t* pData, int count, char* pDestBuf, const char* pSrcBuf );
OMPI_DECLSPEC int ompi_ddt_optimize_short( dt_desc_t* pData, int count, dt_type_desc_t* pTypeDesc );
/* flags for the datatypes */
typedef int (*conversion_fct_t)( unsigned int count,
void* from, uint32_t from_len, long from_extent,
const void* from, uint32_t from_len, long from_extent,
void* to, uint32_t in_length, long to_extent );
typedef struct __dt_stack dt_stack_t;
@ -242,22 +242,22 @@ static inline int ompi_convertor_unpack( ompi_convertor_t* pConv,
/* and finally the convertor functions */
OMPI_DECLSPEC ompi_convertor_t* ompi_convertor_create( int remote_arch, int mode );
OMPI_DECLSPEC ompi_convertor_t* ompi_convertor_get_copy( ompi_convertor_t* pConvertor );
OMPI_DECLSPEC int ompi_convertor_copy( ompi_convertor_t* pSrcConv, ompi_convertor_t* pDestConv );
OMPI_DECLSPEC ompi_convertor_t* ompi_convertor_get_copy( const ompi_convertor_t* pConvertor );
OMPI_DECLSPEC int ompi_convertor_copy( const ompi_convertor_t* pSrcConv, ompi_convertor_t* pDestConv );
OMPI_DECLSPEC int ompi_convertor_init_for_send( ompi_convertor_t* pConv, unsigned int flags,
dt_desc_t* pData, int count,
void* pUserBuf, int local_starting_point,
const dt_desc_t* pData, int count,
const void* pUserBuf, int local_starting_point,
memalloc_fct_t allocfn );
OMPI_DECLSPEC int ompi_convertor_init_for_recv( ompi_convertor_t* pConv, unsigned int flags,
dt_desc_t* pData, int count,
void* pUserBuf, int remote_starting_point,
const dt_desc_t* pData, int count,
const void* pUserBuf, int remote_starting_point,
memalloc_fct_t allocfn );
OMPI_DECLSPEC int ompi_convertor_need_buffers( ompi_convertor_t* pConvertor );
OMPI_DECLSPEC int ompi_convertor_get_packed_size( ompi_convertor_t* pConv, unsigned int* pSize );
OMPI_DECLSPEC int ompi_convertor_get_unpacked_size( ompi_convertor_t* pConv, unsigned int* pSize );
OMPI_DECLSPEC int ompi_convertor_get_packed_size( const ompi_convertor_t* pConv, unsigned int* pSize );
OMPI_DECLSPEC int ompi_convertor_get_unpacked_size( const ompi_convertor_t* pConv, unsigned int* pSize );
/* temporary function prototypes. They should move in other place later. */
OMPI_DECLSPEC int ompi_ddt_get_args( dt_desc_t* pData, int which,
OMPI_DECLSPEC int ompi_ddt_get_args( const dt_desc_t* pData, int which,
int * ci, int * i,
int * ca, long* a,
int * cd, ompi_datatype_t** d, int * type);
@ -265,11 +265,10 @@ OMPI_DECLSPEC int ompi_ddt_set_args( dt_desc_t* pData,
int ci, int ** i,
int ca, long* a,
int cd, ompi_datatype_t** d,int type);
OMPI_DECLSPEC int ompi_ddt_sndrcv( void *sbuf, int scount, ompi_datatype_t* sdtype, void *rbuf,
int rcount, ompi_datatype_t* rdtype, int tag, MPI_Comm comm);
OMPI_DECLSPEC int ompi_ddt_sndrcv( void *sbuf, int scount, const ompi_datatype_t* sdtype, void *rbuf,
int rcount, const ompi_datatype_t* rdtype, int tag, MPI_Comm comm);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* DATATYPE_H_HAS_BEEN_INCLUDED */

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

@ -145,7 +145,7 @@ typedef struct {
long double i;
} ompi_complex_long_double_t;
extern ompi_datatype_t* ompi_ddt_basicDatatypes[];
extern const ompi_datatype_t* ompi_ddt_basicDatatypes[];
/* macros to play with the flags */
#define SWAP( INT_VALUE, FLAG ) (INT_VALUE) = (INT_VALUE) ^ (FLAG)
@ -169,7 +169,8 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
extern conversion_fct_t ompi_ddt_copy_functions[DT_MAX_PREDEFINED];
extern void ompi_ddt_dump_stack( dt_stack_t* pStack, int stack_pos, dt_elem_desc_t* pDesc, char* name );
extern void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos,
const dt_elem_desc_t* pDesc, const char* name );
#define SAVE_STACK( PSTACK, INDEX, COUNT, DISP, END_LOOP) \
do { \
(PSTACK)->index = (INDEX); \
@ -197,9 +198,9 @@ do { \
#define OMPI_DDT_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT )
#endif /* OMPI_ENABLE_DEBUG */
static inline void ompi_ddt_safeguard_pointer( void* actual_ptr, int length,
void* initial_ptr,
ompi_datatype_t* pData,
static inline void ompi_ddt_safeguard_pointer( const void* actual_ptr, int length,
const void* initial_ptr,
const ompi_datatype_t* pData,
int count )
{
char* lower_bound = (char*)initial_ptr;
@ -249,7 +250,7 @@ do { \
} while(0)
#endif /* USELESS */
static inline int GET_FIRST_NON_LOOP( dt_elem_desc_t* _pElem )
static inline int GET_FIRST_NON_LOOP( const dt_elem_desc_t* _pElem )
{
int index = 0;
@ -263,10 +264,10 @@ static inline int GET_FIRST_NON_LOOP( dt_elem_desc_t* _pElem )
}
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
int starting_point, int* sizes );
int starting_point, const int* sizes );
static inline
int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
int starting_point, int* sizes )
int starting_point, const int* sizes )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
ompi_datatype_t* pData = pConvertor->pDesc;
@ -313,7 +314,7 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
}
static inline
int ompi_convertor_create_stack_at_begining( ompi_convertor_t* pConvertor, int* sizes )
int ompi_convertor_create_stack_at_begining( ompi_convertor_t* pConvertor, const int* sizes )
{
ompi_datatype_t* pData = pConvertor->pDesc;
dt_stack_t* pStack;

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

@ -18,7 +18,7 @@
* be sure that the pdtBase datatype is correctly initialized with all fields
* set to ZERO if it's a empty datatype.
*/
int ompi_ddt_add( dt_desc_t* pdtBase, dt_desc_t* pdtAdd,
int ompi_ddt_add( dt_desc_t* pdtBase, const dt_desc_t* pdtAdd,
unsigned int count, long disp, long extent )
{
uint32_t newLength, place_needed = 0, i;
@ -72,8 +72,6 @@ int ompi_ddt_add( dt_desc_t* pdtBase, dt_desc_t* pdtAdd,
return 0;
}
OBJ_RETAIN( pdtAdd );
/* compute the new memory alignement */
pdtBase->align = IMAX( pdtBase->align, pdtAdd->align );
@ -100,6 +98,14 @@ int ompi_ddt_add( dt_desc_t* pdtBase, dt_desc_t* pdtAdd,
if( extent == (int)pdtAdd->size )
pLast->flags |= DT_FLAG_CONTIGUOUS;
} else {
/* We handle a user defined datatype. We should make sure that the user will not have the
* oportunity to destroy it before all datatypes derived are destroyed. As we keep pointers
* to every datatype (for MPI_Type_get_content and MPI_Type_get_envelope) we have to make
* sure that those datatype will be available if the user ask for them. However, there
* is no easy way to free them in this case ...
*/
OBJ_RETAIN( pdtAdd );
/* now we add a complex datatype */
if( disp != pdtBase->true_ub ) { /* add the initial gap */
if( disp < pdtBase->true_ub ) pdtBase->flags |= DT_FLAG_OVERLAP;
@ -201,7 +207,5 @@ int ompi_ddt_add( dt_desc_t* pdtBase, dt_desc_t* pdtAdd,
!(pdtBase->flags & DT_FLAG_CONTIGUOUS) || !(pdtAdd->flags & DT_FLAG_CONTIGUOUS) )
UNSET_CONTIGUOUS_FLAG(pdtBase->flags);
OBJ_RELEASE( pdtAdd );
return OMPI_SUCCESS;
}

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

@ -162,7 +162,7 @@ int ompi_ddt_set_args( ompi_datatype_t* pData,
return MPI_SUCCESS;
}
int ompi_ddt_get_args( ompi_datatype_t* pData, int which,
int ompi_ddt_get_args( const ompi_datatype_t* pData, int which,
int * ci, int * i,
int * ca, MPI_Aint * a,
int * cd, MPI_Datatype * d, int * type)

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

@ -69,7 +69,7 @@ dt_desc_t* ompi_ddt_create( int expectedSize )
return pdt;
}
int ompi_ddt_create_resized( dt_desc_t* oldType, long lb, long extent, dt_desc_t** newType )
int ompi_ddt_create_resized( const dt_desc_t* oldType, long lb, long extent, dt_desc_t** newType )
{
ompi_ddt_duplicate( oldType, newType );
(*newType)->lb = lb;

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

@ -3,15 +3,15 @@
#include "ompi_config.h"
#include "datatype.h"
int ompi_ddt_create_subarray( int ndims, int* pSizes, int* pSubSizes, int* pStarts,
int order, dt_desc_t* oldType, dt_desc_t** newType )
int ompi_ddt_create_subarray( int ndims, const int* pSizes, const int* pSubSizes, const int* pStarts,
int order, const dt_desc_t* oldType, dt_desc_t** newType )
{
return OMPI_ERR_NOT_IMPLEMENTED;
}
int ompi_ddt_create_darray( int size, int rank, int ndims, int* pGSizes, int *pDistrib,
int* pDArgs, int* pPSizes, int order, dt_desc_t* oldType,
dt_desc_t** newType )
int ompi_ddt_create_darray( int size, int rank, int ndims, const int* pGSizes, const int *pDistrib,
const int* pDArgs, const int* pPSizes, int order, const dt_desc_t* oldType,
dt_desc_t** newType )
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -4,7 +4,7 @@
#include "datatype.h"
#include "datatype_internal.h"
int ompi_ddt_duplicate( dt_desc_t* oldType, dt_desc_t** newType )
int ompi_ddt_duplicate( const dt_desc_t* oldType, dt_desc_t** newType )
{
dt_desc_t* pdt = ompi_ddt_create( oldType->desc.used );
void* temp = pdt->desc.desc; /* temporary copy of the desc pointer */
@ -19,7 +19,7 @@ int ompi_ddt_duplicate( dt_desc_t* oldType, dt_desc_t** newType )
return OMPI_SUCCESS;
}
int ompi_ddt_create_contiguous( int count, dt_desc_t* oldType,
int ompi_ddt_create_contiguous( int count, const dt_desc_t* oldType,
dt_desc_t** newType )
{
dt_desc_t* pdt = ompi_ddt_create( oldType->desc.used + 2 );

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

@ -4,8 +4,8 @@
#include "datatype.h"
/* We try to merge together data that are contiguous */
int ompi_ddt_create_indexed( int count, int* pBlockLength, int* pDisp,
dt_desc_t* oldType, dt_desc_t** newType )
int ompi_ddt_create_indexed( int count, const int* pBlockLength, const int* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType )
{
dt_desc_t* pdt;
int i, dLength, endat, disp;
@ -40,8 +40,8 @@ int ompi_ddt_create_indexed( int count, int* pBlockLength, int* pDisp,
return OMPI_SUCCESS;
}
int ompi_ddt_create_hindexed( int count, int* pBlockLength, long* pDisp,
dt_desc_t* oldType, dt_desc_t** newType )
int ompi_ddt_create_hindexed( int count, const int* pBlockLength, const long* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType )
{
dt_desc_t* pdt;
int i, dLength;
@ -76,8 +76,8 @@ int ompi_ddt_create_hindexed( int count, int* pBlockLength, long* pDisp,
return OMPI_SUCCESS;
}
int ompi_ddt_create_indexed_block( int count, int bLength, int* pDisp,
dt_desc_t* oldType, dt_desc_t** newType )
int ompi_ddt_create_indexed_block( int count, int bLength, const int* pDisp,
const dt_desc_t* oldType, dt_desc_t** newType )
{
dt_desc_t* pdt;
int i, dLength, endat, disp;

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

@ -3,8 +3,8 @@
#include "ompi_config.h"
#include "datatype.h"
int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
dt_desc_t** pTypes, dt_desc_t** newType )
int ompi_ddt_create_struct( int count, const int* pBlockLength, const long* pDisp,
const dt_desc_t ** pTypes, dt_desc_t** newType )
{
int i;
long disp = 0, endto, lastExtent, lastDisp;
@ -18,7 +18,7 @@ int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
disp += pTypes[i]->desc.used;
if( pBlockLength[i] != 1 ) disp += 2;
}
lastType = pTypes[0];
lastType = (dt_desc_t*)pTypes[0];
lastBlock = pBlockLength[0];
lastExtent = lastType->ub - lastType->lb;
lastDisp = pDisp[0];
@ -31,7 +31,7 @@ int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
} else {
disp += lastType->desc.used;
if( lastBlock > 1 ) disp += 2;
lastType = pTypes[i];
lastType = (dt_desc_t*)pTypes[i];
lastExtent = lastType->ub - lastType->lb;
lastBlock = pBlockLength[i];
lastDisp = pDisp[i];
@ -41,7 +41,7 @@ int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
disp += lastType->desc.used;
if( lastBlock != 1 ) disp += 2;
lastType = pTypes[0];
lastType = (dt_desc_t*)pTypes[0];
lastBlock = pBlockLength[0];
lastExtent = lastType->ub - lastType->lb;
lastDisp = pDisp[0];
@ -56,7 +56,7 @@ int ompi_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
endto = lastDisp + lastBlock * lastExtent;
} else {
ompi_ddt_add( pdt, lastType, lastBlock, lastDisp, lastExtent );
lastType = pTypes[i];
lastType = (dt_desc_t*)pTypes[i];
lastExtent = lastType->ub - lastType->lb;
lastBlock = pBlockLength[i];
lastDisp = pDisp[i];

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

@ -10,7 +10,7 @@
*/
int ompi_ddt_create_vector( int count, int bLength, long stride,
dt_desc_t* oldType, dt_desc_t** newType )
const dt_desc_t* oldType, dt_desc_t** newType )
{
long extent = oldType->ub - oldType->lb;
dt_desc_t *pTempData, *pData;
@ -22,12 +22,12 @@ int ompi_ddt_create_vector( int count, int bLength, long stride,
} else {
if( 1 == bLength ) {
pData = pTempData;
pTempData = oldType;
ompi_ddt_add( pData, oldType, count, 0, extent * stride );
} else {
ompi_ddt_add( pTempData, oldType, bLength, 0, extent );
pData = ompi_ddt_create( oldType->desc.used + 2 + 2 );
ompi_ddt_add( pData, pTempData, count, 0, extent * stride );
}
ompi_ddt_add( pData, pTempData, count, 0, extent * stride );
if( 1 != bLength )
OBJ_RELEASE( pTempData );
/* correct the ub to remove the last stride */
@ -38,7 +38,7 @@ int ompi_ddt_create_vector( int count, int bLength, long stride,
}
int ompi_ddt_create_hvector( int count, int bLength, long stride,
dt_desc_t* oldType, dt_desc_t** newType )
const dt_desc_t* oldType, dt_desc_t** newType )
{
long extent = oldType->ub - oldType->lb;
dt_desc_t *pTempData, *pData;
@ -50,12 +50,12 @@ int ompi_ddt_create_hvector( int count, int bLength, long stride,
} else {
if( 1 == bLength ) {
pData = pTempData;
pTempData = oldType;
ompi_ddt_add( pData, oldType, count, 0, stride );
} else {
ompi_ddt_add( pTempData, oldType, bLength, 0, extent );
pData = ompi_ddt_create( oldType->desc.used + 2 + 2 );
ompi_ddt_add( pData, pTempData, count, 0, stride );
}
ompi_ddt_add( pData, pTempData, count, 0, stride );
if( 1 != bLength )
OBJ_RELEASE( pTempData );
/* correct the ub to remove the last stride */

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

@ -140,7 +140,7 @@ ompi_datatype_t ompi_mpi_complex32 = INIT_BASIC_TYPE( DT_UNAVAILABLE, COMPLEX32
* NOTE: The order of this array *MUST* match what is listed in
* datatype_internal.h
*/
ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED] = {
const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED] = {
&ompi_mpi_loop,
&ompi_mpi_end_loop,
&ompi_mpi_lb,
@ -214,12 +214,13 @@ int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
#define DECLARE_MPI2_COMPOSED_STRUCT_DDT( PDATA, MPIDDT, MPIDDTNAME, type1, type2, MPIType1, MPIType2 ) \
do { \
struct { type1 v1; type2 v2; } s[2]; \
ompi_datatype_t *types[2], *ptype; \
const dt_desc_t* types[2]; \
dt_desc_t* ptype; \
int bLength[2] = {1, 1}; \
long base, displ[2]; \
\
types[0] = ompi_ddt_basicDatatypes[MPIType1]; \
types[1] = ompi_ddt_basicDatatypes[MPIType2]; \
types[0] = (dt_desc_t*)ompi_ddt_basicDatatypes[MPIType1]; \
types[1] = (dt_desc_t*)ompi_ddt_basicDatatypes[MPIType2]; \
base = (long)(&(s[0])); \
displ[0] = (long)(&(s[0].v1)); \
displ[0] -= base; \
@ -267,7 +268,7 @@ int ompi_ddt_init( void )
int i;
for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) {
ompi_datatype_t* datatype = ompi_ddt_basicDatatypes[i];
dt_desc_t* datatype = (dt_desc_t*)ompi_ddt_basicDatatypes[i];
datatype->desc.desc = (dt_elem_desc_t*)malloc(2*sizeof(dt_elem_desc_t));
datatype->desc.desc[0].flags = DT_FLAG_BASIC | DT_FLAG_CONTIGUOUS | DT_FLAG_DATA;
@ -499,7 +500,7 @@ static int __dump_data_desc( dt_elem_desc_t* pDesc, int nbElems )
return OMPI_SUCCESS;
}
static void __dt_contain_basic_datatypes( dt_desc_t* pData )
static inline void __dt_contain_basic_datatypes( const dt_desc_t* pData )
{
int i;
unsigned long long mask = 1;
@ -513,12 +514,10 @@ static void __dt_contain_basic_datatypes( dt_desc_t* pData )
}
}
void ompi_ddt_dump( dt_desc_t* data )
void ompi_ddt_dump( const dt_desc_t* pData )
{
dt_desc_t* pData = (dt_desc_t*)data;
printf( "Datatype %p size %ld align %d id %d length %d used %d\n\
true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n\
true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n \
nbElems %d loops %d flags %X (",
(void*)pData, pData->size, pData->align, pData->id, pData->desc.length, pData->desc.used,
pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb,

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

@ -26,7 +26,6 @@ int ompi_convertor_pack_general( ompi_convertor_t* pConvertor,
dt_desc_t *pData = pConvertor->pDesc;
dt_elem_desc_t* pElem;
char* pOutput = pConvertor->pBaseBuf;
int oCount = (pData->ub - pData->lb) * pConvertor->count;
char* pInput;
int iCount, rc;
uint32_t iov_count, total_bytes_converted = 0;
@ -738,28 +737,28 @@ ompi_convertor_pack_no_conv_contig_with_gaps( ompi_convertor_t* pConv,
extern int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
int ompi_convertor_init_for_send( ompi_convertor_t* pConv,
uint32_t flags,
dt_desc_t* dt,
const dt_desc_t* datatype,
int count,
void* pUserBuf,
const void* pUserBuf,
int starting_pos,
memalloc_fct_t allocfn )
{
OBJ_RETAIN( dt );
if( pConv->pDesc != dt ) {
pConv->pDesc = dt;
OBJ_RETAIN( datatype );
if( pConv->pDesc != datatype ) {
pConv->pDesc = (dt_desc_t*)datatype;
if( pConv->pStack != NULL ) free( pConv->pStack );
pConv->pStack = NULL;
}
if( pConv->pStack == NULL ) {
pConv->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * (dt->btypes[DT_LOOP] + 3) );
pConv->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * (datatype->btypes[DT_LOOP] + 3) );
pConv->stack_pos = 0; /* just to be sure */
}
pConv->flags = CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS; /* by default set to homogeneous */
pConv->pBaseBuf = pUserBuf;
pConv->available_space = count * (dt->ub - dt->lb);
pConv->pBaseBuf = (void*)pUserBuf;
pConv->available_space = count * (datatype->ub - datatype->lb);
pConv->count = count;
pConv->pFunctions = ompi_ddt_copy_functions;
pConv->converted = 0;
@ -768,9 +767,9 @@ int ompi_convertor_init_for_send( ompi_convertor_t* pConv,
/* Just to avoid complaint from the compiler */
pConv->fAdvance = ompi_convertor_pack_general;
pConv->fAdvance = ompi_convertor_pack_homogeneous_with_memcpy;
if( dt->flags & DT_FLAG_CONTIGUOUS ) {
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
pConv->flags |= DT_FLAG_CONTIGUOUS;
if( (pConv->pDesc->ub - pConv->pDesc->lb) == (long)pConv->pDesc->size )
if( (datatype->ub - datatype->lb) == (long)datatype->size )
pConv->fAdvance = ompi_convertor_pack_no_conv_contig;
else
pConv->fAdvance = ompi_convertor_pack_no_conv_contig_with_gaps;
@ -813,7 +812,7 @@ static void ompi_convertor_destruct( ompi_convertor_t* pConv )
OBJ_CLASS_INSTANCE(ompi_convertor_t, ompi_object_t, ompi_convertor_construct, ompi_convertor_destruct );
inline int ompi_convertor_copy( ompi_convertor_t* pSrcConv, ompi_convertor_t* pDestConv )
inline int ompi_convertor_copy( const ompi_convertor_t* pSrcConv, ompi_convertor_t* pDestConv )
{
pDestConv->remoteArch = pSrcConv->remoteArch;
pDestConv->flags = pSrcConv->flags;
@ -830,7 +829,7 @@ inline int ompi_convertor_copy( ompi_convertor_t* pSrcConv, ompi_convertor_t* pD
return OMPI_SUCCESS;
}
ompi_convertor_t* ompi_convertor_get_copy( ompi_convertor_t* pConvertor )
ompi_convertor_t* ompi_convertor_get_copy( const ompi_convertor_t* pConvertor )
{
ompi_convertor_t* pDestConv = OBJ_NEW(ompi_convertor_t);
(void)ompi_convertor_copy( pConvertor, pDestConv );
@ -838,7 +837,7 @@ ompi_convertor_t* ompi_convertor_get_copy( ompi_convertor_t* pConvertor )
}
/* Actually we suppose that we can only do receiver side conversion */
int ompi_convertor_get_packed_size( ompi_convertor_t* pConv, uint32_t* pSize )
int ompi_convertor_get_packed_size( const ompi_convertor_t* pConv, uint32_t* pSize )
{
int ddt_size = 0;
@ -849,7 +848,7 @@ int ompi_convertor_get_packed_size( ompi_convertor_t* pConv, uint32_t* pSize )
return OMPI_SUCCESS;
}
int ompi_convertor_get_unpacked_size( ompi_convertor_t* pConv, uint32_t* pSize )
int ompi_convertor_get_unpacked_size( const ompi_convertor_t* pConv, uint32_t* pSize )
{
int i;
dt_desc_t* pData = pConv->pDesc;

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

@ -25,85 +25,86 @@
* - communicator
* Returns: - MPI_SUCCESS or error code
*/
int ompi_ddt_sndrcv(void *sbuf, int scount, MPI_Datatype sdtype, void *rbuf,
int rcount, MPI_Datatype rdtype, int tag, MPI_Comm comm)
int ompi_ddt_sndrcv( void *sbuf, int scount, const ompi_datatype_t* sdtype, void *rbuf,
int rcount, const ompi_datatype_t* rdtype, int tag, MPI_Comm comm )
{
int err;
unsigned int size;
int rank;
int position = 0;
ompi_convertor_t *local_convertor;
ompi_request_t *req;
int err;
ompi_convertor_t *send_convertor, *recv_convertor;
struct iovec iov;
int length, completed;
uint32_t max_data, iov_count;
int32_t freeAfter;
/* If same datatypes used, just copy. */
/* First check if we really have something to do */
if( 0 == (rcount * scount) ) {
if( (0 == rcount) && (0 != scount) )
return MPI_ERR_TRUNCATE;
return MPI_SUCCESS;
}
/* If same datatypes used, just copy. */
if (sdtype == rdtype) {
max_data = ( scount < rcount ? scount : rcount );
ompi_ddt_copy_content_same_ddt(rdtype, max_data, (char*)rbuf, (char*)sbuf);
if( scount > rcount )
return MPI_ERR_TRUNCATE;
return MPI_SUCCESS;
}
if (sdtype == rdtype) {
if (scount <= rcount) {
ompi_ddt_copy_content_same_ddt(rdtype, scount, (char *) rbuf,
(char *) sbuf);
err = MPI_SUCCESS;
} else {
err = MPI_ERR_TRUNCATE;
}
}
/* If receive packed. */
/* If receive packed. */
else if (rdtype == MPI_PACKED) {
send_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_send( send_convertor, 0, sdtype, scount, sbuf, 0, NULL );
else if (rdtype == MPI_PACKED) {
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_send( local_convertor, 0, sdtype,
scount, NULL, 0, NULL );
err = ompi_convertor_get_packed_size(local_convertor, &size);
OBJ_RELEASE(local_convertor);
if( OMPI_SUCCESS != err ) {
return err;
}
iov_count = 1;
iov.iov_len = rcount;
iov.iov_base = rbuf;
max_data = ( iov.iov_len > (scount * sdtype->size) ? (scount * sdtype->size) : iov.iov_len );
if( (int)size <= rcount ) {
err = MPI_Pack(sbuf, scount, sdtype,
rbuf, rcount, &position, MPI_COMM_WORLD);
} else {
err = MPI_ERR_TRUNCATE;
}
}
err = ompi_convertor_pack( send_convertor, &iov, &iov_count, &max_data, &freeAfter );
if( max_data < (uint32_t)rcount )
err = MPI_ERR_TRUNCATE;
OBJ_RELEASE( send_convertor );
}
/* If send packed. */
/* If send packed. */
else if (sdtype == MPI_PACKED) {
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_send(local_convertor, 0, rdtype,
rcount, NULL, 0, NULL );
err = ompi_convertor_get_packed_size(local_convertor, &size);
OBJ_RELEASE(local_convertor);
if( OMPI_SUCCESS != err ) {
return err;
}
else if (sdtype == MPI_PACKED) {
recv_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_recv( recv_convertor, 0, rdtype, rcount, rbuf, 0, NULL );
if( scount <= (int)size ) {
err = MPI_Unpack(sbuf, scount, &position,
rbuf, rcount, rdtype,
MPI_COMM_WORLD);
} else {
err = MPI_ERR_TRUNCATE;
}
}
iov_count = 1;
iov.iov_len = scount;
iov.iov_base = sbuf;
max_data = ( iov.iov_len < (rcount * rdtype->size) ? iov.iov_len : (rcount * rdtype->size) );
/* Let the PML handle it (i.e., do a normal send/recv) */
err = ompi_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data, &freeAfter );
if( scount > (int32_t)(rcount * rdtype->size) )
err = MPI_ERR_TRUNCATE;
OBJ_RELEASE( recv_convertor );
}
else {
rank = ompi_comm_rank(comm);
err = mca_pml.pml_irecv(rbuf, rcount, rdtype, rank, tag, comm, &req);
if (MPI_SUCCESS != err) {
return err;
}
err = mca_pml.pml_send(sbuf, scount, sdtype, rank, tag,
MCA_PML_BASE_SEND_STANDARD, comm);
if (MPI_SUCCESS != err) {
return err;
}
err = ompi_request_wait(&req, MPI_STATUS_IGNORE);
}
iov.iov_len = length = 64 * 1024;
iov.iov_base = (void*)malloc( length * sizeof(char) );
return err;
send_convertor = OBJ_NEW(ompi_convertor_t);
recv_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_send( send_convertor, 0, sdtype, scount, sbuf, 0, NULL );
ompi_convertor_init_for_recv( recv_convertor, 0, rdtype, rcount, rbuf, 0, NULL );
completed = 0;
while( !completed ) {
iov.iov_len = length;
iov_count = 1;
max_data = length;
completed |= ompi_convertor_pack( send_convertor, &iov, &iov_count, &max_data, &freeAfter );
completed |= ompi_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data, &freeAfter );
}
free( iov.iov_base );
OBJ_RELEASE( send_convertor );
OBJ_RELEASE( recv_convertor );
return ( (scount * sdtype->size) <= (rcount * rdtype->size) ? MPI_SUCCESS : MPI_ERR_TRUNCATE );
}

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

@ -9,7 +9,7 @@
#endif
#include <stdlib.h>
void ompi_ddt_dump_stack( dt_stack_t* pStack, int stack_pos, dt_elem_desc_t* pDesc, char* name )
void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos, const dt_elem_desc_t* pDesc, const char* name )
{
printf( "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name );
for( ;stack_pos >= 0; stack_pos-- ) {
@ -592,25 +592,25 @@ int ompi_convertor_need_buffers( ompi_convertor_t* pConvertor )
extern int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
int ompi_convertor_init_for_recv( ompi_convertor_t* pConv, uint32_t flags,
dt_desc_t* pData, int count,
void* pUserBuf, int starting_point,
const dt_desc_t* datatype, int count,
const void* pUserBuf, int starting_point,
memalloc_fct_t allocfn )
{
OBJ_RETAIN( pData );
if( pConv->pDesc != pData ) {
pConv->pDesc = pData;
OBJ_RETAIN( datatype );
if( pConv->pDesc != datatype ) {
pConv->pDesc = (dt_desc_t*)datatype;
pConv->flags = CONVERTOR_RECV;
if( pConv->pStack != NULL ) free( pConv->pStack );
pConv->pStack = NULL;
}
if( pConv->pStack == NULL ) {
pConv->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * (pData->btypes[DT_LOOP] + 3) );
pConv->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * (datatype->btypes[DT_LOOP] + 3) );
pConv->stack_pos = 0;
}
pConv->flags = CONVERTOR_RECV | CONVERTOR_HOMOGENEOUS;
pConv->pBaseBuf = pUserBuf;
pConv->available_space = count * (pData->ub - pData->lb);
pConv->pBaseBuf = (void*)pUserBuf;
pConv->available_space = count * (datatype->ub - datatype->lb);
pConv->count = count;
pConv->pFunctions = ompi_ddt_copy_functions;
pConv->converted = 0;
@ -620,7 +620,7 @@ int ompi_convertor_init_for_recv( ompi_convertor_t* pConv, uint32_t flags,
pConv->memAlloc_fn = allocfn;
/* TODO: work only on homogeneous architectures */
if( pData->flags & DT_FLAG_CONTIGUOUS ) {
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
pConv->flags |= DT_FLAG_CONTIGUOUS;
pConv->fAdvance = ompi_convertor_unpack_homogeneous_contig;
}
@ -638,7 +638,7 @@ int ompi_convertor_init_for_recv( ompi_convertor_t* pConv, uint32_t flags,
* positive = number of basic elements inside
* negative = some error occurs
*/
int ompi_ddt_get_element_count( dt_desc_t* pData, int iSize )
int ompi_ddt_get_element_count( const dt_desc_t* datatype, int iSize )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
int pos_desc; /* actual position in the description of the derived datatype */
@ -646,22 +646,22 @@ int ompi_ddt_get_element_count( dt_desc_t* pData, int iSize )
int rc, nbElems = 0;
int stack_pos = 0;
DUMP( "dt_count_elements( %p, %d )\n", (void*)pData, iSize );
pStack = alloca( sizeof(pStack) * (pData->btypes[DT_LOOP] + 2) );
DUMP( "dt_count_elements( %p, %d )\n", (void*)datatype, iSize );
pStack = alloca( sizeof(pStack) * (datatype->btypes[DT_LOOP] + 2) );
pStack->count = 1;
pStack->index = -1;
pStack->end_loop = pData->desc.used;
pStack->end_loop = datatype->desc.used;
pStack->disp = 0;
pos_desc = 0;
DUMP_STACK( pStack, stack_pos, pData->desc.desc, "starting" );
DUMP_STACK( pStack, stack_pos, datatype->desc.desc, "starting" );
DUMP( "remember position on stack %d last_elem at %d\n", stack_pos, pos_desc );
DUMP( "top stack info {index = %d, count = %d}\n",
pStack->index, pStack->count );
next_loop:
while( pos_desc >= 0 ) {
if( pData->desc.desc[pos_desc].type == DT_END_LOOP ) { /* end of the current loop */
if( datatype->desc.desc[pos_desc].type == DT_END_LOOP ) { /* end of the current loop */
if( --(pStack->count) == 0 ) { /* end of loop */
stack_pos--;
pStack--;
@ -670,29 +670,29 @@ int ompi_ddt_get_element_count( dt_desc_t* pData, int iSize )
}
pos_desc = pStack->index;
if( pos_desc == -1 )
pStack->disp += (pData->ub - pData->lb);
pStack->disp += (datatype->ub - datatype->lb);
else
pStack->disp += pData->desc.desc[pos_desc].extent;
pStack->disp += datatype->desc.desc[pos_desc].extent;
pos_desc++;
goto next_loop;
}
if( pData->desc.desc[pos_desc].type == DT_LOOP ) {
if( datatype->desc.desc[pos_desc].type == DT_LOOP ) {
do {
PUSH_STACK( pStack, stack_pos, pos_desc, pData->desc.desc[pos_desc].count,
0, pos_desc + pData->desc.desc[pos_desc].disp );
PUSH_STACK( pStack, stack_pos, pos_desc, datatype->desc.desc[pos_desc].count,
0, pos_desc + datatype->desc.desc[pos_desc].disp );
pos_desc++;
} while( pData->desc.desc[pos_desc].type == DT_LOOP ); /* let's start another loop */
DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" );
} while( datatype->desc.desc[pos_desc].type == DT_LOOP ); /* let's start another loop */
DUMP_STACK( pStack, stack_pos, datatype->desc.desc, "advance loops" );
goto next_loop;
}
/* now here we have a basic datatype */
type = pData->desc.desc[pos_desc].type;
rc = pData->desc.desc[pos_desc].count * ompi_ddt_basicDatatypes[type]->size;
type = datatype->desc.desc[pos_desc].type;
rc = datatype->desc.desc[pos_desc].count * ompi_ddt_basicDatatypes[type]->size;
if( rc >= iSize ) {
nbElems += iSize / ompi_ddt_basicDatatypes[type]->size;
break;
}
nbElems += pData->desc.desc[pos_desc].count;
nbElems += datatype->desc.desc[pos_desc].count;
iSize -= rc;
pos_desc++; /* advance to the next data */
@ -702,8 +702,8 @@ int ompi_ddt_get_element_count( dt_desc_t* pData, int iSize )
return nbElems;
}
int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
char* pDestBuf, char* pSrcBuf )
int ompi_ddt_copy_content_same_ddt( const dt_desc_t* datatype, int count,
char* pDestBuf, const char* pSrcBuf )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
int pos_desc; /* actual position in the description of the derived datatype */
@ -720,15 +720,15 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
/* If we have to copy a contiguous datatype then simply
* do a memcpy.
*/
if( (pData->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) {
long extent = (pData->ub - pData->lb);
if( (long)pData->size == extent ) { /* all contiguous */
int total_length = pData->size * count;
if( (datatype->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) {
long extent = (datatype->ub - datatype->lb);
if( (long)datatype->size == extent ) { /* all contiguous */
int total_length = datatype->size * count;
lastLength = 128 * 1024;
if( lastLength > total_length ) lastLength = total_length;
while( total_length > 0 ) {
OMPI_DDT_SAFEGUARD_POINTER( pDestBuf, lastLength,
pDestBuf, pData, count );
pDestBuf, datatype, count );
MEMCPY( pDestBuf, pSrcBuf, lastLength );
pDestBuf += lastLength;
pSrcBuf += lastLength;
@ -737,9 +737,9 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
}
} else {
for( pos_desc = 0; pos_desc < count; pos_desc++ ) {
OMPI_DDT_SAFEGUARD_POINTER( pDestBuf, pData->size,
pDestBuf, pData, count );
MEMCPY( pDestBuf, pSrcBuf, pData->size );
OMPI_DDT_SAFEGUARD_POINTER( pDestBuf, datatype->size,
pDestBuf, datatype, count );
MEMCPY( pDestBuf, pSrcBuf, datatype->size );
pDestBuf += extent;
pSrcBuf += extent;
}
@ -747,18 +747,18 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
return 0;
}
pStack = alloca( sizeof(pStack) * (pData->btypes[DT_LOOP] + 1) );
pStack = alloca( sizeof(pStack) * (datatype->btypes[DT_LOOP] + 1) );
pStack->count = count;
pStack->index = -1;
pStack->disp = 0;
pos_desc = 0;
if( pData->opt_desc.desc != NULL ) {
pElems = pData->opt_desc.desc;
pStack->end_loop = pData->opt_desc.used;
if( datatype->opt_desc.desc != NULL ) {
pElems = datatype->opt_desc.desc;
pStack->end_loop = datatype->opt_desc.used;
} else {
pElems = pData->desc.desc;
pStack->end_loop = pData->desc.used;
pElems = datatype->desc.desc;
pStack->end_loop = datatype->desc.used;
}
DUMP_STACK( pStack, stack_pos, pElems, "starting" );
@ -774,7 +774,7 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
}
pos_desc = pStack->index;
if( pos_desc == -1 )
pStack->disp += (pData->ub - pData->lb);
pStack->disp += (datatype->ub - datatype->lb);
else
pStack->disp += pElems[pos_desc].extent;
pos_desc++;
@ -794,7 +794,7 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
lastLength += pElems[pos_desc].count * ompi_ddt_basicDatatypes[type]->size;
} else {
OMPI_DDT_SAFEGUARD_POINTER( pDestBuf + lastDisp, lastLength,
pDestBuf, pData, count );
pDestBuf, datatype, count );
MEMCPY( pDestBuf + lastDisp, pSrcBuf + lastDisp, lastLength );
lastDisp = pStack->disp + pElems[pos_desc].disp;
lastLength = pElems[pos_desc].count * ompi_ddt_basicDatatypes[type]->size;
@ -805,7 +805,7 @@ int ompi_ddt_copy_content_same_ddt( dt_desc_t* pData, int count,
end_loop:
if( lastLength != 0 ) {
OMPI_DDT_SAFEGUARD_POINTER( pDestBuf + lastDisp, lastLength,
pDestBuf, pData, count );
pDestBuf, datatype, count );
MEMCPY( pDestBuf + lastDisp, pSrcBuf + lastDisp, lastLength );
}
/* cleanup the stack */

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

@ -11,10 +11,10 @@
#include <stdlib.h>
int ompi_convertor_create_stack_with_pos( ompi_convertor_t* pConvertor,
int starting_point, int* sizes );
int starting_point, const int* sizes );
static inline size_t
ompi_convertor_compute_remote_size( ompi_datatype_t* pData, int* sizes )
ompi_convertor_compute_remote_size( const ompi_datatype_t* pData, const int* sizes )
{
uint32_t i;
size_t length = 0;
@ -26,7 +26,7 @@ ompi_convertor_compute_remote_size( ompi_datatype_t* pData, int* sizes )
}
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
int starting_point, int* sizes )
int starting_point, const int* sizes )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
int pos_desc; /* actual position in the description of the derived datatype */