DASH  0.3.0
dart_types.h
Go to the documentation of this file.
1 
9 #ifndef DART_TYPES_H_INCLUDED
10 #define DART_TYPES_H_INCLUDED
11 
12 #include <stdlib.h>
13 #include <stdint.h>
14 #include <stdbool.h>
15 #include <limits.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
22 #define DART_INTERFACE_ON
23 
30 typedef enum
31 {
33  DART_OK = 0,
46 } dart_ret_t;
47 
48 
54 enum {
56  DART_EXIT_SUCCESS = EXIT_SUCCESS,
58  DART_EXIT_ABORT = EXIT_FAILURE,
61 };
62 
63 
68 enum
69 {
100 };
101 
102 typedef uintptr_t dart_operation_t ;
103 
108 #define DART_OP_MINMAX_MIN 0
109 
114 #define DART_OP_MINMAX_MAX 1
115 
121 typedef intptr_t dart_datatype_t;
122 
123 #define DART_TYPE_UNDEFINED (dart_datatype_t)(0)
124 #define DART_TYPE_BYTE (dart_datatype_t)(1)
126 #define DART_TYPE_SHORT (dart_datatype_t)(2)
127 #define DART_TYPE_INT (dart_datatype_t)(3)
128 #define DART_TYPE_UINT (dart_datatype_t)(4)
129 #define DART_TYPE_LONG (dart_datatype_t)(5)
130 #define DART_TYPE_ULONG (dart_datatype_t)(6)
131 #define DART_TYPE_LONGLONG (dart_datatype_t)(7)
132 #define DART_TYPE_ULONGLONG (dart_datatype_t)(8)
133 #define DART_TYPE_FLOAT (dart_datatype_t)(9)
135 #define DART_TYPE_DOUBLE (dart_datatype_t)(10)
136 #define DART_TYPE_LONG_DOUBLE (dart_datatype_t)(11)
137 #define DART_TYPE_LAST (dart_datatype_t)(12)
139 
140 
142 #if (UINT32_MAX == SIZE_MAX)
143 # define DART_TYPE_SIZET DART_TYPE_ULONG
144 #elif (UINT64_MAX == SIZE_MAX)
145 # define DART_TYPE_SIZET DART_TYPE_ULONGLONG
146 #else
147 # error "Cannot determine DART type for size_t!"
148 #endif
149 
154 typedef int32_t dart_unit_t;
155 
160 #define DART_UNDEFINED_UNIT_ID ((dart_unit_t)(-1))
161 
166 typedef struct dart_global_unit {
167 #ifdef __cplusplus
168  constexpr dart_global_unit() : id(DART_UNDEFINED_UNIT_ID) { }
169  constexpr dart_global_unit(dart_unit_t uid) : id(uid) { }
170 #endif
171  dart_unit_t id;
173 
174 
180 typedef struct dart_local_unit {
181 #ifdef __cplusplus
182  constexpr dart_local_unit() : id(DART_UNDEFINED_UNIT_ID) { }
183  constexpr dart_local_unit(dart_unit_t uid) : id(uid) { }
184 #endif
185  dart_unit_t id;
187 
192 static inline
194 {
195  dart_team_unit_t tmp = {unit};
196  return tmp;
197 }
198 
206 #define DART_TEAM_UNIT_ID(__u) (dart_create_team_unit(__u))
207 
208 
214 static inline
216 {
217  dart_global_unit_t tmp = {unit};
218  return tmp;
219 }
220 
228 #define DART_GLOBAL_UNIT_ID(__u) (dart_create_global_unit(__u))
229 
237 #define DART_UNDEFINED_TEAM_UNIT_ID DART_TEAM_UNIT_ID(DART_UNDEFINED_UNIT_ID)
238 
246 #define DART_UNDEFINED_GLOBAL_UNIT_ID DART_GLOBAL_UNIT_ID(DART_UNDEFINED_UNIT_ID)
247 
252 typedef int16_t dart_team_t;
253 
258 #define DART_UNDEFINED_TEAM_ID ((dart_team_t)(-1))
259 
260 
269 typedef enum
270 {
279 
290 typedef enum
291 {
292  DART_LOCALITY_SCOPE_UNDEFINED = -1,
327 }
329 
331 #if defined(HOST_NAME_MAX)
332  #define DART_LOCALITY_HOST_MAX_SIZE (HOST_NAME_MAX)
333 #elif defined(_POSIX_HOST_NAME_MAX)
334  #define DART_LOCALITY_HOST_MAX_SIZE (_POSIX_HOST_NAME_MAX)
335 #else
336  #define DART_LOCALITY_HOST_MAX_SIZE ((int)(256))
337 #endif
338 
339 #define DART_LOCALITY_DOMAIN_TAG_MAX_SIZE ((int)(32))
340 
341 #define DART_LOCALITY_MAX_DOMAIN_SCOPES ((int)(12))
342 
344 #define DART_LOCALITY_UNIT_MAX_CPUS ((int)(64))
345 
346 #define DART_LOCALITY_MAX_NUMA_ID ((int)(16))
347 
348 #define DART_LOCALITY_MAX_CACHE_LEVELS ((int)( 5))
349 
350 typedef struct {
354  int index;
355 }
357 
367 typedef struct
368 {
371 
374 
375  int num_numa;
376 
377  int numa_id;
378 
379  int num_sockets;
380 
383  int core_id;
386  int cpu_id;
387 
392 
396  int cache_line_sizes[DART_LOCALITY_MAX_CACHE_LEVELS];
399 
404 
407 
410 
413 
416 
417  int num_scopes;
418 }
420 
421 typedef struct
422 {
425 
428 
431 }
433 
598 {
601 
607 
608  struct dart_domain_locality_s ** aliases;
609 
610  int num_aliases;
611 
615  int level;
616 
621 
625 
631 
634 
636  dart_team_t team;
641 
642  /* The number of compute nodes in the domain. */
643  int num_nodes;
644  /* Node (machine) index of the domain or -1 if domain contains
645  * multiple compute nodes. */
646  int node_id;
647 
648  /* Number of cores in the domain. Cores may be heterogeneous unless
649  * `is_symmetric` is different from 0. */
650  int num_cores;
651 
652  /* The minimum size of the physical or logical shared memory
653  * accessible by all units in the domain.
654  */
655  int shared_mem_bytes;
656 };
658 typedef struct dart_domain_locality_s
660 
672 typedef struct {
675 
677  dart_team_t team;
678 
681 
682  char domain_tag[DART_LOCALITY_DOMAIN_TAG_MAX_SIZE];
683 }
685 
689 typedef struct
690 {
691  int log_enabled;
692 }
694 
711  dart_datatype_t basetype,
712  size_t stride,
713  size_t blocklen,
714  dart_datatype_t * newtype);
715 
716 
735  dart_datatype_t basetype,
736  size_t count,
737  const size_t blocklen[],
738  const size_t offset[],
739  dart_datatype_t * newtype);
740 
741 
754  size_t num_bytes,
755  dart_datatype_t * newtype);
756 
772 dart_type_destroy(dart_datatype_t *dart_type);
773 
782 typedef void (*dart_operator_t)(
783  const void * invec,
784  void * inoutvec,
785  size_t len,
786  void * user_data);
787 
808  dart_operator_t op,
809  void * userdata,
810  bool commute,
811  dart_datatype_t dtype,
812  bool dtype_is_tmp,
813  dart_operation_t * new_op);
814 
820 dart_op_destroy(dart_operation_t *op);
821 
823 #define DART_INTERFACE_OFF
824 
826 #ifdef __cplusplus
827 }
828 #endif
829 
830 #endif /* DART_TYPES_H_INCLUDED */
#define DART_LOCALITY_HOST_MAX_SIZE
Maximum size of a host name string in dart_hwinfo_t.
Definition: dart_types.h:336
int max_cpu_mhz
Maximum clock frequency of CPUs in the domain.
Definition: dart_types.h:391
#define DART_LOCALITY_MAX_DOMAIN_SCOPES
Maximum number of domain scopes in dart_hwinfo_t.
Definition: dart_types.h:341
Interconnect topology scope, components may be heterogenous.
Definition: dart_types.h:299
Locality and topology information of a single unit.
Definition: dart_types.h:672
int numa_memory_bytes
Maximum memory per numa node in bytes.
Definition: dart_types.h:412
Logical OR.
Definition: dart_types.h:89
dart_thread_support_level_t
Levels of thread-support offered by DART.
Definition: dart_types.h:269
struct dart_global_unit dart_global_unit_t
Data type for storing a global unit ID.
int core_id
The unit&#39;s affine core, unique identifier within a processing module.
Definition: dart_types.h:383
int num_cores
Total number of CPUs in the associated domain.
Definition: dart_types.h:373
Logical AND.
Definition: dart_types.h:85
Unspecified error.
Definition: dart_types.h:45
Locality of homogenous components in the same NUMA domain at process-level, i.e.
Definition: dart_types.h:311
Signals success.
Definition: dart_types.h:33
Node-level locality scope, components may be heterogenous.
Definition: dart_types.h:301
dart_ret_t dart_op_destroy(dart_operation_t *op)
Destroy a operation object created through dart_op_create and set op to DART_OP_UNDEFINED.
Signal abort after failed assert.
Definition: dart_types.h:60
Group of domains in specific locality scope, used as parent scope of domains in a user-defined group ...
Definition: dart_types.h:297
dart_global_unit_t * unit_ids
Global IDs of units in the domain.
Definition: dart_types.h:640
intptr_t dart_datatype_t
Raw data types supported by the DART interface.
Definition: dart_types.h:121
int32_t dart_unit_t
Data type for storing a unit ID.
Definition: dart_types.h:154
dart_team_t team
Team ID.
Definition: dart_types.h:677
dart_team_t team
Team associated with the domain.
Definition: dart_types.h:636
dart_hwinfo_t hwinfo
Hardware specification of the unit&#39;s affinity.
Definition: dart_types.h:680
Binary XOR.
Definition: dart_types.h:91
int num_domains
Number of subordinate domains.
Definition: dart_types.h:627
No operation.
Definition: dart_types.h:97
Maximum.
Definition: dart_types.h:75
No support for thread-based concurrency in DART is provided.
Definition: dart_types.h:272
Product.
Definition: dart_types.h:81
dart_ret_t dart_type_destroy(dart_datatype_t *dart_type)
Destroy a data type that was previously created using dart_type_create_strided or dart_type_create_in...
int system_memory_bytes
Maximum allocatable memory per node in bytes.
Definition: dart_types.h:409
int level
Level in the domain locality hierarchy.
Definition: dart_types.h:615
static dart_global_unit_t dart_create_global_unit(dart_unit_t unit)
Create a dart_global_unit_t from a dart_unit_t.
Definition: dart_types.h:215
A domain is a group of processing entities such as cores in a specific NUMA domain or a Intel MIC ent...
Definition: dart_types.h:597
Global locality scope, components may be heterogenous.
Definition: dart_types.h:294
static dart_team_unit_t dart_create_team_unit(dart_unit_t unit)
Create a dart_team_unit_t from a dart_unit_t.
Definition: dart_types.h:193
int min_cpu_mhz
Minimum clock frequency of CPUs in the domain.
Definition: dart_types.h:389
int num_units
Number of units in the domain.
Definition: dart_types.h:638
Locality at physical processing core level.
Definition: dart_types.h:323
struct dart_local_unit dart_team_unit_t
Data type for storing a unit ID relative to a team.
Logical XOR.
Definition: dart_types.h:93
Support for thread-based concurrency is provided by DART and the underlying runtime.
Definition: dart_types.h:277
dart_locality_scope_pos_t pos
The module&#39;s parent scope and its relative position in the scope.
Definition: dart_types.h:430
int global_index
The domain&#39;s global index within its scope.
Definition: dart_types.h:618
Data type for storing a unit ID relative to a team.
Definition: dart_types.h:180
Invalid operation or parameters.
Definition: dart_types.h:37
Minimum and Maximum.
Definition: dart_types.h:77
Binary OR.
Definition: dart_types.h:87
Signal success.
Definition: dart_types.h:56
dart_ret_t dart_type_create_strided(dart_datatype_t basetype, size_t stride, size_t blocklen, dart_datatype_t *newtype)
Create a strided data type using blocks of size blocklen and a stride of stride.
dart_locality_scope_t scope
The domain&#39;s scope identifier.
Definition: dart_types.h:352
int max_threads
Maximum number of CPU threads per core.
Definition: dart_types.h:403
Locality of homogenous components in different NUMA domains.
Definition: dart_types.h:306
DART has not been initialized.
Definition: dart_types.h:43
Number of operations defined, not an actual operation!
Definition: dart_types.h:99
dart_locality_scope_t scope
Locality scope of the domain.
Definition: dart_types.h:613
Locality at processor uncore (system agent) level.
Definition: dart_types.h:317
dart_ret_t dart_type_create_custom(size_t num_bytes, dart_datatype_t *newtype)
Create a custom data type of size num_bytes bytes.
Binary AND.
Definition: dart_types.h:83
#define DART_LOCALITY_DOMAIN_TAG_MAX_SIZE
Maximum size of a domain tag string in dart_hwinfo_t.
Definition: dart_types.h:339
Undefined, do not use.
Definition: dart_types.h:71
An operation is still pending.
Definition: dart_types.h:35
dart_ret_t dart_type_create_indexed(dart_datatype_t basetype, size_t count, const size_t blocklen[], const size_t offset[], dart_datatype_t *newtype)
Create an indexed data type using count blocks of size blocklen[i] with offsets offset[i] for each 0 ...
dart_ret_t
Return values of functions in the DART interface.
Definition: dart_types.h:30
Hardware locality information for a single locality domain.
Definition: dart_types.h:367
int16_t dart_team_t
Data type for storing a team ID.
Definition: dart_types.h:252
Data type for storing a global unit ID.
Definition: dart_types.h:166
Locality at level of physical CPU cache.
Definition: dart_types.h:320
Missing data encountered.
Definition: dart_types.h:39
int relative_index
The domain&#39;s index within its parent domain.
Definition: dart_types.h:620
int min_threads
Minimum number of CPU threads per core.
Definition: dart_types.h:401
Locality in a group of hetereogenous components in different NUMA domains.
Definition: dart_types.h:304
#define DART_UNDEFINED_UNIT_ID
Undefined unit ID.
Definition: dart_types.h:160
Replace Value.
Definition: dart_types.h:95
Summation.
Definition: dart_types.h:79
int index
The domain&#39;s relative index among its siblings in the scope.
Definition: dart_types.h:354
int max_shmem_mbps
Maximum local shared memory bandwidth in MB/s.
Definition: dart_types.h:406
struct dart_domain_locality_s * parent
Pointer to descriptor of parent domain or 0 if no parent domain is specified.
Definition: dart_types.h:624
dart_team_unit_t unit
Unit ID relative to team.
Definition: dart_types.h:674
Signal generic abort.
Definition: dart_types.h:58
int cpu_id
The unit&#39;s affine processing unit (SMP), unique identifier within a processing module.
Definition: dart_types.h:386
DART has not been initialized.
Definition: dart_types.h:41
Locality at level of physical processor package.
Definition: dart_types.h:314
#define DART_LOCALITY_MAX_CACHE_LEVELS
Maximum number of cache levels supported in dart_hwinfo_t.
Definition: dart_types.h:348
Locality at logical CPU level (SMT thread).
Definition: dart_types.h:326
dart_ret_t dart_op_create(dart_operator_t op, void *userdata, bool commute, dart_datatype_t dtype, bool dtype_is_tmp, dart_operation_t *new_op)
Create a new operation new_op that can be used in collective reduction operations, i.e., dart_reduce, dart_allreduce.
struct dart_domain_locality_s ** children
Array of subordinate domains of size num_domains or 0 if no subdomains are specified.
Definition: dart_types.h:630
Minimum.
Definition: dart_types.h:73
dart_locality_scope_t
Scopes of locality domains.
Definition: dart_types.h:290
void(* dart_operator_t)(const void *invec, void *inoutvec, size_t len, void *user_data)
The operator called from a reduction operation.
Definition: dart_types.h:782
int is_symmetric
Whether sub-domains have identical hardware configuration.
Definition: dart_types.h:633