opal/datatype: correctly handle large datatypes
Always use size_t (instead of converting to an uint32_t) in order to correctly support large datatypes. Thanks Ben Menadue for the initial bug report Refs open-mpi/ompi#6016 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
a2bea960bc
Коммит
320a839be9
@ -12,8 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2013-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2013-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -330,7 +330,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
const opal_datatype_t* pData = pConvertor->pDesc;
|
||||
dt_elem_desc_t* pElems;
|
||||
uint32_t count;
|
||||
size_t count;
|
||||
ptrdiff_t extent;
|
||||
|
||||
pStack = pConvertor->pStack;
|
||||
@ -340,7 +340,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
|
||||
*/
|
||||
pElems = pConvertor->use_desc->desc;
|
||||
|
||||
count = (uint32_t)(starting_point / pData->size);
|
||||
count = starting_point / pData->size;
|
||||
extent = pData->ub - pData->lb;
|
||||
|
||||
pStack[0].type = OPAL_DATATYPE_LOOP; /* the first one is always the loop */
|
||||
@ -349,7 +349,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
|
||||
pStack[0].disp = count * extent;
|
||||
|
||||
/* now compute the number of pending bytes */
|
||||
count = (uint32_t)(starting_point - count * pData->size);
|
||||
count = starting_point - count * pData->size;
|
||||
/**
|
||||
* We save the current displacement starting from the begining
|
||||
* of this data.
|
||||
@ -563,7 +563,7 @@ size_t opal_convertor_compute_remote_size( opal_convertor_t* pConvertor )
|
||||
|
||||
int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf )
|
||||
{
|
||||
/* Here I should check that the data is not overlapping */
|
||||
@ -605,7 +605,7 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
|
||||
|
||||
int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf )
|
||||
{
|
||||
convertor->flags |= CONVERTOR_SEND;
|
||||
@ -699,11 +699,11 @@ int opal_convertor_clone( const opal_convertor_t* source,
|
||||
|
||||
void opal_convertor_dump( opal_convertor_t* convertor )
|
||||
{
|
||||
opal_output( 0, "Convertor %p count %d stack position %d bConverted %ld\n"
|
||||
"\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %d\n"
|
||||
opal_output( 0, "Convertor %p count %" PRIsize_t" stack position %d bConverted %" PRIsize_t "\n"
|
||||
"\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %" PRIsize_t "\n"
|
||||
"\tremote_arch %u local_arch %u\n",
|
||||
(void*)convertor,
|
||||
convertor->count, convertor->stack_pos, (unsigned long)convertor->bConverted,
|
||||
convertor->count, convertor->stack_pos, convertor->bConverted,
|
||||
(unsigned long)convertor->local_size, (unsigned long)convertor->remote_size,
|
||||
convertor->flags, convertor->stack_size, convertor->partial_length,
|
||||
convertor->remoteArch, opal_local_arch );
|
||||
@ -734,8 +734,8 @@ void opal_datatype_dump_stack( const dt_stack_t* pStack, int stack_pos,
|
||||
{
|
||||
opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name );
|
||||
for( ; stack_pos >= 0; stack_pos-- ) {
|
||||
opal_output( 0, "%d: pos %d count %d disp %ld ", stack_pos, pStack[stack_pos].index,
|
||||
(int)pStack[stack_pos].count, (long)pStack[stack_pos].disp );
|
||||
opal_output( 0, "%d: pos %d count %" PRIsize_t " disp %ld ", stack_pos, pStack[stack_pos].index,
|
||||
pStack[stack_pos].count, pStack[stack_pos].disp );
|
||||
if( pStack->index != -1 )
|
||||
opal_output( 0, "\t[desc count %lu disp %ld extent %ld]\n",
|
||||
(unsigned long)pDesc[pStack[stack_pos].index].elem.count,
|
||||
|
@ -12,8 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -74,6 +74,7 @@ struct opal_convertor_master_t;
|
||||
struct dt_stack_t {
|
||||
int32_t index; /**< index in the element description */
|
||||
int16_t type; /**< the type used for the last pack/unpack (original or OPAL_DATATYPE_UINT1) */
|
||||
int16_t padding;
|
||||
size_t count; /**< number of times we still have to do it */
|
||||
ptrdiff_t disp; /**< actual displacement depending on the count field */
|
||||
};
|
||||
@ -94,7 +95,8 @@ struct opal_convertor_t {
|
||||
const dt_type_desc_t* use_desc; /**< the version used by the convertor (normal or optimized) */
|
||||
opal_datatype_count_t count; /**< the total number of full datatype elements */
|
||||
uint32_t stack_size; /**< size of the allocated stack */
|
||||
/* --- cacheline 1 boundary (64 bytes) --- */
|
||||
|
||||
/* --- cacheline boundary (64 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */
|
||||
unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */
|
||||
dt_stack_t* pStack; /**< the local stack for the actual conversion */
|
||||
convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */
|
||||
@ -102,21 +104,19 @@ struct opal_convertor_t {
|
||||
|
||||
/* All others fields get modified for every call to pack/unpack functions */
|
||||
uint32_t stack_pos; /**< the actual position on the stack */
|
||||
uint32_t partial_length; /**< amount of data left over from the last unpack */
|
||||
size_t partial_length; /**< amount of data left over from the last unpack */
|
||||
size_t bConverted; /**< # of bytes already converted */
|
||||
uint32_t checksum; /**< checksum computed by pack/unpack operation */
|
||||
uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */
|
||||
size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */
|
||||
/* --- cacheline 2 boundary (128 bytes) --- */
|
||||
|
||||
/* --- fields are no more aligned on cacheline --- */
|
||||
dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */
|
||||
/* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */
|
||||
|
||||
#if OPAL_CUDA_SUPPORT
|
||||
memcpy_fct_t cbmemcpy; /**< memcpy or cuMemcpy */
|
||||
void * stream; /**< CUstream for async copy */
|
||||
#endif
|
||||
/* size: 248, cachelines: 4, members: 20 */
|
||||
/* last cacheline: 56 bytes */
|
||||
};
|
||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION( opal_convertor_t );
|
||||
|
||||
@ -251,12 +251,12 @@ static inline void opal_convertor_get_offset_pointer( const opal_convertor_t* pC
|
||||
*/
|
||||
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf);
|
||||
|
||||
static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_convertor_t* pSrcConv,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf,
|
||||
int32_t flags,
|
||||
opal_convertor_t* convertor )
|
||||
@ -273,11 +273,11 @@ static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_conve
|
||||
*/
|
||||
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf );
|
||||
static inline int32_t opal_convertor_copy_and_prepare_for_recv( const opal_convertor_t* pSrcConv,
|
||||
const struct opal_datatype_t* datatype,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
const void* pUserBuf,
|
||||
int32_t flags,
|
||||
opal_convertor_t* convertor )
|
||||
|
@ -43,11 +43,11 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
const opal_datatype_t *pData = pConvertor->pDesc;
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
dt_elem_desc_t* description, *pElem;
|
||||
unsigned char *source_base; /* origin of the data */
|
||||
size_t raw_data = 0; /* sum of raw data lengths in the iov_len fields */
|
||||
uint32_t index = 0, i; /* the iov index and a simple counter */
|
||||
uint32_t index = 0; /* the iov index and a simple counter */
|
||||
|
||||
assert( (*iov_count) > 0 );
|
||||
if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_COMPLETED) ) {
|
||||
@ -83,15 +83,15 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
source_base += pStack->disp;
|
||||
DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
|
||||
while( 1 ) {
|
||||
while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) {
|
||||
size_t blength = opal_datatype_basicDatatypes[pElem->elem.common.type]->size;
|
||||
@ -112,7 +112,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
count_desc = 0;
|
||||
}
|
||||
} else {
|
||||
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
||||
for(size_t i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
|
||||
pConvertor->pDesc, pConvertor->count );
|
||||
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n",
|
||||
@ -134,9 +134,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
goto complete_loop;
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "raw end_loop count %d stack_pos %d"
|
||||
DO_DEBUG( opal_output( 0, "raw end_loop count %" PRIsize_t " stack_pos %d"
|
||||
" pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos,
|
||||
pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( pConvertor->stack_pos == 0 ) {
|
||||
@ -160,9 +160,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
}
|
||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "raw new_loop count %d stack_pos %d "
|
||||
DO_DEBUG( opal_output( 0, "raw new_loop count %" PRIsize_t " stack_pos %d "
|
||||
"pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos,
|
||||
pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
@ -172,7 +172,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
|
||||
if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
|
||||
ptrdiff_t offset = end_loop->first_elem_disp;
|
||||
source_base += offset;
|
||||
for(uint32_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) {
|
||||
for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
|
||||
pConvertor->pDesc, pConvertor->count );
|
||||
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
|
||||
@ -216,7 +216,7 @@ complete_loop:
|
||||
/* I complete an element, next step I should go to the next one */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc,
|
||||
source_base - pStack->disp - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -39,18 +39,17 @@
|
||||
* Return value: Number of elements of type TYPE copied
|
||||
*/
|
||||
#define COPY_TYPE( TYPENAME, TYPE, COUNT ) \
|
||||
static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, \
|
||||
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance) \
|
||||
static int copy_##TYPENAME( opal_convertor_t *pConvertor, size_t count, \
|
||||
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance) \
|
||||
{ \
|
||||
uint32_t i; \
|
||||
size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \
|
||||
size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \
|
||||
\
|
||||
/* make sure the remote buffer is large enough to hold the data */ \
|
||||
if( (remote_TYPE_size * count) > from_len ) { \
|
||||
count = (uint32_t)(from_len / remote_TYPE_size); \
|
||||
count = from_len / remote_TYPE_size; \
|
||||
if( (count * remote_TYPE_size) != from_len ) { \
|
||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
||||
from_len - (count * remote_TYPE_size) ); \
|
||||
@ -67,7 +66,7 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count,
|
||||
MEMCPY( to, from, count * local_TYPE_size ); \
|
||||
} else { \
|
||||
/* source or destination are non-contigous */ \
|
||||
for( i = 0; i < count; i++ ) { \
|
||||
for(size_t i = 0; i < count; i++ ) { \
|
||||
MEMCPY( to, from, local_TYPE_size ); \
|
||||
to += to_extent; \
|
||||
from += from_extent; \
|
||||
@ -92,17 +91,16 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count,
|
||||
* Return value: Number of elements of type TYPE copied
|
||||
*/
|
||||
#define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \
|
||||
static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t count, \
|
||||
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance ) \
|
||||
static size_t copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, size_t count, \
|
||||
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance ) \
|
||||
{ \
|
||||
uint32_t i; \
|
||||
size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \
|
||||
size_t local_TYPE_size = (size_t)(COUNT); \
|
||||
\
|
||||
if( (remote_TYPE_size * count) > from_len ) { \
|
||||
count = (uint32_t)(from_len / remote_TYPE_size); \
|
||||
count = from_len / remote_TYPE_size; \
|
||||
if( (count * remote_TYPE_size) != from_len ) { \
|
||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
||||
from_len - (count * remote_TYPE_size) ); \
|
||||
@ -117,7 +115,7 @@ static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t cou
|
||||
(to_extent == (ptrdiff_t)remote_TYPE_size) ) { \
|
||||
MEMCPY( to, from, count * local_TYPE_size ); \
|
||||
} else { \
|
||||
for( i = 0; i < count; i++ ) { \
|
||||
for(size_t i = 0; i < count; i++ ) { \
|
||||
MEMCPY( to, from, local_TYPE_size ); \
|
||||
to += to_extent; \
|
||||
from += from_extent; \
|
||||
|
@ -4,9 +4,8 @@
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -140,12 +139,12 @@ opal_dt_swap_long_double(void *to_p, const void *from_p, const size_t size, size
|
||||
|
||||
#define COPY_TYPE_HETEROGENEOUS_INTERNAL( TYPENAME, TYPE, LONG_DOUBLE ) \
|
||||
static int32_t \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \
|
||||
const char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_length, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance) \
|
||||
{ \
|
||||
uint32_t i; \
|
||||
size_t i; \
|
||||
\
|
||||
datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \
|
||||
from, from_len, from_extent, \
|
||||
@ -188,12 +187,12 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count,
|
||||
|
||||
#define COPY_2SAMETYPE_HETEROGENEOUS_INTERNAL( TYPENAME, TYPE, LONG_DOUBLE) \
|
||||
static int32_t \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \
|
||||
const char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_length, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance) \
|
||||
{ \
|
||||
uint32_t i; \
|
||||
size_t i; \
|
||||
\
|
||||
datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \
|
||||
from, from_len, from_extent, \
|
||||
@ -233,12 +232,12 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count,
|
||||
|
||||
#define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \
|
||||
static int32_t \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \
|
||||
const char* from, uint32_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, uint32_t to_length, ptrdiff_t to_extent, \
|
||||
copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \
|
||||
const char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||
char* to, size_t to_length, ptrdiff_t to_extent, \
|
||||
ptrdiff_t *advance) \
|
||||
{ \
|
||||
uint32_t i; \
|
||||
size_t i; \
|
||||
\
|
||||
datatype_check( #TYPENAME, sizeof(TYPE1) + sizeof(TYPE2), \
|
||||
sizeof(TYPE1) + sizeof(TYPE2), &count, \
|
||||
@ -276,13 +275,13 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \
|
||||
|
||||
|
||||
static inline void
|
||||
datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count,
|
||||
datatype_check(char *type, size_t local_size, size_t remote_size, size_t *count,
|
||||
const char* from, size_t from_len, ptrdiff_t from_extent,
|
||||
char* to, size_t to_len, ptrdiff_t to_extent)
|
||||
{
|
||||
/* make sure the remote buffer is large enough to hold the data */
|
||||
if( (remote_size * *count) > from_len ) {
|
||||
*count = (uint32_t)(from_len / remote_size);
|
||||
*count = from_len / remote_size;
|
||||
if( (*count * remote_size) != from_len ) {
|
||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n",
|
||||
from_len - (*count * remote_size) );
|
||||
@ -296,20 +295,18 @@ datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *coun
|
||||
}
|
||||
|
||||
#define CXX_BOOL_COPY_LOOP(TYPE) \
|
||||
for( i = 0; i < count; i++ ) { \
|
||||
for(size_t i = 0; i < count; i++ ) { \
|
||||
bool *to_real = (bool*) to; \
|
||||
*to_real = *((TYPE*) from) == 0 ? false : true; \
|
||||
to += to_extent; \
|
||||
from += from_extent; \
|
||||
}
|
||||
static int32_t
|
||||
copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, uint32_t count,
|
||||
const char* from, uint32_t from_len, ptrdiff_t from_extent,
|
||||
char* to, uint32_t to_length, ptrdiff_t to_extent,
|
||||
copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, size_t count,
|
||||
const char* from, size_t from_len, ptrdiff_t from_extent,
|
||||
char* to, size_t to_length, ptrdiff_t to_extent,
|
||||
ptrdiff_t *advance)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
/* fix up the from extent */
|
||||
if ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) !=
|
||||
(opal_local_arch & OPAL_ARCH_BOOLISxx)) {
|
||||
|
@ -86,7 +86,7 @@ BEGIN_C_DECLS
|
||||
* associated type.
|
||||
*/
|
||||
#define MAX_DT_COMPONENT_COUNT UINT_MAX
|
||||
typedef uint32_t opal_datatype_count_t;
|
||||
typedef size_t opal_datatype_count_t;
|
||||
|
||||
typedef union dt_elem_desc dt_elem_desc_t;
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -43,12 +43,12 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM,
|
||||
const opal_datatype_t* DATATYPE,
|
||||
unsigned char* SOURCE_BASE,
|
||||
size_t TOTAL_COUNT,
|
||||
uint32_t COUNT,
|
||||
size_t COUNT,
|
||||
unsigned char* SOURCE,
|
||||
unsigned char* DESTINATION,
|
||||
size_t* SPACE )
|
||||
{
|
||||
uint32_t _copy_count = (COUNT);
|
||||
size_t _copy_count = (COUNT);
|
||||
size_t _copy_blength;
|
||||
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||
unsigned char* _source = (SOURCE) + _elem->disp;
|
||||
@ -56,19 +56,18 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM,
|
||||
|
||||
_copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size;
|
||||
|
||||
if( _copy_blength == (uint32_t)_elem->extent ) {
|
||||
if( _copy_blength == (size_t)_elem->extent ) {
|
||||
_copy_blength *= _copy_count;
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE),
|
||||
(DATATYPE), (TOTAL_COUNT) );
|
||||
/* the extent and the size of the basic datatype are equals */
|
||||
DO_DEBUG( opal_output( 0, "copy 1. %s( %p, %p, %lu ) => space %lu\n",
|
||||
STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); );
|
||||
DO_DEBUG( opal_output( 0, "copy 1. %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n",
|
||||
STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, _copy_blength, *(SPACE) ); );
|
||||
MEM_OP( _destination, _source, _copy_blength );
|
||||
_source += _copy_blength;
|
||||
_destination += _copy_blength;
|
||||
} else {
|
||||
uint32_t _i;
|
||||
for( _i = 0; _i < _copy_count; _i++ ) {
|
||||
for(size_t _i = 0; _i < _copy_count; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE),
|
||||
(DATATYPE), (TOTAL_COUNT) );
|
||||
DO_DEBUG( opal_output( 0, "copy 2. %s( %p, %p, %lu ) => space %lu\n",
|
||||
@ -86,7 +85,7 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM,
|
||||
const opal_datatype_t* DATATYPE,
|
||||
unsigned char* SOURCE_BASE,
|
||||
size_t TOTAL_COUNT,
|
||||
uint32_t COUNT,
|
||||
size_t COUNT,
|
||||
unsigned char* SOURCE,
|
||||
unsigned char* DESTINATION,
|
||||
size_t* SPACE )
|
||||
@ -96,7 +95,6 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM,
|
||||
unsigned char* _source = (SOURCE) + _end_loop->first_elem_disp;
|
||||
unsigned char* _destination = (DESTINATION) + _end_loop->first_elem_disp;
|
||||
size_t _copy_loops = (COUNT);
|
||||
uint32_t _i;
|
||||
|
||||
if( _loop->extent == (ptrdiff_t)_end_loop->size ) { /* the loop is contiguous */
|
||||
_copy_loops *= _end_loop->size;
|
||||
@ -104,11 +102,11 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM,
|
||||
(DATATYPE), (TOTAL_COUNT) );
|
||||
MEM_OP( _destination, _source, _copy_loops );
|
||||
} else {
|
||||
for( _i = 0; _i < _copy_loops; _i++ ) {
|
||||
for(size_t _i = 0; _i < _copy_loops; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (SOURCE_BASE),
|
||||
(DATATYPE), (TOTAL_COUNT) );
|
||||
DO_DEBUG( opal_output( 0, "copy 3. %s( %p, %p, %lu ) => space %lu\n",
|
||||
STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); );
|
||||
DO_DEBUG( opal_output( 0, "copy 3. %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n",
|
||||
STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, _end_loop->size, *(SPACE) - _i * _end_loop->size ); );
|
||||
MEM_OP( _destination, _source, _end_loop->size );
|
||||
_source += _loop->extent;
|
||||
_destination += _loop->extent;
|
||||
@ -207,8 +205,8 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "copy end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "copy end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, stack_pos, pos_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( stack_pos == 0 ) {
|
||||
assert( iov_len_local == 0 );
|
||||
@ -229,8 +227,8 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i
|
||||
source = (unsigned char*)source_base + pStack->disp;
|
||||
destination = (unsigned char*)destination_base + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "copy new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "copy new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, stack_pos, pos_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
ptrdiff_t local_disp = (ptrdiff_t)source;
|
||||
|
@ -13,6 +13,8 @@
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -96,9 +98,9 @@ int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr,
|
||||
(int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp,
|
||||
(int)pDesc->end_loop.size );
|
||||
else
|
||||
index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) blen %d extent %d (size %ld)\n",
|
||||
(int)pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen,
|
||||
(int)pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) );
|
||||
index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%lx (%ld) blen %d extent %ld (size %ld)\n",
|
||||
pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen,
|
||||
pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) );
|
||||
pDesc++;
|
||||
|
||||
if( length <= (size_t)index ) break;
|
||||
@ -118,11 +120,11 @@ void opal_datatype_dump( const opal_datatype_t* pData )
|
||||
buffer = (char*)malloc( length );
|
||||
index += snprintf( buffer, length - index, "Datatype %p[%s] 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"
|
||||
"nbElems %d loops %d flags %X (",
|
||||
"nbElems %" PRIsize_t " loops %d flags %X (",
|
||||
(void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used,
|
||||
(long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb),
|
||||
(long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb),
|
||||
(int)pData->nbElems, (int)pData->loops, (int)pData->flags );
|
||||
pData->nbElems, (int)pData->loops, (int)pData->flags );
|
||||
/* dump the flags */
|
||||
if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED )
|
||||
index += snprintf( buffer + index, length - index, "predefined " );
|
||||
|
@ -11,8 +11,8 @@
|
||||
* Copyright (c) 2004-2006 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -47,7 +47,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor,
|
||||
size_t loop_length, *remoteLength, remote_size;
|
||||
size_t resting_place = starting_point;
|
||||
dt_elem_desc_t* pElems;
|
||||
uint32_t count;
|
||||
size_t count;
|
||||
|
||||
assert( 0 != starting_point );
|
||||
assert( pConvertor->bConverted != starting_point );
|
||||
@ -93,7 +93,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor,
|
||||
/* remove from the main loop all the complete datatypes */
|
||||
assert (! (pConvertor->flags & CONVERTOR_SEND));
|
||||
remote_size = opal_convertor_compute_remote_size( pConvertor );
|
||||
count = (int32_t)(starting_point / remote_size);
|
||||
count = starting_point / remote_size;
|
||||
resting_place -= (remote_size * count);
|
||||
pStack->count = pConvertor->count - count;
|
||||
pStack->index = -1;
|
||||
|
@ -12,8 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
static int32_t
|
||||
opal_datatype_optimize_short( opal_datatype_t* pData,
|
||||
int32_t count,
|
||||
size_t count,
|
||||
dt_type_desc_t* pTypeDesc )
|
||||
{
|
||||
dt_elem_desc_t* pElemDesc;
|
||||
|
@ -12,8 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -114,7 +114,8 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv,
|
||||
const opal_datatype_t* pData = pConv->pDesc;
|
||||
dt_stack_t* stack = pConv->pStack;
|
||||
unsigned char *user_memory, *packed_buffer;
|
||||
uint32_t i, index, iov_count;
|
||||
uint32_t iov_count, index;
|
||||
size_t i;
|
||||
size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted;
|
||||
ptrdiff_t extent= pData->ub - pData->lb;
|
||||
ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
||||
@ -134,20 +135,20 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv,
|
||||
/* Limit the amount of packed data to the data left over on this convertor */
|
||||
remaining = pConv->local_size - pConv->bConverted;
|
||||
if( 0 == remaining ) break; /* we're done this time */
|
||||
if( remaining > (uint32_t)iov[iov_count].iov_len )
|
||||
if( remaining > iov[iov_count].iov_len )
|
||||
remaining = iov[iov_count].iov_len;
|
||||
packed_buffer = (unsigned char *)iov[iov_count].iov_base;
|
||||
bConverted = remaining; /* how much will get unpacked this time */
|
||||
user_memory = pConv->pBaseBuf + initial_displ + stack[0].disp + stack[1].disp;
|
||||
i = pConv->count - stack[0].count; /* how many we already packed */
|
||||
assert(i == ((uint32_t)(pConv->bConverted / pData->size)));
|
||||
assert(i == (pConv->bConverted / pData->size));
|
||||
|
||||
if( packed_buffer == NULL ) {
|
||||
/* special case for small data. We avoid allocating memory if we
|
||||
* can fill the iovec directly with the address of the remaining
|
||||
* data.
|
||||
*/
|
||||
if( (uint32_t)stack->count < ((*out_size) - iov_count) ) {
|
||||
if( stack->count < (size_t)((*out_size) - iov_count) ) {
|
||||
stack[1].count = pData->size - (pConv->bConverted % pData->size);
|
||||
for( index = iov_count; i < pConv->count; i++, index++ ) {
|
||||
iov[index].iov_base = (IOVBASE_TYPE *) user_memory;
|
||||
@ -278,7 +279,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t total_packed = 0; /* total amount packed this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
@ -300,15 +301,15 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
|
||||
DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
iov_ptr = (unsigned char *) iov[iov_count].iov_base;
|
||||
@ -327,10 +328,10 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
goto complete_loop;
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d"
|
||||
DO_DEBUG( opal_output( 0, "pack end_loop count %" PRIsize_t " stack_pos %d"
|
||||
" pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( 0 == pConvertor->stack_pos ) {
|
||||
/* we're done. Force the exit of the main for loop (around iovec) */
|
||||
@ -351,9 +352,9 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
}
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d count_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "pack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
count_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
ptrdiff_t local_disp = (ptrdiff_t)conv_ptr;
|
||||
@ -390,8 +391,8 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
/* Save the global position for the next round */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc,
|
||||
conv_ptr - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -411,7 +412,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor,
|
||||
static inline void
|
||||
pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR,
|
||||
const dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** SOURCE,
|
||||
unsigned char** DESTINATION,
|
||||
size_t* SPACE )
|
||||
@ -420,12 +421,12 @@ pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR,
|
||||
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||
unsigned char* _source = (*SOURCE) + _elem->disp;
|
||||
ptrdiff_t advance;
|
||||
uint32_t _count = *(COUNT);
|
||||
size_t _count = *(COUNT);
|
||||
size_t _r_blength;
|
||||
|
||||
_r_blength = master->remote_sizes[_elem->common.type];
|
||||
if( (_count * _r_blength) > *(SPACE) ) {
|
||||
_count = (uint32_t)(*(SPACE) / _r_blength);
|
||||
_count = (*(SPACE) / _r_blength);
|
||||
if( 0 == _count ) return; /* nothing to do */
|
||||
}
|
||||
|
||||
@ -454,7 +455,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t total_packed = 0; /* total amount packed this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
@ -476,15 +477,15 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
|
||||
DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
iov_ptr = (unsigned char *) iov[iov_count].iov_base;
|
||||
@ -492,7 +493,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
while( 1 ) {
|
||||
while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) {
|
||||
/* now here we have a basic datatype */
|
||||
DO_DEBUG( opal_output( 0, "pack (%p:%ld, %d, %ld) -> (%p, %ld) type %s\n",
|
||||
DO_DEBUG( opal_output( 0, "pack (%p:%ld, %" PRIsize_t ", %ld) -> (%p, %ld) type %s\n",
|
||||
(void*)pConvertor->pBaseBuf, conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf,
|
||||
count_desc, description[pos_desc].elem.extent,
|
||||
(void*)iov_ptr, iov_len_local,
|
||||
@ -513,10 +514,10 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
goto complete_loop;
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d"
|
||||
DO_DEBUG( opal_output( 0, "pack end_loop count %" PRIsize_t " stack_pos %d"
|
||||
" pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
pStack->count, pConvertor->stack_pos,
|
||||
pos_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( 0 == pConvertor->stack_pos ) {
|
||||
/* we lie about the size of the next element in order to
|
||||
@ -539,9 +540,9 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
}
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d count_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "pack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
count_desc, pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
ptrdiff_t local_disp = (ptrdiff_t)conv_ptr;
|
||||
@ -583,7 +584,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor,
|
||||
/* Save the global position for the next round */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc,
|
||||
conv_ptr - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t" disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -30,19 +30,19 @@
|
||||
|
||||
static inline void pack_predefined_data( opal_convertor_t* CONVERTOR,
|
||||
const dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** SOURCE,
|
||||
unsigned char** DESTINATION,
|
||||
size_t* SPACE )
|
||||
{
|
||||
uint32_t _copy_count = *(COUNT);
|
||||
size_t _copy_count = *(COUNT);
|
||||
size_t _copy_blength;
|
||||
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||
unsigned char* _source = (*SOURCE) + _elem->disp;
|
||||
|
||||
_copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size;
|
||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||
_copy_count = (*(SPACE) / _copy_blength);
|
||||
if( 0 == _copy_count ) return; /* nothing to do */
|
||||
}
|
||||
|
||||
@ -57,8 +57,7 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR,
|
||||
_source += _copy_blength;
|
||||
*(DESTINATION) += _copy_blength;
|
||||
} else {
|
||||
uint32_t _i;
|
||||
for( _i = 0; _i < _copy_count; _i++ ) {
|
||||
for(size_t _i = 0; _i < _copy_count; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf,
|
||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||
DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n",
|
||||
@ -76,7 +75,7 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR,
|
||||
|
||||
static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR,
|
||||
const dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** SOURCE,
|
||||
unsigned char** DESTINATION,
|
||||
size_t* SPACE )
|
||||
@ -84,12 +83,11 @@ static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR,
|
||||
const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||
const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
||||
unsigned char* _source = (*SOURCE) + _end_loop->first_elem_disp;
|
||||
uint32_t _copy_loops = *(COUNT);
|
||||
uint32_t _i;
|
||||
size_t _copy_loops = *(COUNT);
|
||||
|
||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||
for( _i = 0; _i < _copy_loops; _i++ ) {
|
||||
_copy_loops = (*(SPACE) / _end_loop->size);
|
||||
for(size_t _i = 0; _i < _copy_loops; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||
DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu\n",
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -57,17 +57,17 @@
|
||||
static inline void
|
||||
position_predefined_data( opal_convertor_t* CONVERTOR,
|
||||
dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** POINTER,
|
||||
size_t* SPACE )
|
||||
{
|
||||
uint32_t _copy_count = *(COUNT);
|
||||
size_t _copy_count = *(COUNT);
|
||||
size_t _copy_blength;
|
||||
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||
|
||||
_copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size;
|
||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||
_copy_count = *(SPACE) / _copy_blength;
|
||||
if( 0 == _copy_count ) return; /* nothing to do */
|
||||
}
|
||||
_copy_blength *= _copy_count;
|
||||
@ -87,16 +87,16 @@ position_predefined_data( opal_convertor_t* CONVERTOR,
|
||||
static inline void
|
||||
position_contiguous_loop( opal_convertor_t* CONVERTOR,
|
||||
dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** POINTER,
|
||||
size_t* SPACE )
|
||||
{
|
||||
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items);
|
||||
uint32_t _copy_loops = *(COUNT);
|
||||
size_t _copy_loops = *(COUNT);
|
||||
|
||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||
_copy_loops = *(SPACE) / _end_loop->size;
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp,
|
||||
(_copy_loops - 1) * _loop->extent + _end_loop->size,
|
||||
(CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||
@ -116,7 +116,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
dt_elem_desc_t* description = pConvertor->use_desc->desc;
|
||||
dt_elem_desc_t* pElem; /* current position */
|
||||
unsigned char *base_pointer = pConvertor->pBaseBuf;
|
||||
@ -134,9 +134,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
iov_len_local = *position - pConvertor->bConverted;
|
||||
if( iov_len_local > pConvertor->pDesc->size ) {
|
||||
pStack = pConvertor->pStack; /* we're working with the full stack */
|
||||
count_desc = (uint32_t)(iov_len_local / pConvertor->pDesc->size);
|
||||
count_desc = iov_len_local / pConvertor->pDesc->size;
|
||||
DO_DEBUG( opal_output( 0, "position before %lu asked %lu data size %lu"
|
||||
" iov_len_local %lu count_desc %d\n",
|
||||
" iov_len_local %lu count_desc %" PRIsize_t "\n",
|
||||
(unsigned long)pConvertor->bConverted, (unsigned long)*position, (unsigned long)pConvertor->pDesc->size,
|
||||
(unsigned long)iov_len_local, count_desc ); );
|
||||
/* Update all the stack including the last one */
|
||||
@ -152,15 +152,15 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
base_pointer += pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
|
||||
DO_DEBUG( opal_output( 0, "position start pos_desc %d count_desc %d disp %llx\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %llx\n",
|
||||
DO_DEBUG( opal_output( 0, "position start pos_desc %d count_desc %" PRIsize_t " disp %llx\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %llx\n",
|
||||
pos_desc, count_desc, (unsigned long long)(base_pointer - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (unsigned long long)pStack->disp ); );
|
||||
/* Last data has been only partially converted. Compute the relative position */
|
||||
if( 0 != pConvertor->partial_length ) {
|
||||
size_t element_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size;
|
||||
@ -179,9 +179,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
}
|
||||
while( 1 ) {
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "position end_loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(unsigned long long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "position end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( pConvertor->stack_pos == 0 ) {
|
||||
pConvertor->flags |= CONVERTOR_COMPLETED;
|
||||
@ -202,9 +202,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
}
|
||||
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "position new_loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(unsigned long long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "position new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
ptrdiff_t local_disp = (ptrdiff_t)base_pointer;
|
||||
@ -225,9 +225,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
||||
DO_DEBUG( opal_output( 0, "position set loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(unsigned long long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "position set loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
continue;
|
||||
}
|
||||
while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) {
|
||||
@ -235,15 +235,15 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
POSITION_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc,
|
||||
base_pointer, iov_len_local );
|
||||
if( 0 != count_desc ) { /* completed */
|
||||
pConvertor->partial_length = (uint32_t)iov_len_local;
|
||||
pConvertor->partial_length = iov_len_local;
|
||||
goto complete_loop;
|
||||
}
|
||||
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
||||
pos_desc++; /* advance to the next data */
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "position set loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(unsigned long long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "position set loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
}
|
||||
complete_loop:
|
||||
@ -253,8 +253,8 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor,
|
||||
/* I complete an element, next step I should go to the next one */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc,
|
||||
base_pointer - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %d disp %llx\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %llx\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (unsigned long long)pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -13,8 +13,8 @@
|
||||
* Copyright (c) 2008-2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -85,7 +85,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv,
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
remaining = pConv->local_size - pConv->bConverted;
|
||||
if( 0 == remaining ) break; /* we're done this time */
|
||||
if( remaining > (uint32_t)iov[iov_count].iov_len )
|
||||
if( remaining > iov[iov_count].iov_len )
|
||||
remaining = iov[iov_count].iov_len;
|
||||
packed_buffer = (unsigned char*)iov[iov_count].iov_base;
|
||||
bConverted = remaining; /* how much will get unpacked this time */
|
||||
@ -176,7 +176,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv,
|
||||
* change the content of the data (as in all conversions that require changing the size
|
||||
* of the exponent or mantissa).
|
||||
*/
|
||||
static inline uint32_t
|
||||
static inline void
|
||||
opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem,
|
||||
unsigned char* partial_data,
|
||||
ptrdiff_t start_position, ptrdiff_t length,
|
||||
@ -185,17 +185,17 @@ opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pEle
|
||||
char unused_byte = 0x7F, saved_data[16];
|
||||
unsigned char temporary[16], *temporary_buffer = temporary;
|
||||
unsigned char* user_data = *user_buffer + pElem->elem.disp;
|
||||
uint32_t i, count_desc = 1;
|
||||
size_t count_desc = 1;
|
||||
size_t data_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size;
|
||||
|
||||
DO_DEBUG( opal_output( 0, "unpack partial data start %lu end %lu data_length %lu user %p\n"
|
||||
"\tbConverted %lu total_length %lu count %d\n",
|
||||
"\tbConverted %lu total_length %lu count %ld\n",
|
||||
(unsigned long)start_position, (unsigned long)start_position + length, (unsigned long)data_length, (void*)*user_buffer,
|
||||
(unsigned long)pConvertor->bConverted, (unsigned long)pConvertor->local_size, pConvertor->count ); );
|
||||
|
||||
/* Find a byte that is not used in the partial buffer */
|
||||
find_unused_byte:
|
||||
for( i = 0; i < length; i++ ) {
|
||||
for(ptrdiff_t i = 0; i < length; i++ ) {
|
||||
if( unused_byte == partial_data[i] ) {
|
||||
unused_byte--;
|
||||
goto find_unused_byte;
|
||||
@ -234,18 +234,17 @@ opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pEle
|
||||
{
|
||||
char resaved_data[16];
|
||||
pConvertor->cbmemcpy(resaved_data, user_data, data_length, pConvertor );
|
||||
for( i = 0; i < data_length; i++ ) {
|
||||
for(size_t i = 0; i < data_length; i++ ) {
|
||||
if( unused_byte == resaved_data[i] )
|
||||
pConvertor->cbmemcpy(&user_data[i], &saved_data[i], 1, pConvertor);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for( i = 0; i < data_length; i++ ) {
|
||||
for(size_t i = 0; i < data_length; i++ ) {
|
||||
if( unused_byte == user_data[i] )
|
||||
user_data[i] = saved_data[i];
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The pack/unpack functions need a cleanup. I have to create a proper interface to access
|
||||
@ -265,7 +264,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor,
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t total_unpacked = 0; /* total size unpacked this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
@ -286,15 +285,15 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)(pStack->disp) ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)(pStack->disp) ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
iov_ptr = (unsigned char *) iov[iov_count].iov_base;
|
||||
@ -343,15 +342,15 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor,
|
||||
iov_ptr, 0, iov_len_local,
|
||||
&temp );
|
||||
|
||||
pConvertor->partial_length = (uint32_t)iov_len_local;
|
||||
pConvertor->partial_length = iov_len_local;
|
||||
iov_len_local = 0;
|
||||
}
|
||||
goto complete_loop;
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( 0 == pConvertor->stack_pos ) {
|
||||
/* Do the same thing as when the loop is completed */
|
||||
@ -374,9 +373,9 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor,
|
||||
}
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "unpack new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
ptrdiff_t local_disp = (ptrdiff_t)conv_ptr;
|
||||
@ -415,8 +414,8 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor,
|
||||
/* Save the global position for the next round */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc,
|
||||
conv_ptr - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -439,21 +438,21 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
size_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
uint16_t type = OPAL_DATATYPE_MAX_PREDEFINED; /* type at current position */
|
||||
size_t total_unpacked = 0; /* total size unpacked this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
const opal_datatype_t *pData = pConvertor->pDesc;
|
||||
unsigned char *conv_ptr, *iov_ptr;
|
||||
size_t iov_len_local;
|
||||
uint32_t iov_count;
|
||||
size_t iov_len_local;
|
||||
|
||||
const opal_convertor_master_t* master = pConvertor->master;
|
||||
ptrdiff_t advance; /* number of bytes that we should advance the buffer */
|
||||
int32_t rc;
|
||||
size_t rc;
|
||||
|
||||
DO_DEBUG( opal_output( 0, "opal_convertor_general_unpack( %p, {%p, %lu}, %u )\n",
|
||||
DO_DEBUG( opal_output( 0, "opal_convertor_general_unpack( %p, {%p, %lu}, %d )\n",
|
||||
(void*)pConvertor, (void*)iov[0].iov_base, (unsigned long)iov[0].iov_len, *out_size ); );
|
||||
|
||||
description = pConvertor->use_desc->desc;
|
||||
@ -465,15 +464,15 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
count_desc = (uint32_t)pStack->count;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
|
||||
pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf),
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)(pStack->disp) ); );
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)(pStack->disp) ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
iov_ptr = (unsigned char *) iov[iov_count].iov_base;
|
||||
@ -485,7 +484,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
type = description[pos_desc].elem.common.type;
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( conv_ptr + pElem->elem.disp, pData->size, pConvertor->pBaseBuf,
|
||||
pData, pConvertor->count );
|
||||
DO_DEBUG( opal_output( 0, "unpack (%p, %ld) -> (%p:%ld, %d, %ld) type %s\n",
|
||||
DO_DEBUG( opal_output( 0, "unpack (%p, %ld) -> (%p:%ld, %" PRIsize_t ", %ld) type %s\n",
|
||||
(void*)iov_ptr, iov_len_local,
|
||||
(void*)pConvertor->pBaseBuf, conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf,
|
||||
count_desc, description[pos_desc].elem.extent,
|
||||
@ -520,15 +519,15 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
iov_ptr, 0, iov_len_local,
|
||||
&temp );
|
||||
|
||||
pConvertor->partial_length = (uint32_t)iov_len_local;
|
||||
pConvertor->partial_length = iov_len_local;
|
||||
iov_len_local = 0;
|
||||
}
|
||||
goto complete_loop;
|
||||
}
|
||||
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( 0 == pConvertor->stack_pos ) {
|
||||
/* Do the same thing as when the loop is completed */
|
||||
@ -551,9 +550,9 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
}
|
||||
conv_ptr = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "unpack new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
(int)pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
(long)pStack->disp, (unsigned long)iov_len_local ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc,
|
||||
pStack->disp, (unsigned long)iov_len_local ); );
|
||||
}
|
||||
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc,
|
||||
@ -580,7 +579,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor,
|
||||
/* Save the global position for the next round */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc,
|
||||
conv_ptr - pConvertor->pBaseBuf );
|
||||
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
|
||||
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t" disp %ld\n",
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -29,19 +29,19 @@
|
||||
static inline void
|
||||
unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */
|
||||
const dt_elem_desc_t* ELEM, /* the element description */
|
||||
uint32_t* COUNT, /* the number of elements */
|
||||
size_t* COUNT, /* the number of elements */
|
||||
unsigned char** SOURCE, /* the source pointer */
|
||||
unsigned char** DESTINATION, /* the destination pointer */
|
||||
size_t* SPACE ) /* the space in the destination buffer */
|
||||
{
|
||||
uint32_t _copy_count = *(COUNT);
|
||||
size_t _copy_count = *(COUNT);
|
||||
size_t _copy_blength;
|
||||
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||
unsigned char* _destination = (*DESTINATION) + _elem->disp;
|
||||
|
||||
_copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size;
|
||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||
_copy_count = (*(SPACE) / _copy_blength);
|
||||
if( 0 == _copy_count ) return; /* nothing to do */
|
||||
}
|
||||
|
||||
@ -56,8 +56,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */
|
||||
*(SOURCE) += _copy_blength;
|
||||
_destination += _copy_blength;
|
||||
} else {
|
||||
uint32_t _i;
|
||||
for( _i = 0; _i < _copy_count; _i++ ) {
|
||||
for(size_t _i = 0; _i < _copy_count; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf,
|
||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||
DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n",
|
||||
@ -75,7 +74,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */
|
||||
|
||||
static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR,
|
||||
const dt_elem_desc_t* ELEM,
|
||||
uint32_t* COUNT,
|
||||
size_t* COUNT,
|
||||
unsigned char** SOURCE,
|
||||
unsigned char** DESTINATION,
|
||||
size_t* SPACE )
|
||||
@ -83,12 +82,11 @@ static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR,
|
||||
const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||
const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
||||
unsigned char* _destination = (*DESTINATION) + _end_loop->first_elem_disp;
|
||||
uint32_t _copy_loops = *(COUNT);
|
||||
uint32_t _i;
|
||||
size_t _copy_loops = *(COUNT);
|
||||
|
||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||
for( _i = 0; _i < _copy_loops; _i++ ) {
|
||||
_copy_loops = (*(SPACE) / _end_loop->size);
|
||||
for(size_t _i = 0; _i < _copy_loops; _i++ ) {
|
||||
OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||
DO_DEBUG( opal_output( 0, "unpack 3. memcpy( %p, %p, %lu ) => space %lu\n",
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user