1
1

Continue the cleaning, shrink the convertor initialization function.

This commit was SVN r9827.
Этот коммит содержится в:
George Bosilca 2006-05-05 03:25:31 +00:00
родитель 5e6188a4a8
Коммит a55d4632c6
2 изменённых файлов: 16 добавлений и 33 удалений

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

@ -383,17 +383,11 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor,
* *
* I consider here that the convertor is clean, either never initialized or already cleanup. * I consider here that the convertor is clean, either never initialized or already cleanup.
*/ */
int ompi_convertor_prepare( ompi_convertor_t* convertor, static inline int
const ompi_datatype_t* datatype, int32_t count, ompi_convertor_prepare( ompi_convertor_t* convertor,
const void* pUserBuf ) const ompi_datatype_t* datatype, int32_t count,
const void* pUserBuf )
{ {
uint32_t required_stack_length = datatype->btypes[DT_LOOP] + 1;
if( !(datatype->flags & DT_FLAG_COMMITED) ) {
/* this datatype is improper for conversion. Commit it first */
return OMPI_ERROR;
}
convertor->pBaseBuf = (void*)pUserBuf; convertor->pBaseBuf = (void*)pUserBuf;
convertor->count = count; convertor->count = count;
@ -425,6 +419,7 @@ int ompi_convertor_prepare( ompi_convertor_t* convertor,
convertor->bConverted = 0; convertor->bConverted = 0;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
convertor->use_desc = &(datatype->opt_desc);
} else { } else {
int i; int i;
uint64_t bdt_mask = datatype->bdt_used >> DT_CHAR; uint64_t bdt_mask = datatype->bdt_used >> DT_CHAR;
@ -436,23 +431,21 @@ int ompi_convertor_prepare( ompi_convertor_t* convertor,
} }
} }
convertor->remote_size *= convertor->count; convertor->remote_size *= convertor->count;
}
/* Decide which data representation will be used for the conversion. */
if( (NULL != datatype->opt_desc.desc) && (convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
convertor->use_desc = &(datatype->opt_desc);
} else {
convertor->use_desc = &(datatype->desc); convertor->use_desc = &(datatype->desc);
} }
if( required_stack_length > convertor->stack_size ) { {
convertor->stack_size = required_stack_length; uint32_t required_stack_length = datatype->btypes[DT_LOOP] + 1;
convertor->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * convertor->stack_size );
} else {
convertor->pStack = convertor->static_stack;
convertor->stack_size = DT_STATIC_STACK_SIZE;
}
if( required_stack_length > convertor->stack_size ) {
convertor->stack_size = required_stack_length;
convertor->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) *
convertor->stack_size );
} else {
convertor->pStack = convertor->static_stack;
convertor->stack_size = DT_STATIC_STACK_SIZE;
}
}
return ompi_convertor_create_stack_at_begining( convertor, ompi_ddt_local_sizes ); return ompi_convertor_create_stack_at_begining( convertor, ompi_ddt_local_sizes );
} }

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

@ -233,16 +233,6 @@ ompi_convertor_get_unpacked_size( const ompi_convertor_t* pConv,
*pSize = pConv->remote_size; *pSize = pConv->remote_size;
} }
/*
* This function is internal to the data type engine. It should not be called from
* outside. The data preparation should use the specialized prepare_for_send and
* prepare_for_recv functions.
*/
OMPI_DECLSPEC
int ompi_convertor_prepare( ompi_convertor_t* convertor,
const struct ompi_datatype_t* datatype, int32_t count,
const void* pUserBuf );
/* /*
* *
*/ */