1
1

Checkpoint ... I have to move to another cluster.

This commit was SVN r5499.
Этот коммит содержится в:
George Bosilca 2005-04-24 23:42:47 +00:00
родитель dbac158804
Коммит 24eef59f7b

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

@ -25,6 +25,103 @@
#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 */
int 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;
int iov_len;
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 = iov[iov_count].iov_base;
iov_len = 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 ) {
do {
PUSH_STACK( pStack, pConvertor->stack_pos,
pos_desc, pElem[pos_desc].elem.count,
pStack->disp, pos_desc + pElem[pos_desc].elem.disp + 1);
pos_desc++;
} while( DT_LOOP == pElem[pos_desc].elem.common.type ); /* let's start another loop */
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 );