Dynamic Load Balance 3.6.1+32-59d1
types.h
Go to the documentation of this file.
1/*********************************************************************************/
2/* Copyright 2009-2024 Barcelona Supercomputing Center */
3/* */
4/* This file is part of the DLB library. */
5/* */
6/* DLB is free software: you can redistribute it and/or modify */
7/* it under the terms of the GNU Lesser General Public License as published by */
8/* the Free Software Foundation, either version 3 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* DLB is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU Lesser General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU Lesser General Public License */
17/* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18/*********************************************************************************/
19
20#ifndef TYPES_H
21#define TYPES_H
22
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
26
27#include <inttypes.h>
28#include <stdbool.h>
29#include <stdint.h>
30
31#if NCPUS_AT_CONFIGURE_TIME <= 255
32typedef uint8_t cpuid_t;
33enum { DLB_CPUID_INVALID = UINT8_MAX };
34#define PRICPUID PRIu8
35#else
36typedef uint16_t cpuid_t;
37enum { DLB_CPUID_INVALID = UINT16_MAX };
38#define PRICPUID PRIu16
39#endif
40
41typedef enum VerboseOptions {
43 VB_API = 1 << 0,
44 VB_MICROLB = 1 << 1,
45 VB_SHMEM = 1 << 2,
46 VB_MPI_API = 1 << 3,
47 VB_MPI_INT = 1 << 4,
48 VB_STATS = 1 << 5,
49 VB_DROM = 1 << 6,
50 VB_ASYNC = 1 << 7,
51 VB_OMPT = 1 << 8,
52 VB_AFFINITY = 1 << 9,
53 VB_BARRIER = 1 << 10,
54 VB_TALP = 1 << 11,
55 VB_INSTR = 1 << 12,
56 VB_ALL = 0xFFFF,
57 VB_UNDEF = 0xF0000,
59
60typedef enum VerboseFormat {
62 VBF_NODE = 1 << 0,
63 VBF_MPINODE = 1 << 1,
64 VBF_MPIRANK = 1 << 2,
65 VBF_SPID = 1 << 3,
66 VBF_THREAD = 1 << 4,
67 VBF_TSTAMP = 1 << 5
69
70typedef enum InstrumentItems {
72 INST_ALL = 0xFFFF,
73 INST_MPI = 1 << 0,
74 INST_LEWI = 1 << 1,
75 INST_DROM = 1 << 2,
76 INST_TALP = 1 << 3,
77 INST_BARR = 1 << 4,
78 INST_OMPT = 1 << 5,
79 INST_CPUS = 1 << 6,
80 INST_CBCK = 1 << 7
82
83typedef enum DebugOptions {
86 DBG_WERROR = 1 << 1,
88 DBG_WARNMPI = 1 << 3,
90
91typedef enum LewiAffinity {
99
100typedef enum TalpSummaryType {
102 SUMMARY_ALL = 0xFFF9, // SUMMARY_POP_RAW and SUMMARY_NODE excluded
104 SUMMARY_POP_RAW = 1 << 1, // DEPRECATED
105 SUMMARY_NODE = 1 << 2, // DEPRECATED
108
109typedef enum TalpModel {
113
114typedef enum TalpComponent {
122
123typedef enum PolicyType {
128} policy_t;
129
130typedef enum InteractionMode {
134
135typedef enum MPISet {
141
142typedef enum OMPTOptions {
144 /* OMPTOOL_OPTS_MPI = 1 << 0, DEPRECATED */
147 /* OMPTOOL_OPTS_AGGRESSIVE = 0xF DEPRECATED */
149
150typedef enum OMPTMVersion {
156
157static inline int min_int(int a, int b) { return a < b ? a : b; }
158static inline int max_int(int a, int b) { return a > b ? a : b; }
159static inline int64_t min_int64(int64_t a, int64_t b) { return a < b ? a : b; }
160static inline int64_t max_int64(int64_t a, int64_t b) { return a > b ? a : b; }
161static inline unsigned int min_uint(unsigned int a, unsigned int b) { return a < b ? a : b; }
162static inline double min_double(double a, double b) { return a < b ? a : b; }
163static inline double max_double(double a, double b) { return a > b ? a : b; }
164
165static inline double min_double_non_zero(double a, double b) {
166 if (a == 0.0 && b == 0.0) {
167 return 0.0;
168 } else if (a == 0.0) {
169 return b;
170 } else if (b == 0.0) {
171 return a;
172 } else {
173 return min_double(a, b);
174 }
175}
176
177int parse_bool(const char *str, bool *value);
178bool equivalent_bool(const char *str1, const char *str2);
179
180int parse_negated_bool(const char *str, bool *value);
181bool equivalent_negated_bool(const char *str1, const char *str2);
182
183int parse_int(const char *str, int *value);
184bool equivalent_int(const char *str1, const char *str2);
185
186/* verbose_opts_t */
187int parse_verbose_opts(const char *str, verbose_opts_t *value);
188const char* verbose_opts_tostr(verbose_opts_t value);
189const char* get_verbose_opts_choices(void);
190bool equivalent_verbose_opts(const char *str1, const char *str2);
191
192/* verbose_fmt_t */
193int parse_verbose_fmt(const char *str, verbose_fmt_t *value);
194const char* verbose_fmt_tostr(verbose_fmt_t value);
195const char* get_verbose_fmt_choices(void);
196bool equivalent_verbose_fmt(const char *str1, const char *str2);
197
198/* instrument_item_t */
199int parse_instrument_items(const char *str, instrument_items_t *value);
201const char* get_instrument_items_choices(void);
202bool equivalent_instrument_items(const char *str1, const char *str2);
203
204/* debug_opts_t */
205int parse_debug_opts(const char *str, debug_opts_t *value);
206const char* debug_opts_tostr(debug_opts_t value);
207const char* get_debug_opts_choices(void);
208bool equivalent_debug_opts(const char *str1, const char *str2);
209
210/* lewi_affinity_t */
211int parse_lewi_affinity(const char *str, lewi_affinity_t *value);
212const char* lewi_affinity_tostr(lewi_affinity_t value);
213const char* get_lewi_affinity_choices(void);
214bool equivalent_lewi_affinity(const char *str1, const char *str2);
215
216/* policy_t */
217int parse_policy(const char *str, policy_t *value);
218const char* policy_tostr(policy_t policy);
219const char* get_policy_choices(void);
220bool equivalent_policy(const char *str1, const char *str2);
221
222/* talp_summary_t */
223int parse_talp_summary(const char *str, talp_summary_t *value);
224const char* talp_summary_tostr(talp_summary_t summary);
225const char* get_talp_summary_choices(void);
226bool equivalent_talp_summary(const char *str1, const char *str2);
227
228/* talp_model_t */
229int parse_talp_model(const char *str, talp_model_t *value);
230const char* talp_model_tostr(talp_model_t value);
231const char* get_talp_model_choices(void);
232bool equivalent_talp_model(const char *str1, const char *str2);
233
234/* talp_component_t */
235int parse_talp_component(const char *str, talp_component_t *value);
236const char* talp_component_tostr(talp_component_t value);
237const char* get_talp_component_choices(void);
238bool equivalent_talp_component(const char *str1, const char *str2);
239
240/* interaction_mode_t */
241int parse_mode(const char *str, interaction_mode_t *value);
242const char* mode_tostr(interaction_mode_t value);
243const char* get_mode_choices(void);
244bool equivalent_mode(const char *str1, const char *str2);
245
246/* mpi_set_t */
247int parse_mpiset(const char *str, mpi_set_t *value);
248const char* mpiset_tostr(mpi_set_t value);
249const char* get_mpiset_choices(void);
250bool equivalent_mpiset(const char *str1, const char *str2);
251
252/* omptool_opts_t */
253int parse_omptool_opts(const char *str, omptool_opts_t *value);
254const char* omptool_opts_tostr(omptool_opts_t value);
255const char* get_omptool_opts_choices(void);
256bool equivalent_omptool_opts(const char *str1, const char *str2);
257
258/* omptm_version_t */
259int parse_omptm_version(const char *str, omptm_version_t *value);
260const char* omptm_version_tostr(omptm_version_t value);
261const char* get_omptm_version_choices(void);
262bool equivalent_omptm_version_opts(const char *str1, const char *str2);
263
264#endif /* TYPES_H */
int parse_omptm_version(const char *str, omptm_version_t *value)
Definition: types.c:863
verbose_fmt_t
Definition: types.h:60
@ VBF_MPIRANK
Definition: types.h:64
@ VBF_SPID
Definition: types.h:65
@ VBF_THREAD
Definition: types.h:66
@ VBF_NODE
Definition: types.h:62
@ VBF_CLEAR
Definition: types.h:61
@ VBF_MPINODE
Definition: types.h:63
@ VBF_TSTAMP
Definition: types.h:67
const char * get_omptm_version_choices(void)
Definition: types.c:884
const char * debug_opts_tostr(debug_opts_t value)
Definition: types.c:356
const char * mode_tostr(interaction_mode_t value)
Definition: types.c:732
omptool_opts_t
Definition: types.h:142
@ OMPTOOL_OPTS_LEND
Definition: types.h:146
@ OMPTOOL_OPTS_NONE
Definition: types.h:143
@ OMPTOOL_OPTS_BORROW
Definition: types.h:145
const char * get_lewi_affinity_choices(void)
Definition: types.c:424
bool equivalent_int(const char *str1, const char *str2)
Definition: types.c:95
int parse_bool(const char *str, bool *value)
Definition: types.c:35
int parse_talp_summary(const char *str, talp_summary_t *value)
Definition: types.c:447
const char * get_verbose_opts_choices(void)
Definition: types.c:174
const char * verbose_opts_tostr(verbose_opts_t value)
Definition: types.c:149
const char * get_instrument_items_choices(void)
Definition: types.c:324
const char * get_talp_summary_choices(void)
Definition: types.c:527
policy_t
Definition: types.h:123
@ POLICY_LEWI_ASYNC
Definition: types.h:126
@ POLICY_NONE
Definition: types.h:124
@ POLICY_LEWI_MASK
Definition: types.h:127
@ POLICY_LEWI
Definition: types.h:125
const char * lewi_affinity_tostr(lewi_affinity_t value)
Definition: types.c:414
bool equivalent_instrument_items(const char *str1, const char *str2)
Definition: types.c:328
const char * talp_summary_tostr(talp_summary_t summary)
Definition: types.c:502
int parse_policy(const char *str, policy_t *value)
Definition: types.c:682
bool equivalent_mode(const char *str1, const char *str2)
Definition: types.c:746
talp_summary_t
Definition: types.h:100
@ SUMMARY_NONE
Definition: types.h:101
@ SUMMARY_POP_RAW
Definition: types.h:104
@ SUMMARY_POP_METRICS
Definition: types.h:103
@ SUMMARY_ALL
Definition: types.h:102
@ SUMMARY_PROCESS
Definition: types.h:106
@ SUMMARY_NODE
Definition: types.h:105
const char * talp_model_tostr(talp_model_t value)
Definition: types.c:556
int parse_talp_model(const char *str, talp_model_t *value)
Definition: types.c:545
const char * omptool_opts_tostr(omptool_opts_t value)
Definition: types.c:828
bool equivalent_talp_summary(const char *str1, const char *str2)
Definition: types.c:531
int parse_lewi_affinity(const char *str, lewi_affinity_t *value)
Definition: types.c:396
instrument_items_t
Definition: types.h:70
@ INST_TALP
Definition: types.h:76
@ INST_OMPT
Definition: types.h:78
@ INST_LEWI
Definition: types.h:74
@ INST_DROM
Definition: types.h:75
@ INST_CBCK
Definition: types.h:80
@ INST_ALL
Definition: types.h:72
@ INST_BARR
Definition: types.h:77
@ INST_CPUS
Definition: types.h:79
@ INST_MPI
Definition: types.h:73
@ INST_NONE
Definition: types.h:71
int parse_instrument_items(const char *str, instrument_items_t *value)
Definition: types.c:260
int parse_debug_opts(const char *str, debug_opts_t *value)
Definition: types.c:345
lewi_affinity_t
Definition: types.h:91
@ LEWI_AFFINITY_MASK
Definition: types.h:94
@ LEWI_AFFINITY_NEARBY_FIRST
Definition: types.h:95
@ LEWI_AFFINITY_NEARBY_ONLY
Definition: types.h:96
@ LEWI_AFFINITY_AUTO
Definition: types.h:92
@ LEWI_AFFINITY_NONE
Definition: types.h:93
@ LEWI_AFFINITY_SPREAD_IFEMPTY
Definition: types.h:97
int parse_int(const char *str, int *value)
Definition: types.c:81
const char * get_omptool_opts_choices(void)
Definition: types.c:845
bool equivalent_policy(const char *str1, const char *str2)
Definition: types.c:707
bool equivalent_negated_bool(const char *str1, const char *str2)
Definition: types.c:73
int parse_omptool_opts(const char *str, omptool_opts_t *value)
Definition: types.c:800
const char * get_policy_choices(void)
Definition: types.c:703
bool equivalent_verbose_fmt(const char *str1, const char *str2)
Definition: types.c:243
omptm_version_t
Definition: types.h:150
@ OMPTM_ROLE_SHIFT
Definition: types.h:154
@ OMPTM_NONE
Definition: types.h:151
@ OMPTM_OMP5
Definition: types.h:152
@ OMPTM_FREE_AGENTS
Definition: types.h:153
const char * get_debug_opts_choices(void)
Definition: types.c:373
int parse_negated_bool(const char *str, bool *value)
Definition: types.c:58
const char * instrument_items_tostr(instrument_items_t value)
Definition: types.c:299
debug_opts_t
Definition: types.h:83
@ DBG_CLEAR
Definition: types.h:84
@ DBG_RETURNSTOLEN
Definition: types.h:85
@ DBG_WARNMPI
Definition: types.h:88
@ DBG_LPOSTMORTEM
Definition: types.h:87
@ DBG_WERROR
Definition: types.h:86
const char * get_mpiset_choices(void)
Definition: types.c:781
const char * get_talp_model_choices(void)
Definition: types.c:566
const char * get_talp_component_choices(void)
Definition: types.c:663
bool equivalent_talp_component(const char *str1, const char *str2)
Definition: types.c:667
int parse_mpiset(const char *str, mpi_set_t *value)
Definition: types.c:760
bool equivalent_lewi_affinity(const char *str1, const char *str2)
Definition: types.c:428
int parse_verbose_opts(const char *str, verbose_opts_t *value)
Definition: types.c:116
mpi_set_t
Definition: types.h:135
@ MPISET_NONE
Definition: types.h:136
@ MPISET_ALL
Definition: types.h:137
@ MPISET_BARRIER
Definition: types.h:138
@ MPISET_COLLECTIVES
Definition: types.h:139
bool equivalent_omptool_opts(const char *str1, const char *str2)
Definition: types.c:849
bool equivalent_mpiset(const char *str1, const char *str2)
Definition: types.c:785
bool equivalent_bool(const char *str1, const char *str2)
Definition: types.c:50
int parse_verbose_fmt(const char *str, verbose_fmt_t *value)
Definition: types.c:195
uint8_t cpuid_t
Definition: types.h:32
int parse_mode(const char *str, interaction_mode_t *value)
Definition: types.c:721
const char * verbose_fmt_tostr(verbose_fmt_t value)
Definition: types.c:222
const char * omptm_version_tostr(omptm_version_t value)
Definition: types.c:874
bool equivalent_talp_model(const char *str1, const char *str2)
Definition: types.c:570
bool equivalent_verbose_opts(const char *str1, const char *str2)
Definition: types.c:178
verbose_opts_t
Definition: types.h:41
@ VB_DROM
Definition: types.h:49
@ VB_CLEAR
Definition: types.h:42
@ VB_SHMEM
Definition: types.h:45
@ VB_AFFINITY
Definition: types.h:52
@ VB_BARRIER
Definition: types.h:53
@ VB_TALP
Definition: types.h:54
@ VB_MPI_API
Definition: types.h:46
@ VB_API
Definition: types.h:43
@ VB_MICROLB
Definition: types.h:44
@ VB_ALL
Definition: types.h:56
@ VB_MPI_INT
Definition: types.h:47
@ VB_OMPT
Definition: types.h:51
@ VB_ASYNC
Definition: types.h:50
@ VB_STATS
Definition: types.h:48
@ VB_UNDEF
Definition: types.h:57
@ VB_INSTR
Definition: types.h:55
talp_model_t
Definition: types.h:109
@ TALP_MODEL_HYBRID_V2
Definition: types.h:111
@ TALP_MODEL_HYBRID_V1
Definition: types.h:110
talp_component_t
Definition: types.h:114
@ TALP_COMPONENT_DEFAULT
Definition: types.h:116
@ TALP_COMPONENT_OPENMP
Definition: types.h:118
@ TALP_COMPONENT_GPU
Definition: types.h:119
@ TALP_COMPONENT_MPI
Definition: types.h:117
@ TALP_COMPONENT_NONE
Definition: types.h:115
@ TALP_COMPONENT_HWC
Definition: types.h:120
interaction_mode_t
Definition: types.h:130
@ MODE_ASYNC
Definition: types.h:132
@ MODE_POLLING
Definition: types.h:131
const char * mpiset_tostr(mpi_set_t value)
Definition: types.c:771
const char * get_verbose_fmt_choices(void)
Definition: types.c:239
@ DLB_CPUID_INVALID
Definition: types.h:33
bool equivalent_debug_opts(const char *str1, const char *str2)
Definition: types.c:377
int parse_talp_component(const char *str, talp_component_t *value)
Definition: types.c:587
const char * policy_tostr(policy_t policy)
Definition: types.c:693
const char * talp_component_tostr(talp_component_t value)
Definition: types.c:641
const char * get_mode_choices(void)
Definition: types.c:742
bool equivalent_omptm_version_opts(const char *str1, const char *str2)
Definition: types.c:888