23 #ifndef OMPI_DATATYPE_H_HAS_BEEN_INCLUDED
24 #define OMPI_DATATYPE_H_HAS_BEEN_INCLUDED
26 #include "ompi_config.h"
36 #include "ompi/constants.h"
39 #include "opal/datatype/opal_convertor.h"
40 #include "opal/datatype/opal_datatype.h"
47 #define OMPI_DATATYPE_FLAG_PREDEFINED 0x0200
49 #define OMPI_DATATYPE_FLAG_DATA_INT 0x1000
50 #define OMPI_DATATYPE_FLAG_DATA_FLOAT 0x2000
51 #define OMPI_DATATYPE_FLAG_DATA_COMPLEX 0x3000
52 #define OMPI_DATATYPE_FLAG_DATA_TYPE 0x3000
54 #define OMPI_DATATYPE_FLAG_DATA_C 0x4000
55 #define OMPI_DATATYPE_FLAG_DATA_CPP 0x8000
56 #define OMPI_DATATYPE_FLAG_DATA_FORTRAN 0xC000
57 #define OMPI_DATATYPE_FLAG_DATA_LANGUAGE 0xC000
59 #define OMPI_DATATYPE_MAX_PREDEFINED 45
61 #if OMPI_DATATYPE_MAX_PREDEFINED > OPAL_DATATYPE_MAX_SUPPORTED
62 #error Need to increase the number of supported dataypes by OPAL (value OPAL_DATATYPE_MAX_SUPPORTED).
79 char name[MPI_MAX_OBJECT_NAME];
98 #define PREDEFINED_DATATYPE_PAD (512)
116 OMPI_DECLSPEC int32_t ompi_datatype_init(
void );
117 OMPI_DECLSPEC int32_t ompi_datatype_finalize(
void );
119 OMPI_DECLSPEC int32_t ompi_datatype_default_convertors_init(
void );
120 OMPI_DECLSPEC int32_t ompi_datatype_default_convertors_fini(
void );
123 OMPI_DECLSPEC
ompi_datatype_t* ompi_datatype_create( int32_t expectedSize );
125 static inline int32_t
128 return opal_datatype_is_committed(&type->
super);
131 static inline int32_t
134 return opal_datatype_is_overlapped(&type->
super);
137 static inline int32_t
140 return opal_datatype_is_valid(&type->
super);
143 static inline int32_t
146 return (type->
super.
flags & OMPI_DATATYPE_FLAG_PREDEFINED);
149 static inline int32_t
150 ompi_datatype_is_contiguous_memory_layout(
const ompi_datatype_t* type, int32_t count )
152 return opal_datatype_is_contiguous_memory_layout(&type->
super, count);
155 static inline int32_t
168 static inline int32_t
170 OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent )
172 return opal_datatype_add( &pdtBase->
super, &pdtAdd->
super, count, disp, extent );
176 static inline int32_t
181 *newType = new_ompi_datatype;
182 if( NULL == new_ompi_datatype ) {
183 return OMPI_ERR_OUT_OF_RESOURCE;
185 opal_datatype_clone( &oldType->
super, &new_ompi_datatype->
super);
187 new_ompi_datatype->
super.
flags &= ~OMPI_DATATYPE_FLAG_PREDEFINED;
192 new_ompi_datatype->
args = NULL;
193 snprintf (new_ompi_datatype->
name, MPI_MAX_OBJECT_NAME,
"Dup %s",
200 OMPI_DECLSPEC int32_t ompi_datatype_create_vector(
int count,
int bLength,
int stride,
202 OMPI_DECLSPEC int32_t ompi_datatype_create_hvector(
int count,
int bLength, OPAL_PTRDIFF_TYPE stride,
204 OMPI_DECLSPEC int32_t ompi_datatype_create_indexed(
int count,
const int* pBlockLength,
const int* pDisp,
206 OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed(
int count,
const int* pBlockLength,
const OPAL_PTRDIFF_TYPE* pDisp,
208 OMPI_DECLSPEC int32_t ompi_datatype_create_indexed_block(
int count,
int bLength,
const int* pDisp,
210 OMPI_DECLSPEC int32_t ompi_datatype_create_struct(
int count,
const int* pBlockLength,
const OPAL_PTRDIFF_TYPE* pDisp,
212 OMPI_DECLSPEC int32_t ompi_datatype_create_darray(
int size,
int rank,
int ndims,
int const* gsize_array,
213 int const* distrib_array,
int const* darg_array,
216 OMPI_DECLSPEC int32_t ompi_datatype_create_subarray(
int ndims,
int const* size_array,
int const* subsize_array,
217 int const* start_array,
int order,
219 static inline int32_t
223 ompi_datatype_duplicate( oldType, &type );
225 return OMPI_ERR_OUT_OF_RESOURCE;
227 opal_datatype_resize ( &type->
super, lb, extent );
232 static inline int32_t
233 ompi_datatype_type_lb(
const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp )
235 return opal_datatype_type_lb(&type->
super, disp);
238 static inline int32_t
239 ompi_datatype_type_ub(
const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp )
241 return opal_datatype_type_ub( &type->
super, disp);
244 static inline int32_t
247 return opal_datatype_type_size( &type->
super, size);
250 static inline int32_t
251 ompi_datatype_type_extent(
const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* extent )
253 return opal_datatype_type_extent( &type->
super, extent);
256 static inline int32_t
257 ompi_datatype_get_extent(
const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* lb, OPAL_PTRDIFF_TYPE* extent)
259 return opal_datatype_get_extent( &type->
super, lb, extent);
262 static inline int32_t
263 ompi_datatype_get_true_extent(
const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* true_lb, OPAL_PTRDIFF_TYPE* true_extent)
265 return opal_datatype_get_true_extent( &type->
super, true_lb, true_extent);
268 static inline int32_t
269 ompi_datatype_get_element_count(
const ompi_datatype_t* type,
size_t iSize )
271 return opal_datatype_get_element_count( &type->
super, iSize );
274 static inline int32_t
275 ompi_datatype_set_element_count(
const ompi_datatype_t* type, uint32_t count,
size_t* length )
277 return opal_datatype_set_element_count( &type->
super, count, length );
280 static inline int32_t
281 ompi_datatype_copy_content_same_ddt(
const ompi_datatype_t* type,
size_t count,
282 void* pDestBuf,
void* pSrcBuf )
286 while( 0 != count ) {
288 if( ((
size_t)length) > count ) length = (int32_t)count;
289 rc = opal_datatype_copy_content_same_ddt( &type->
super, count, (
char*)pDestBuf, (
char*)pSrcBuf );
290 if( 0 != rc )
return rc;
291 count -= (size_t)length;
296 OMPI_DECLSPEC
const ompi_datatype_t* ompi_datatype_match_size(
int size, uint16_t datakind, uint16_t datalang );
301 OMPI_DECLSPEC int32_t ompi_datatype_sndrcv(
void *sbuf, int32_t scount,
const ompi_datatype_t* sdtype,
307 OMPI_DECLSPEC int32_t ompi_datatype_get_args(
const ompi_datatype_t* pData, int32_t which,
308 int32_t * ci, int32_t * i,
309 int32_t * ca, OPAL_PTRDIFF_TYPE* a,
312 int32_t ci, int32_t ** i,
313 int32_t ca, OPAL_PTRDIFF_TYPE* a,
315 OMPI_DECLSPEC int32_t ompi_datatype_copy_args(
const ompi_datatype_t* source_data,
317 OMPI_DECLSPEC int32_t ompi_datatype_release_args(
ompi_datatype_t* pData );
323 OMPI_DECLSPEC
size_t ompi_datatype_pack_description_length(
const ompi_datatype_t* datatype );
328 OMPI_DECLSPEC
int ompi_datatype_get_pack_description(
ompi_datatype_t* datatype,
329 const void** packed_buffer );
335 OMPI_DECLSPEC
ompi_datatype_t* ompi_datatype_create_from_packed_description(
void** packed_buffer,
338 OMPI_DECLSPEC int32_t ompi_datatype_print_args(
const ompi_datatype_t* pData );
340 #if OPAL_ENABLE_DEBUG
345 OMPI_DECLSPEC
int ompi_datatype_safeguard_pointer_debug_breakpoint(
const void* actual_ptr,
int length,
346 const void* initial_ptr,
uint16_t flags
the flags
Definition: opal_datatype.h:105
Definition: opal_hash_table.h:42
void * args
Data description for the user.
Definition: ompi_datatype.h:76
dynamic pointer array
Definition: opal_pointer_array.h:45
Definition: ompi_datatype.h:68
dt_type_desc_t desc
the data description
Definition: opal_datatype.h:121
See opal_bitmap.h for an explanation of why there is a split between OPAL and ORTE for this generic c...
Remote Open MPI process structure.
Definition: proc.h:56
int size
size of list, i.e.
Definition: opal_pointer_array.h:58
opal_datatype_t super
Base opal_datatype_t superclass.
Definition: ompi_datatype.h:69
struct opal_hash_table_t * d_keyhash
Attribute fields.
Definition: ompi_datatype.h:74
void * packed_description
Packed description of the datatype.
Definition: ompi_datatype.h:77
A hash table that may be indexed with either fixed length (e.g.
Definition: opal_datatype.h:103
char name[MPI_MAX_OBJECT_NAME]
Externally visible name.
Definition: ompi_datatype.h:79
Definition: opal_convertor.h:90
opal_datatype_count_t used
the number of used elements in the description array
Definition: opal_datatype.h:94
int32_t d_f_to_c_index
Fortran index for this datatype.
Definition: ompi_datatype.h:73
Definition: ompi_datatype.h:100
int32_t id
OMPI-layers unique id of the type.
Definition: ompi_datatype.h:72
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236