1
1

Correctly initialize the external32 convertor.

Add a match_size function. This function match depending on the language, the kind of data required and
the size. Special care should be taken for C++ if we are looking for integer or real types as C++ can
return C datatypes. We use MPI_DATATYPE_NULL as a return error if there is no matching datatype.

This commit was SVN r4496.
Этот коммит содержится в:
George Bosilca 2005-02-22 22:34:27 +00:00
родитель e1a70f871d
Коммит 29ff7bfbb3
5 изменённых файлов: 51 добавлений и 2 удалений

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

@ -26,7 +26,7 @@ libdatatype_la_SOURCES = \
dt_add.c dt_create.c dt_create_array.c dt_create_dup.c dt_create_indexed.c \
dt_create_struct.c dt_create_vector.c dt_destroy.c dt_module.c \
dt_optimize.c dt_pack.c dt_sndrcv.c dt_unpack.c fake_stack.c dt_args.c \
dt_arch.c dt_external32.c
dt_arch.c dt_external32.c dt_match_size.c
# Conditionally install the header files

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

@ -182,6 +182,7 @@ OMPI_DECLSPEC int32_t ompi_ddt_copy_content_same_ddt( const dt_desc_t* pData, in
char* pDestBuf, const char* pSrcBuf );
OMPI_DECLSPEC int32_t ompi_ddt_optimize_short( dt_desc_t* pData, int32_t count, dt_type_desc_t* pTypeDesc );
OMPI_DECLSPEC const ompi_datatype_t* ompi_ddt_match_size( int size, uint16_t datakind, uint16_t datalang );
typedef int32_t (*conversion_fct_t)( uint32_t count,
const void* from, uint32_t from_len, long from_extent,

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

@ -175,7 +175,7 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
#endif /* __GNU__ */
extern conversion_fct_t ompi_ddt_copy_functions[DT_MAX_PREDEFINED];
extern int32_t ompi_ddt_external32_init( void );
extern void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos,
const dt_elem_desc_t* pDesc, const char* name );
#define SAVE_STACK( PSTACK, INDEX, COUNT, DISP, END_LOOP) \

47
src/datatype/dt_match_size.c Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "datatype/datatype.h"
#include "datatype/datatype_internal.h"
static inline
const ompi_datatype_t* ompi_ddt_match_size_internal( int size, uint16_t datakind, uint16_t datalang )
{
uint32_t i;
const ompi_datatype_t* datatype;
for( i = 0; i < DT_MAX_PREDEFINED; i++ ) {
datatype = ompi_ddt_basicDatatypes[i];
if( (datatype->flags & DT_FLAG_DATA_LANGUAGE) != datalang )
continue;
if( (datatype->flags & DT_FLAG_DATA_TYPE) != datakind )
continue;
if( (unsigned long)size == datatype->size ) {
return datatype;
}
}
return &ompi_mpi_datatype_null;
}
const ompi_datatype_t* ompi_ddt_match_size( int size, uint16_t datakind, uint16_t datalang )
{
if( datalang == DT_FLAG_DATA_CPP ) {
if( datakind == DT_FLAG_DATA_COMPLEX )
return ompi_ddt_match_size_internal( size, datakind, datalang );
datalang = DT_FLAG_DATA_C;
}
return ompi_ddt_match_size_internal( size, datakind, datalang );
}

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

@ -459,6 +459,7 @@ int ompi_ddt_init( void )
}
#endif /* VERBOSE */
ompi_ddt_external32_init();
return OMPI_SUCCESS;
}