1
1

Consitent behavior for all implementations of pack/unpack. The initial

lower_bound is now directly added to the user pointer when the convertor
is created, instead of having to add it all over the places inside the
pack/unpack functions.

This commit was SVN r10292.
Этот коммит содержится в:
George Bosilca 2006-06-11 19:56:25 +00:00
родитель 4457df0278
Коммит 95dd1b173a
4 изменённых файлов: 20 добавлений и 21 удалений

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

@ -374,7 +374,7 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor,
*/
#define OMPI_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ) \
{ \
convertor->pBaseBuf = (void*)pUserBuf; \
convertor->pBaseBuf = (char*)pUserBuf + datatype->lb; \
convertor->count = count; \
\
/* Grab the datatype part of the flags */ \

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

@ -250,19 +250,19 @@ OMPI_DECLSPEC int ompi_ddt_safeguard_pointer_debug_breakpoint( const void* actua
const ompi_datatype_t* pData,
int count );
#define OMPI_DDT_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT ) \
{ \
char *__lower_bound = (char*)(INITPTR), *__upper_bound; \
assert( ((LENGTH) != 0) && ((COUNT) != 0) ); \
__lower_bound += (PDATA)->true_lb; \
__upper_bound = (INITPTR) + ((PDATA)->ub - (PDATA)->lb) * ((COUNT) - 1) + (PDATA)->true_ub; \
if( ((ACTPTR) < __lower_bound) || ((ACTPTR) >= __upper_bound) ) { \
ompi_ddt_safeguard_pointer_debug_breakpoint( (ACTPTR), (LENGTH), (INITPTR), (PDATA), (COUNT) ); \
opal_output( 0, "%s:%d\n\tPointer %p size %d is outside [%p,%p] for\n\tbase ptr %p count %d and data \n", \
__FILE__, __LINE__, (ACTPTR), (LENGTH), __lower_bound, __upper_bound, \
(INITPTR), (COUNT) ); \
ompi_ddt_dump( (PDATA) ); \
} \
}
{ \
char *__lower_bound = (char*)(INITPTR), *__upper_bound; \
assert( ((LENGTH) != 0) && ((COUNT) != 0) ); \
__lower_bound += (PDATA)->true_lb - (PDATA)->lb; \
__upper_bound = (INITPTR) + ((PDATA)->ub - (PDATA)->lb) * ((COUNT) - 1) + (PDATA)->true_ub - (PDATA)->lb; \
if( ((ACTPTR) < __lower_bound) || ((ACTPTR) >= __upper_bound) ) { \
ompi_ddt_safeguard_pointer_debug_breakpoint( (ACTPTR), (LENGTH), (INITPTR), (PDATA), (COUNT) ); \
opal_output( 0, "%s:%d\n\tPointer %p size %d is outside [%p,%p] for\n\tbase ptr %p count %d and data \n", \
__FILE__, __LINE__, (ACTPTR), (LENGTH), __lower_bound, __upper_bound, \
(INITPTR), (COUNT) ); \
ompi_ddt_dump( (PDATA) ); \
} \
}
#else
#define OMPI_DDT_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT )

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

@ -762,7 +762,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv,
i++; /* just to compute the correct source pointer */
total_bytes_converted += done;
}
user_memory = pConv->pBaseBuf + pData->true_lb + i * extent;
user_memory = pConv->pBaseBuf + i * extent;
counter = max_allowed / pData->size;
if( counter > pConv->count ) counter = pConv->count;
for( i = 0; i < counter; i++ ) {
@ -827,10 +827,9 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
* main while loop we will set back the source_base to the correct value. This is
* due to the fact that the convertor can stop in the middle of a data with a count
*/
source_base = pConvertor->pBaseBuf;
pStack = pConvertor->pStack + pConvertor->stack_pos;
pos_desc = pStack->index;
source_base += pStack->disp;
source_base = pConvertor->pBaseBuf + pStack->disp;
count_desc = pStack->count;
pStack--;
pConvertor->stack_pos--;

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

@ -191,7 +191,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv,
if( remaining > (uint32_t)iov[iov_count].iov_len )
remaining = iov[iov_count].iov_len;
bConverted = remaining; /* how much will get unpacked this time */
user_memory = pConv->pBaseBuf + pData->true_lb;
user_memory = pConv->pBaseBuf;
/*opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %d\n",
user_memory, packed_buffer, remaining );*/
@ -240,7 +240,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv,
MEMCPY_CSUM( user_memory, packed_buffer, remaining, pConv );
user_memory += remaining;
}
stack->disp = user_memory - pData->true_lb - pConv->pBaseBuf; /* save the position */
stack->disp = user_memory - pConv->pBaseBuf; /* save the position */
}
pConv->bConverted += bConverted;
}
@ -332,12 +332,12 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
*/
pStack = pConvertor->pStack + pConvertor->stack_pos;
pos_desc = pStack->index;
user_memory_base += pStack->disp;
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
count_desc = pStack->count;
pStack--;
pConvertor->stack_pos--;
pElem = &(description[pos_desc]);
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
user_memory_base += pStack->disp;
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",