1
1
This commit was SVN r5492.
Этот коммит содержится в:
George Bosilca 2005-04-22 05:04:52 +00:00
родитель 362b3ab3fa
Коммит 88ca070e88

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

@ -175,9 +175,9 @@ int ompi_convertor_pack_homogeneous_with_memcpy( ompi_convertor_t* pConv,
pDestBuf = iov[0].iov_base; pDestBuf = iov[0].iov_base;
if( pData->opt_desc.desc != NULL ) { if( pData->opt_desc.desc != NULL ) {
pElems = pData->opt_desc.desc; pElems = pData->opt_desc.desc;
} else { } else {
pElems = pData->desc.desc; pElems = pData->desc.desc;
} }
pStack = pConv->pStack + pConv->stack_pos; pStack = pConv->pStack + pConv->stack_pos;
@ -188,83 +188,83 @@ int ompi_convertor_pack_homogeneous_with_memcpy( ompi_convertor_t* pConv,
pConv->stack_pos--; pConv->stack_pos--;
while( 1 ) { while( 1 ) {
if( pElems[pos_desc].type == DT_END_LOOP ) { /* end of the current loop */ if( pElems[pos_desc].type == DT_END_LOOP ) { /* end of the current loop */
if( --(pStack->count) == 0 ) { /* end of loop */ if( --(pStack->count) == 0 ) { /* end of loop */
if( pConv->stack_pos == 0 ) { /* finish everything */ if( pConv->stack_pos == 0 ) { /* finish everything */
last_count = 0; last_count = 0;
pos_desc = -1; pos_desc = -1;
goto end_loop; goto end_loop;
} }
pStack--; pStack--;
pConv->stack_pos--; pConv->stack_pos--;
pos_desc++; /* go to the next element */ pos_desc++; /* go to the next element */
} else { } else {
if( pStack->index == -1 ) { if( pStack->index == -1 ) {
pStack->disp += (pData->ub - pData->lb); pStack->disp += (pData->ub - pData->lb);
pos_desc = 0; pos_desc = 0;
} else { } else {
pStack->disp += pElems[pos_desc].extent; pStack->disp += pElems[pos_desc].extent;
pos_desc = pStack->index + 1; pos_desc = pStack->index + 1;
} }
} }
last_count = pElems[pos_desc].count; last_count = pElems[pos_desc].count;
last_blength = last_count; last_blength = last_count;
lastDisp = pStack->disp + pElems[pos_desc].disp; lastDisp = pStack->disp + pElems[pos_desc].disp;
continue; continue;
} }
while( pElems[pos_desc].type == DT_LOOP ) { while( pElems[pos_desc].type == DT_LOOP ) {
int stop_in_loop = 0; int stop_in_loop = 0;
if( pElems[pos_desc].flags & DT_FLAG_CONTIGUOUS ) { if( pElems[pos_desc].flags & DT_FLAG_CONTIGUOUS ) {
dt_elem_desc_t* pLast = &(pElems[pos_desc + pElems[pos_desc].disp]); dt_elem_desc_t* pLast = &(pElems[pos_desc + pElems[pos_desc].disp]);
if( (pLast->extent * last_count) > space ) { if( (pLast->extent * last_count) > (int)space ) {
stop_in_loop = last_count; stop_in_loop = last_count;
last_count = space / pLast->extent; last_count = space / pLast->extent;
} }
for( i = 0; i < last_count; i++ ) { for( i = 0; i < last_count; i++ ) {
OMPI_DDT_SAFEGUARD_POINTER( pConv->pBaseBuf + lastDisp, pLast->extent, OMPI_DDT_SAFEGUARD_POINTER( pConv->pBaseBuf + lastDisp, pLast->extent,
pConv->pBaseBuf, pData, pConv->count ); pConv->pBaseBuf, pData, pConv->count );
MEMCPY( pDestBuf, pConv->pBaseBuf + lastDisp, pLast->extent ); MEMCPY( pDestBuf, pConv->pBaseBuf + lastDisp, pLast->extent );
pDestBuf += pLast->extent; /* size of the contiguous data */ pDestBuf += pLast->extent; /* size of the contiguous data */
lastDisp += pElems[pos_desc].extent; lastDisp += pElems[pos_desc].extent;
} }
space -= (pLast->extent * last_count); space -= (pLast->extent * last_count);
bConverted += (pLast->extent * last_count); bConverted += (pLast->extent * last_count);
if( stop_in_loop == 0 ) { if( stop_in_loop == 0 ) {
pos_desc += pElems[pos_desc].disp + 1; pos_desc += pElems[pos_desc].disp + 1;
last_count = pElems[pos_desc].count; last_count = pElems[pos_desc].count;
continue; continue;
} }
/* mark some of the iterations as completed */ /* mark some of the iterations as completed */
last_count = stop_in_loop - last_count; last_count = stop_in_loop - last_count;
last_blength = 0; last_blength = 0;
/* Save the stack with the correct last_count value. */ /* Save the stack with the correct last_count value. */
} }
PUSH_STACK( pStack, pConv->stack_pos, pos_desc, last_count, PUSH_STACK( pStack, pConv->stack_pos, pos_desc, last_count,
pStack->disp, pos_desc + pElems[pos_desc].disp ); pStack->disp, pos_desc + pElems[pos_desc].disp );
pos_desc++; pos_desc++;
last_count = pElems[pos_desc].count; last_count = pElems[pos_desc].count;
} }
/* now here we have a basic datatype */ /* now here we have a basic datatype */
while( pElems[pos_desc].flags & DT_FLAG_DATA ) { while( pElems[pos_desc].flags & DT_FLAG_DATA ) {
/* do we have enough space in the buffer ? */ /* do we have enough space in the buffer ? */
last_blength = last_count * ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size; last_blength = last_count * ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size;
if( space < last_blength ) { if( space < last_blength ) {
last_blength = last_count; last_blength = last_count;
last_count = space / ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size; last_count = space / ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size;
space -= (last_count * ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size); space -= (last_count * ompi_ddt_basicDatatypes[pElems[pos_desc].type]->size);
last_blength -= last_count; last_blength -= last_count;
goto end_loop; /* or break whatever but go out of this while */ goto end_loop; /* or break whatever but go out of this while */
} }
OMPI_DDT_SAFEGUARD_POINTER( pConv->pBaseBuf + lastDisp, last_count, OMPI_DDT_SAFEGUARD_POINTER( pConv->pBaseBuf + lastDisp, last_count,
pConv->pBaseBuf, pData, pConv->count ); pConv->pBaseBuf, pData, pConv->count );
MEMCPY( pDestBuf, pConv->pBaseBuf + lastDisp, last_count ); MEMCPY( pDestBuf, pConv->pBaseBuf + lastDisp, last_count );
bConverted += last_blength; bConverted += last_blength;
space -= last_blength; space -= last_blength;
pDestBuf += last_blength; pDestBuf += last_blength;
pos_desc++; /* advance to the next data */ pos_desc++; /* advance to the next data */
lastDisp = pStack->disp + pElems[pos_desc].disp; lastDisp = pStack->disp + pElems[pos_desc].disp;
last_count = pElems[pos_desc].count; last_count = pElems[pos_desc].count;
} }
} }
last_count = 0; /* complete the data */ last_count = 0; /* complete the data */
end_loop: end_loop:
@ -407,7 +407,7 @@ int ompi_convertor_pack_no_conversion( ompi_convertor_t* pConv,
(*freeAfter) |= (1 << iov_pos); (*freeAfter) |= (1 << iov_pos);
} }
/* compute the maximum amount of data to be packed */ /* compute the maximum amount of data to be packed */
if( (pLast->extent * last_count) > space_on_iovec ) { if( (pLast->extent * last_count) > (int)space_on_iovec ) {
stop_in_loop = last_count; stop_in_loop = last_count;
last_count = space_on_iovec / pLast->extent; last_count = space_on_iovec / pLast->extent;
} }