Silence some compiler warnings, and reindent the code.
This commit was SVN r20385.
Этот коммит содержится в:
родитель
35c5e28a8e
Коммит
04a3b29b76
@ -43,27 +43,27 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor,
|
|||||||
assert( (*iov_count) > 0 );
|
assert( (*iov_count) > 0 );
|
||||||
if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_NO_OP) ) {
|
if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_NO_OP) ) {
|
||||||
/* The convertor contain minimal informations, we only use the bConverted
|
/* The convertor contain minimal informations, we only use the bConverted
|
||||||
* to manage the conversion. This function work even after the convertor
|
* to manage the conversion. This function work even after the convertor
|
||||||
* was moved to a specific position.
|
* was moved to a specific position.
|
||||||
*/
|
*/
|
||||||
ompi_convertor_get_current_pointer( pConvertor, (void**)&iov[0].iov_base );
|
ompi_convertor_get_current_pointer( pConvertor, (void**)&iov[0].iov_base );
|
||||||
iov[0].iov_len = pConvertor->local_size - pConvertor->bConverted;
|
iov[0].iov_len = pConvertor->local_size - pConvertor->bConverted;
|
||||||
*length = iov[0].iov_len;
|
*length = iov[0].iov_len;
|
||||||
pConvertor->bConverted = pConvertor->local_size;
|
pConvertor->bConverted = pConvertor->local_size;
|
||||||
pConvertor->flags |= CONVERTOR_COMPLETED;
|
pConvertor->flags |= CONVERTOR_COMPLETED;
|
||||||
*iov_count = 1;
|
*iov_count = 1;
|
||||||
return 1; /* we're done */
|
return 1; /* we're done */
|
||||||
}
|
}
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "ompi_convertor_raw( %p, {%p, %lu}, %p )\n", (void*)pConvertor,
|
DO_DEBUG( opal_output( 0, "ompi_convertor_raw( %p, {%p, %u}, %lu )\n", (void*)pConvertor,
|
||||||
iov, *iov_count, *length ); );
|
(void*)iov, *iov_count, *length ); );
|
||||||
|
|
||||||
description = pConvertor->use_desc->desc;
|
description = pConvertor->use_desc->desc;
|
||||||
|
|
||||||
/* For the first step we have to add both displacement to the source. After in the
|
/* For the first step we have to add both displacement to the source. After in the
|
||||||
* main while loop we will set back the source_base to the correct value. This is
|
* 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
|
* due to the fact that the convertor can stop in the middle of a data with a count
|
||||||
*/
|
*/
|
||||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||||
pos_desc = pStack->index;
|
pos_desc = pStack->index;
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
@ -72,124 +72,120 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor,
|
|||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
pElem = &(description[pos_desc]);
|
pElem = &(description[pos_desc]);
|
||||||
source_base += pStack->disp;
|
source_base += pStack->disp;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %d disp %ld\n"
|
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",
|
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||||
pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf),
|
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, (int)pStack->count, (long)pStack->disp ); );
|
||||||
|
|
||||||
while( 1 ) {
|
while( 1 ) {
|
||||||
while( pElem->elem.common.flags & DT_FLAG_DATA ) {
|
while( pElem->elem.common.flags & DT_FLAG_DATA ) {
|
||||||
size_t blength = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
size_t blength = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
||||||
source_base += pElem->elem.disp;
|
source_base += pElem->elem.disp;
|
||||||
if( blength == pElem->elem.extent ) { /* no resized data */
|
if( blength == (size_t)pElem->elem.extent ) { /* no resized data */
|
||||||
if( index < *iov_count ) {
|
if( index < *iov_count ) {
|
||||||
blength *= count_desc;
|
blength *= count_desc;
|
||||||
/* now here we have a basic datatype */
|
/* now here we have a basic datatype */
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
|
OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
|
||||||
pConvertor->pDesc, pConvertor->count );
|
pConvertor->pDesc, pConvertor->count );
|
||||||
DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %lu}\n",
|
DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %lu}\n",
|
||||||
index, source_base, (unsigned long)blength ); );
|
index, source_base, (unsigned long)blength ); );
|
||||||
iov[index].iov_base = source_base;
|
iov[index].iov_base = source_base;
|
||||||
iov[index].iov_len = blength;
|
iov[index].iov_len = blength;
|
||||||
source_base += blength;
|
source_base += blength;
|
||||||
raw_data += blength;
|
raw_data += blength;
|
||||||
index++;
|
index++;
|
||||||
count_desc = 0;
|
count_desc = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
|
OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
|
||||||
pConvertor->pDesc, pConvertor->count );
|
pConvertor->pDesc, pConvertor->count );
|
||||||
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %lu}\n",
|
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %lu}\n",
|
||||||
index, source_base, (unsigned long)blength ); );
|
index, source_base, (unsigned long)blength ); );
|
||||||
iov[index].iov_base = source_base;
|
iov[index].iov_base = source_base;
|
||||||
iov[index].iov_len = blength;
|
iov[index].iov_len = blength;
|
||||||
source_base += blength;
|
source_base += blength;
|
||||||
raw_data += blength;
|
raw_data += blength;
|
||||||
count_desc--;
|
count_desc--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source_base -= pElem->elem.disp;
|
source_base -= pElem->elem.disp;
|
||||||
if( 0 == count_desc ) { /* completed */
|
if( 0 == count_desc ) { /* completed */
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
pos_desc++; /* advance to the next data */
|
pos_desc++; /* advance to the next data */
|
||||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
goto complete_loop;
|
goto complete_loop;
|
||||||
}
|
}
|
||||||
if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
if( DT_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 %d stack_pos %d"
|
||||||
" pos_desc %d disp %ld space %lu\n",
|
" pos_desc %d disp %ld space %lu\n",
|
||||||
(int)pStack->count, pConvertor->stack_pos,
|
(int)pStack->count, pConvertor->stack_pos,
|
||||||
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
||||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||||
if( pConvertor->stack_pos == 0 ) {
|
if( pConvertor->stack_pos == 0 ) {
|
||||||
/* we lie about the size of the next element in order to
|
/* we lie about the size of the next element in order to
|
||||||
* make sure we exit the main loop.
|
* make sure we exit the main loop.
|
||||||
*/
|
*/
|
||||||
*iov_count = index;
|
*iov_count = index;
|
||||||
goto complete_loop; /* completed */
|
goto complete_loop; /* completed */
|
||||||
}
|
}
|
||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
pStack--;
|
pStack--;
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
} else {
|
} else {
|
||||||
pos_desc = pStack->index + 1;
|
pos_desc = pStack->index + 1;
|
||||||
if( pStack->index == -1 ) {
|
if( pStack->index == -1 ) {
|
||||||
pStack->disp += (pData->ub - pData->lb);
|
pStack->disp += (pData->ub - pData->lb);
|
||||||
} else {
|
} else {
|
||||||
assert( DT_LOOP == description[pStack->index].loop.common.type );
|
assert( DT_LOOP == description[pStack->index].loop.common.type );
|
||||||
pStack->disp += description[pStack->index].loop.extent;
|
pStack->disp += description[pStack->index].loop.extent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
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 %d stack_pos %d "
|
||||||
"pos_desc %d disp %ld space %lu\n",
|
"pos_desc %d disp %ld space %lu\n",
|
||||||
(int)pStack->count, pConvertor->stack_pos,
|
(int)pStack->count, pConvertor->stack_pos,
|
||||||
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
|
||||||
}
|
}
|
||||||
if( DT_LOOP == pElem->elem.common.type ) {
|
if( DT_LOOP == pElem->elem.common.type ) {
|
||||||
ptrdiff_t local_disp = (ptrdiff_t)source_base;
|
ptrdiff_t local_disp = (ptrdiff_t)source_base;
|
||||||
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items);
|
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items);
|
||||||
|
|
||||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
source_base += end_loop->first_elem_disp;
|
||||||
source_base += end_loop->first_elem_disp;
|
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
||||||
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
|
OMPI_DDT_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
|
pConvertor->pDesc, pConvertor->count );
|
||||||
pConvertor->pDesc, pConvertor->count );
|
iov[index].iov_base = source_base;
|
||||||
iov[index].iov_base = source_base;
|
iov[index].iov_len = end_loop->size;
|
||||||
iov[index].iov_len = end_loop->size;
|
source_base += pElem->loop.extent;
|
||||||
source_base += pElem->loop.extent;
|
raw_data += end_loop->size;
|
||||||
raw_data += end_loop->size;
|
count_desc--;
|
||||||
count_desc--;
|
}
|
||||||
}
|
source_base -= end_loop->first_elem_disp;
|
||||||
source_base -= end_loop->first_elem_disp;
|
if( 0 == count_desc ) { /* completed */
|
||||||
if( 0 == count_desc ) { /* completed */
|
pos_desc += pElem->loop.items + 1;
|
||||||
pos_desc += pElem->loop.items + 1;
|
goto update_loop_description;
|
||||||
goto update_loop_description;
|
}
|
||||||
}
|
}
|
||||||
}
|
local_disp = (ptrdiff_t)source_base - local_disp;
|
||||||
local_disp = (ptrdiff_t)source_base - local_disp;
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
pStack->disp + local_disp);
|
||||||
pStack->disp + local_disp);
|
pos_desc++;
|
||||||
pos_desc++;
|
update_loop_description: /* update the current state */
|
||||||
update_loop_description: /* update the current state */
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
||||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
complete_loop:
|
complete_loop:
|
||||||
pConvertor->bConverted += raw_data; /* update the already converted bytes */
|
pConvertor->bConverted += raw_data; /* update the already converted bytes */
|
||||||
*length = raw_data;
|
*length = raw_data;
|
||||||
*iov_count = index;
|
*iov_count = index;
|
||||||
|
|
||||||
if( pConvertor->bConverted == pConvertor->local_size ) {
|
if( pConvertor->bConverted == pConvertor->local_size ) {
|
||||||
pConvertor->flags |= CONVERTOR_COMPLETED;
|
pConvertor->flags |= CONVERTOR_COMPLETED;
|
||||||
return 1;
|
return 1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user