1
1

Allow for datatype with more than 2^16-1 entries. The new limit is 2^32-1 and it

is enforced at the data-type creation.

This commit was SVN r14758.
Этот коммит содержится в:
George Bosilca 2007-05-24 17:24:57 +00:00
родитель 5ec421e1b0
Коммит 146989fee7
4 изменённых файлов: 29 добавлений и 25 удалений

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

@ -30,10 +30,7 @@
#include <sys/uio.h>
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
/*
* CONVERTOR SECTION
*/
@ -63,7 +60,7 @@ typedef void*(*memalloc_fct_t)( size_t* pLength, void* userdata );
struct ompi_convertor_master_t;
typedef struct dt_stack {
int16_t index; /**< index in the element description */
int32_t index; /**< index in the element description */
int16_t type; /**< the type used for the last pack/unpack (original or DT_BYTE) */
size_t count; /**< number of times we still have to do it */
ptrdiff_t disp; /**< actual displacement depending on the count field */
@ -83,7 +80,7 @@ struct ompi_convertor_t {
size_t remote_size;
const struct ompi_datatype_t* pDesc; /**< the datatype description associated with the convertor */
const struct dt_type_desc* use_desc; /**< the version used by the convertor (normal or optimized) */
uint32_t count; /**< the total number of full datatype elements */
opal_ddt_count_t count; /**< the total number of full datatype elements */
unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */
dt_stack_t* pStack; /**< the local stack for the actual conversion */
uint32_t stack_size; /**< size of the allocated stack */
@ -376,8 +373,5 @@ OMPI_DECLSPEC int
ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
size_t* position );
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif /* CONVERTOR_H_HAS_BEEN_INCLUDED */

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

@ -45,9 +45,7 @@
#include "ompi/class/ompi_pointer_array.h"
#include "mpi.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
extern ompi_pointer_array_t *ompi_datatype_f_to_c_table;
@ -89,9 +87,16 @@ extern ompi_pointer_array_t *ompi_datatype_f_to_c_table;
typedef union dt_elem_desc dt_elem_desc_t;
/**
* The number of supported entries in the data-type definition and the
* associated type.
*/
#define MAX_DT_COMPONENT_COUNT UINT_MAX
typedef uint32_t opal_ddt_count_t;
typedef struct dt_type_desc {
uint32_t length; /* the maximum number of elements in the description array */
uint32_t used; /* the number of used elements in the description array */
opal_ddt_count_t length; /* the maximum number of elements in the description array */
opal_ddt_count_t used; /* the number of used elements in the description array */
dt_elem_desc_t* desc;
} dt_type_desc_t;
@ -238,7 +243,5 @@ OMPI_DECLSPEC ompi_datatype_t*
ompi_ddt_create_from_packed_description( void** packed_buffer,
struct ompi_proc_t* remote_processor );
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif /* DATATYPE_H_HAS_BEEN_INCLUDED */

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

@ -136,9 +136,7 @@ static inline void DUMP( char* fmt, ... )
#define DT_INCREASE_STACK 8
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
struct ddt_elem_id_description {
uint16_t flags; /**< flags for the record */
@ -296,7 +294,5 @@ static inline int GET_FIRST_NON_LOOP( const dt_elem_desc_t* _pElem )
OMPI_DECLSPEC int32_t ompi_ddt_print_args( const ompi_datatype_t* pData );
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif /* DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED */

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

@ -117,7 +117,18 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
place_needed = (extent == (ptrdiff_t)pdtAdd->size ? 1 : 3);
} else {
place_needed = pdtAdd->desc.used;
if( count != 1 ) place_needed += 2; /* for the loop markers */
if( count != 1 ) {
if( place_needed < (MAX_DT_COMPONENT_COUNT - 2) ) {
place_needed += 2; /* for the loop markers */
} else {
/* The data-type contain too many elements. We will be unable
* to handle it, so let's just complain by now.
*/
opal_output( 0, "Too many elements in the datatype. The limit is %ud\n",
MAX_DT_COMPONENT_COUNT );
return OMPI_ERROR;
}
}
}
/*