32 #ifndef OPAL_DATATYPE_H_HAS_BEEN_INCLUDED
33 #define OPAL_DATATYPE_H_HAS_BEEN_INCLUDED
35 #include "opal_config.h"
52 #define OPAL_DATATYPE_MAX_PREDEFINED 25
59 #define OPAL_DATATYPE_MAX_SUPPORTED 46
63 #define OPAL_DATATYPE_FLAG_UNAVAILABLE 0x0001
64 #define OPAL_DATATYPE_FLAG_PREDEFINED 0x0002
65 #define OPAL_DATATYPE_FLAG_COMMITED 0x0004
66 #define OPAL_DATATYPE_FLAG_OVERLAP 0x0008
67 #define OPAL_DATATYPE_FLAG_CONTIGUOUS 0x0010
68 #define OPAL_DATATYPE_FLAG_NO_GAPS 0x0020
69 #define OPAL_DATATYPE_FLAG_USER_LB 0x0040
70 #define OPAL_DATATYPE_FLAG_USER_UB 0x0080
71 #define OPAL_DATATYPE_FLAG_DATA 0x0100
76 #define OPAL_DATATYPE_FLAG_BASIC (OPAL_DATATYPE_FLAG_PREDEFINED | \
77 OPAL_DATATYPE_FLAG_CONTIGUOUS | \
78 OPAL_DATATYPE_FLAG_NO_GAPS | \
79 OPAL_DATATYPE_FLAG_DATA | \
80 OPAL_DATATYPE_FLAG_COMMITED)
87 #define MAX_DT_COMPONENT_COUNT UINT_MAX
88 typedef uint32_t opal_datatype_count_t;
94 opal_datatype_count_t
used;
112 OPAL_PTRDIFF_TYPE
lb;
113 OPAL_PTRDIFF_TYPE
ub;
119 char name[OPAL_MAX_OBJECT_NAME];
125 uint32_t
btypes[OPAL_DATATYPE_MAX_SUPPORTED];
140 OPAL_DECLSPEC
extern const opal_datatype_t* opal_datatype_basicDatatypes[OPAL_DATATYPE_MAX_PREDEFINED];
141 OPAL_DECLSPEC
extern const size_t opal_datatype_local_sizes[OPAL_DATATYPE_MAX_PREDEFINED];
144 OPAL_DECLSPEC
extern uint32_t opal_local_arch;
179 int opal_datatype_register_params(
void);
180 OPAL_DECLSPEC int32_t opal_datatype_init(
void );
181 OPAL_DECLSPEC int32_t opal_datatype_finalize(
void );
182 OPAL_DECLSPEC
opal_datatype_t* opal_datatype_create( int32_t expectedSize );
183 OPAL_DECLSPEC int32_t opal_datatype_create_desc(
opal_datatype_t * datatype, int32_t expectedSize );
187 static inline int32_t
190 return ((type->
flags & OPAL_DATATYPE_FLAG_COMMITED) == OPAL_DATATYPE_FLAG_COMMITED);
193 static inline int32_t
196 return ((type->
flags & OPAL_DATATYPE_FLAG_OVERLAP) == OPAL_DATATYPE_FLAG_OVERLAP);
199 static inline int32_t
202 return !((type->
flags & OPAL_DATATYPE_FLAG_UNAVAILABLE) == OPAL_DATATYPE_FLAG_UNAVAILABLE);
205 static inline int32_t
208 return (type->
flags & OPAL_DATATYPE_FLAG_PREDEFINED);
215 static inline int32_t
216 opal_datatype_is_contiguous_memory_layout(
const opal_datatype_t* datatype, int32_t count )
218 if( !(datatype->
flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) )
return 0;
219 if( (count == 1) || (datatype->
flags & OPAL_DATATYPE_FLAG_NO_GAPS) )
return 1;
220 assert( (OPAL_PTRDIFF_TYPE)datatype->
size != (datatype->
ub - datatype->
lb) );
229 OPAL_DECLSPEC int32_t opal_datatype_resize(
opal_datatype_t* type, OPAL_PTRDIFF_TYPE
lb, OPAL_PTRDIFF_TYPE extent );
231 OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent );
233 static inline int32_t
234 opal_datatype_type_lb(
const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp )
240 static inline int32_t
241 opal_datatype_type_ub(
const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp )
247 static inline int32_t
254 static inline int32_t
255 opal_datatype_type_extent(
const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* extent )
257 *extent = pData->
ub - pData->
lb;
261 static inline int32_t
262 opal_datatype_get_extent(
const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE*
lb, OPAL_PTRDIFF_TYPE* extent)
264 *lb = pData->
lb; *extent = pData->
ub - pData->
lb;
268 static inline int32_t
269 opal_datatype_get_true_extent(
const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE*
true_lb, OPAL_PTRDIFF_TYPE* true_extent)
276 OPAL_DECLSPEC int32_t
277 opal_datatype_get_element_count(
const opal_datatype_t* pData,
size_t iSize );
278 OPAL_DECLSPEC int32_t
279 opal_datatype_set_element_count(
const opal_datatype_t* pData, uint32_t count,
size_t* length );
280 OPAL_DECLSPEC int32_t
281 opal_datatype_copy_content_same_ddt(
const opal_datatype_t* pData, int32_t count,
282 char* pDestBuf,
char* pSrcBuf );
285 opal_datatype_match_size(
int size, uint16_t datakind, uint16_t datalang );
290 OPAL_DECLSPEC int32_t
291 opal_datatype_sndrcv(
void *sbuf, int32_t scount,
const opal_datatype_t* sdtype,
void *rbuf,
297 OPAL_DECLSPEC int32_t
299 int32_t * ci, int32_t * i,
300 int32_t * ca, OPAL_PTRDIFF_TYPE* a,
302 OPAL_DECLSPEC int32_t
304 int32_t ci, int32_t ** i,
305 int32_t ca, OPAL_PTRDIFF_TYPE* a,
307 OPAL_DECLSPEC int32_t
310 OPAL_DECLSPEC int32_t
317 opal_datatype_pack_description_length(
const opal_datatype_t* datatype );
324 const void** packed_buffer );
331 opal_datatype_create_from_packed_description(
void** packed_buffer,
332 struct opal_proc_t* remote_processor );
334 #if OPAL_ENABLE_DEBUG
340 opal_datatype_safeguard_pointer_debug_breakpoint(
const void* actual_ptr,
int length,
341 const void* initial_ptr,
uint16_t flags
the flags
Definition: opal_datatype.h:105
uint16_t id
data id, normally the index in the data array.
Definition: opal_datatype.h:106
opal_object_t super
basic superclass
Definition: opal_datatype.h:104
Definition: opal_datatype_internal.h:184
uint32_t bdt_used
bitset of which basic datatypes are used in the data description
Definition: opal_datatype.h:107
Definition: opal_datatype.h:92
opal_datatype_count_t length
the maximum number of elements in the description array
Definition: opal_datatype.h:93
dt_type_desc_t desc
the data description
Definition: opal_datatype.h:121
OPAL_PTRDIFF_TYPE lb
lower bound in memory
Definition: opal_datatype.h:112
OPAL_PTRDIFF_TYPE ub
upper bound in memory
Definition: opal_datatype.h:113
uint32_t align
data should be aligned to
Definition: opal_datatype.h:115
size_t size
total size in bytes of the memory used by the data if the data is put on a contiguous buffer ...
Definition: opal_datatype.h:108
Definition: opal_datatype.h:103
Base object.
Definition: opal_object.h:182
opal_datatype_count_t used
the number of used elements in the description array
Definition: opal_datatype.h:94
uint32_t btypes[OPAL_DATATYPE_MAX_SUPPORTED]
basic elements count used to compute the size of the datatype for remote nodes.
Definition: opal_datatype.h:125
OPAL_PTRDIFF_TYPE true_ub
the true ub of the data without user defined lb and ub
Definition: opal_datatype.h:111
dt_type_desc_t opt_desc
short description of the data used when conversion is useless or in the send case (without conversion...
Definition: opal_datatype.h:122
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
uint32_t nbElems
total number of elements inside the datatype
Definition: opal_datatype.h:116
OPAL_PTRDIFF_TYPE true_lb
the true lb of the data without user defined lb and ub
Definition: opal_datatype.h:110
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
char name[OPAL_MAX_OBJECT_NAME]
name of the datatype
Definition: opal_datatype.h:119