1
1

Update the pack/unpack of data-type description (used for one sided). Correctly handle

the predefined types, move the packed_description into the data-type structure.

This commit was SVN r8905.
Этот коммит содержится в:
George Bosilca 2006-02-06 19:10:19 +00:00
родитель e20265bd2b
Коммит 9d969f2b53
4 изменённых файлов: 55 добавлений и 46 удалений

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

@ -91,31 +91,32 @@ typedef struct dt_type_desc {
/* the data description.
*/
typedef struct ompi_datatype_t {
opal_object_t super; /**< basic superclass */
unsigned long size; /**< total size in bytes of the memory used by the data if
* the data is put on a contiguous buffer */
uint32_t align; /**< data should be aligned to */
long true_lb;
long true_ub; /**< the true ub of the data without user defined lb and ub */
long lb; /**< lower bound in memory */
long ub; /**< upper bound in memory */
uint16_t flags; /**< the flags */
uint16_t id; /**< data id, normally the index in the data array. */
uint32_t nbElems; /**< total number of elements inside the datatype */
uint64_t bdt_used; /**< which basic datatypes are used in the data description */
opal_object_t super; /**< basic superclass */
unsigned long size; /**< total size in bytes of the memory used by the data if
* the data is put on a contiguous buffer */
uint32_t align; /**< data should be aligned to */
long true_lb;
long true_ub; /**< the true ub of the data without user defined lb and ub */
long lb; /**< lower bound in memory */
long ub; /**< upper bound in memory */
uint16_t flags; /**< the flags */
uint16_t id; /**< data id, normally the index in the data array. */
uint32_t nbElems; /**< total number of elements inside the datatype */
uint64_t bdt_used; /**< which basic datatypes are used in the data description */
/* Attribute fields */
opal_hash_table_t *d_keyhash;
int32_t d_f_to_c_index;
char name[MPI_MAX_OBJECT_NAME];
dt_type_desc_t desc; /**< the data description */
dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless
* or in the send case (without conversion) */
void* args; /**< data description for the user */
/* Attribute fields */
opal_hash_table_t *d_keyhash;
int32_t d_f_to_c_index;
char name[MPI_MAX_OBJECT_NAME];
dt_type_desc_t desc; /**< the data description */
dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless
* or in the send case (without conversion) */
void* args; /**< data description for the user */
void* packed_description; /**< the packed description of the datatype */
/* basic elements count used to compute the size of the datatype for
* remote nodes */
uint32_t btypes[DT_MAX_PREDEFINED];
/* basic elements count used to compute the size of the datatype for
* remote nodes */
uint32_t btypes[DT_MAX_PREDEFINED];
} ompi_datatype_t;
OBJ_CLASS_DECLARATION( ompi_datatype_t );

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

@ -39,7 +39,6 @@ typedef struct __dt_args {
int* i;
MPI_Aint* a;
MPI_Datatype* d;
void* packed_description;
} ompi_ddt_args_t;
#define ALLOC_ARGS(PDATA, IC, AC, DC) \
@ -67,7 +66,7 @@ typedef struct __dt_args {
(PDATA)->args = (void*)pArgs; \
pArgs->total_pack_size = (4 + (IC)) * sizeof(int) + \
(AC) * sizeof(MPI_Aint) + (DC) * sizeof(int); \
pArgs->packed_description = NULL; \
(PDATA)->packed_description = NULL; \
} while(0)
int32_t ompi_ddt_set_args( ompi_datatype_t* pData,
@ -259,9 +258,6 @@ int32_t ompi_ddt_release_args( ompi_datatype_t* pData )
OBJ_RELEASE( pArgs->d[i] );
}
}
if( NULL != pArgs->packed_description )
free( pArgs->packed_description );
pArgs->packed_description = NULL;
free( pData->args );
pData->args = NULL;
@ -325,13 +321,12 @@ int ompi_ddt_get_pack_description( ompi_datatype_t* datatype,
int next_index = DT_MAX_PREDEFINED;
void* recursive_buffer;
if( NULL != args->packed_description ) {
*packed_buffer = (const void*)args->packed_description;
if( NULL == datatype->packed_description ) {
datatype->packed_description = malloc( args->total_pack_size );
recursive_buffer = datatype->packed_description;
__ompi_ddt_pack_description( datatype, &recursive_buffer, &next_index );
}
args->packed_description = malloc( args->total_pack_size );
recursive_buffer = args->packed_description;
__ompi_ddt_pack_description( datatype, &recursive_buffer, &next_index );
*packed_buffer = (const void*)args->packed_description;
*packed_buffer = (const void*)datatype->packed_description;
return OMPI_SUCCESS;
}

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

@ -52,16 +52,26 @@ static void __get_free_dt_struct( ompi_datatype_t* pData )
static void __destroy_ddt_struct( ompi_datatype_t* datatype )
{
if( datatype->desc.desc != NULL ) free( datatype->desc.desc );
datatype->desc.desc = NULL;
datatype->desc.length = 0;
datatype->desc.used = 0;
if( datatype->opt_desc.desc != NULL ) free( datatype->opt_desc.desc );
datatype->opt_desc.desc = NULL;
datatype->opt_desc.length = 0;
datatype->opt_desc.used = 0;
if( datatype->args != NULL ) ompi_ddt_release_args( datatype );
datatype->args = NULL;
if( datatype->desc.desc != NULL ) {
free( datatype->desc.desc );
datatype->desc.desc = NULL;
datatype->desc.length = 0;
datatype->desc.used = 0;
}
if( datatype->opt_desc.desc != NULL ) {
free( datatype->opt_desc.desc );
datatype->opt_desc.desc = NULL;
datatype->opt_desc.length = 0;
datatype->opt_desc.used = 0;
}
if( NULL != datatype->args ) {
ompi_ddt_release_args( datatype );
datatype->args = NULL;
}
if( NULL != datatype->packed_description ) {
free( datatype->packed_description );
datatype->packed_description = NULL;
}
if( NULL != ompi_pointer_array_get_item(ompi_datatype_f_to_c_table, datatype->d_f_to_c_index) ){
ompi_pointer_array_set_item( ompi_datatype_f_to_c_table, datatype->d_f_to_c_index, NULL );
}

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

@ -37,7 +37,7 @@ int ompi_ddt_dfd = -1;
#define ZERO_DDT_ARRAY { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define EMPTY_DATA(NAME) NULL, 0, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, ZERO_DDT_ARRAY
#define EMPTY_DATA(NAME) NULL, 0, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, NULL, ZERO_DDT_ARRAY
#define BASEOBJ_DATA { OBJ_CLASS(ompi_datatype_t), 1 }
/* Using this macro implies that at this point not all informations needed
@ -376,7 +376,7 @@ int32_t ompi_ddt_init( void )
for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) {
ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_ddt_basicDatatypes[i];
datatype->desc.desc = (dt_elem_desc_t*)malloc(2*sizeof(dt_elem_desc_t));
datatype->desc.desc = (dt_elem_desc_t*)malloc(2*sizeof(dt_elem_desc_t));
datatype->desc.desc[0].elem.common.flags = DT_FLAG_PREDEFINED | DT_FLAG_DATA | DT_FLAG_CONTIGUOUS;
datatype->desc.desc[0].elem.common.type = i;
datatype->desc.desc[0].elem.count = 1;
@ -392,6 +392,9 @@ int32_t ompi_ddt_init( void )
datatype->desc.length = 1;
datatype->desc.used = 1;
datatype->btypes[i] = 1;
datatype->packed_description = malloc(2 * sizeof(int) );
((int*)(datatype->packed_description))[0] = MPI_COMBINER_DUP;
((int*)(datatype->packed_description))[1] = i;
}
/* Create the f2c translation table */