This function come from the DDT version 2. Remove it by now !!!
This commit was SVN r5730.
Этот коммит содержится в:
родитель
f68e255933
Коммит
7381c1f9ee
@ -25,126 +25,6 @@
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
static int ompi_convertor_generic_parse( ompi_convertor_t* pConvertor,
|
||||
struct iovec* iov, uint32_t* out_size,
|
||||
uint32_t* max_data,
|
||||
int32_t* freeAfter )
|
||||
{
|
||||
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 */
|
||||
int type; /* type at current position */
|
||||
long disp_desc = 0; /* compute displacement for truncated data */
|
||||
int bConverted = 0; /* number of bytes converted this time */
|
||||
ompi_datatype_t *pData = pConvertor->pDesc;
|
||||
dt_elem_desc_t* pElem;
|
||||
char * iov_base_local;
|
||||
uint32_t iov_len_local, i;
|
||||
uint32_t iov_count, total_bytes_converted = 0;
|
||||
|
||||
DUMP( "convertor_decode( %p, {%p, %d}, %d )\n", (void*)pConvertor,
|
||||
iov[0].iov_base, iov[0].iov_len, *out_size );
|
||||
|
||||
pElem = pConvertor->use_desc->desc;
|
||||
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
disp_desc = pStack->disp;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
if( iov[iov_count].iov_base == NULL ) {
|
||||
/*
|
||||
* ALLOCATE SOME MEMORY ...
|
||||
*/
|
||||
*freeAfter = (*freeAfter) | (1 << iov_count);
|
||||
}
|
||||
iov_base_local = iov[iov_count].iov_base;
|
||||
iov_len_local = iov[iov_count].iov_len;
|
||||
bConverted = 0;
|
||||
while( 1 ) {
|
||||
if( DT_END_LOOP == pElem[pos_desc].elem.common.type ) { /* end of the current loop */
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( pConvertor->stack_pos == 0 )
|
||||
goto complete_loop; /* completed */
|
||||
pConvertor->stack_pos--;
|
||||
pStack--;
|
||||
pos_desc++;
|
||||
} else {
|
||||
pos_desc = pStack->index + 1;
|
||||
if( pStack->index == -1 ) {
|
||||
pStack->disp += (pData->ub - pData->lb);
|
||||
} else {
|
||||
assert( DT_LOOP == pElem[pStack->index].elem.common.type );
|
||||
pStack->disp += pElem[pStack->index].loop.extent;
|
||||
}
|
||||
}
|
||||
count_desc = pElem[pos_desc].elem.count;
|
||||
disp_desc = pElem[pos_desc].elem.disp;
|
||||
}
|
||||
if( DT_LOOP == pElem[pos_desc].elem.common.type ) {
|
||||
int stop_in_loop = 0;
|
||||
if( pElem[pos_desc].loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||
ddt_endloop_desc_t* end_loop = &(pElem[pos_desc + pElem[pos_desc].loop.items].end_loop);
|
||||
if( (end_loop->size * count_desc) > iov_len_local ) {
|
||||
stop_in_loop = count_desc;
|
||||
count_desc = iov_len_local / end_loop->size;
|
||||
}
|
||||
for( i = 0; i < count_desc; i++ ) {
|
||||
/*
|
||||
* DO SOMETHING USEFULL ...
|
||||
*/
|
||||
iov_base_local += end_loop->size; /* size of the contiguous data */
|
||||
disp_desc += pElem[pos_desc].loop.extent;
|
||||
}
|
||||
iov_len_local -= (end_loop->size * count_desc);
|
||||
bConverted += (end_loop->size * count_desc);
|
||||
if( stop_in_loop == 0 ) {
|
||||
pos_desc += pElem[pos_desc].loop.items + 1;
|
||||
count_desc = pElem[pos_desc].elem.count;
|
||||
continue;
|
||||
}
|
||||
/* mark some of the iterations as completed */
|
||||
count_desc = stop_in_loop - count_desc;
|
||||
/* Save the stack with the correct last_count value. */
|
||||
}
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos,
|
||||
pos_desc, pElem[pos_desc].loop.loops,
|
||||
pStack->disp, pos_desc + pElem[pos_desc].loop.items + 1);
|
||||
pos_desc++;
|
||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
||||
/* update the current state */
|
||||
count_desc = pElem[pos_desc].elem.count;
|
||||
disp_desc = pElem[pos_desc].elem.disp;
|
||||
continue;
|
||||
}
|
||||
while( pElem[pos_desc].elem.common.flags & DT_FLAG_DATA ) {
|
||||
/* now here we have a basic datatype */
|
||||
type = pElem[pos_desc].elem.common.type;
|
||||
/*
|
||||
* DO SOMETHING USEFULL ...
|
||||
*/
|
||||
pos_desc++; /* advance to the next data */
|
||||
count_desc = pElem[pos_desc].elem.count;
|
||||
disp_desc = pElem[pos_desc].elem.disp;
|
||||
}
|
||||
}
|
||||
complete_loop:
|
||||
pConvertor->bConverted += bConverted; /* update the already converted bytes */
|
||||
iov[iov_count].iov_len = bConverted; /* update the length in the iovec */
|
||||
total_bytes_converted += bConverted;
|
||||
}
|
||||
bConverted = pConvertor->bConverted - (pData->size * pConvertor->count);
|
||||
if( bConverted ) {
|
||||
/* I complete an element, next step I should go to the next one */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, count_desc,
|
||||
disp_desc, pos_desc );
|
||||
}
|
||||
return (bConverted == 0);
|
||||
}
|
||||
|
||||
int ompi_convertor_create_stack_with_pos( ompi_convertor_t* pConvertor,
|
||||
int starting_point, const int* sizes );
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user