Line |
Branch |
Exec |
Source |
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 > 256 |
32 |
|
|
typedef uint8_t cpuid_t; |
33 |
|
|
#define PRICPUID PRIu8 |
34 |
|
|
#else |
35 |
|
|
typedef uint16_t cpuid_t; |
36 |
|
|
#define PRICPUID PRIu16 |
37 |
|
|
#endif |
38 |
|
|
|
39 |
|
|
typedef enum VerboseOptions { |
40 |
|
|
VB_CLEAR = 0, |
41 |
|
|
VB_API = 1 << 0, |
42 |
|
|
VB_MICROLB = 1 << 1, |
43 |
|
|
VB_SHMEM = 1 << 2, |
44 |
|
|
VB_MPI_API = 1 << 3, |
45 |
|
|
VB_MPI_INT = 1 << 4, |
46 |
|
|
VB_STATS = 1 << 5, |
47 |
|
|
VB_DROM = 1 << 6, |
48 |
|
|
VB_ASYNC = 1 << 7, |
49 |
|
|
VB_OMPT = 1 << 8, |
50 |
|
|
VB_AFFINITY = 1 << 9, |
51 |
|
|
VB_BARRIER = 1 << 10, |
52 |
|
|
VB_TALP = 1 << 11, |
53 |
|
|
VB_INSTR = 1 << 12, |
54 |
|
|
VB_ALL = 0xFFFF, |
55 |
|
|
VB_UNDEF = 0xF0000, |
56 |
|
|
} verbose_opts_t; |
57 |
|
|
|
58 |
|
|
typedef enum VerboseFormat { |
59 |
|
|
VBF_CLEAR = 0, |
60 |
|
|
VBF_NODE = 1 << 0, |
61 |
|
|
VBF_MPINODE = 1 << 1, |
62 |
|
|
VBF_MPIRANK = 1 << 2, |
63 |
|
|
VBF_SPID = 1 << 3, |
64 |
|
|
VBF_THREAD = 1 << 4, |
65 |
|
|
VBF_TSTAMP = 1 << 5 |
66 |
|
|
} verbose_fmt_t; |
67 |
|
|
|
68 |
|
|
typedef enum InstrumentItems { |
69 |
|
|
INST_NONE = 0, |
70 |
|
|
INST_ALL = 0xFFFF, |
71 |
|
|
INST_MPI = 1 << 0, |
72 |
|
|
INST_LEWI = 1 << 1, |
73 |
|
|
INST_DROM = 1 << 2, |
74 |
|
|
INST_TALP = 1 << 3, |
75 |
|
|
INST_BARR = 1 << 4, |
76 |
|
|
INST_OMPT = 1 << 5, |
77 |
|
|
INST_CPUS = 1 << 6, |
78 |
|
|
INST_CBCK = 1 << 7 |
79 |
|
|
} instrument_items_t; |
80 |
|
|
|
81 |
|
|
typedef enum DebugOptions { |
82 |
|
|
DBG_CLEAR = 0, |
83 |
|
|
DBG_RETURNSTOLEN = 1 << 0, |
84 |
|
|
DBG_WERROR = 1 << 1, |
85 |
|
|
DBG_LPOSTMORTEM = 1 << 2, |
86 |
|
|
DBG_WARNMPI = 1 << 3, |
87 |
|
|
} debug_opts_t; |
88 |
|
|
|
89 |
|
|
typedef enum LewiAffinity { |
90 |
|
|
LEWI_AFFINITY_AUTO, |
91 |
|
|
LEWI_AFFINITY_NONE, |
92 |
|
|
LEWI_AFFINITY_MASK, |
93 |
|
|
LEWI_AFFINITY_NEARBY_FIRST, |
94 |
|
|
LEWI_AFFINITY_NEARBY_ONLY, |
95 |
|
|
LEWI_AFFINITY_SPREAD_IFEMPTY, |
96 |
|
|
} lewi_affinity_t; |
97 |
|
|
|
98 |
|
|
typedef enum TalpSummaryType { |
99 |
|
|
SUMMARY_NONE = 0, |
100 |
|
|
SUMMARY_ALL = 0xFFF9, // SUMMARY_POP_RAW and SUMMARY_NODE excluded |
101 |
|
|
SUMMARY_POP_METRICS = 1 << 0, |
102 |
|
|
SUMMARY_POP_RAW = 1 << 1, // DEPRECATED |
103 |
|
|
SUMMARY_NODE = 1 << 2, // DEPRECATED |
104 |
|
|
SUMMARY_PROCESS = 1 << 3, |
105 |
|
|
} talp_summary_t; |
106 |
|
|
|
107 |
|
|
typedef enum TalpModel { |
108 |
|
|
TALP_MODEL_HYBRID_V1, |
109 |
|
|
TALP_MODEL_HYBRID_V2, |
110 |
|
|
} talp_model_t; |
111 |
|
|
|
112 |
|
|
typedef enum PolicyType { |
113 |
|
|
POLICY_NONE, |
114 |
|
|
POLICY_LEWI, |
115 |
|
|
POLICY_LEWI_ASYNC, |
116 |
|
|
POLICY_LEWI_MASK, |
117 |
|
|
} policy_t; |
118 |
|
|
|
119 |
|
|
typedef enum InteractionMode { |
120 |
|
|
MODE_POLLING, |
121 |
|
|
MODE_ASYNC |
122 |
|
|
} interaction_mode_t; |
123 |
|
|
|
124 |
|
|
typedef enum MPISet { |
125 |
|
|
MPISET_NONE, |
126 |
|
|
MPISET_ALL, |
127 |
|
|
MPISET_BARRIER, |
128 |
|
|
MPISET_COLLECTIVES |
129 |
|
|
} mpi_set_t; |
130 |
|
|
|
131 |
|
|
typedef enum OMPTOptions { |
132 |
|
|
OMPTOOL_OPTS_NONE = 0, |
133 |
|
|
/* OMPTOOL_OPTS_MPI = 1 << 0, DEPRECATED */ |
134 |
|
|
OMPTOOL_OPTS_BORROW = 1 << 1, |
135 |
|
|
OMPTOOL_OPTS_LEND = 1 << 2, |
136 |
|
|
/* OMPTOOL_OPTS_AGGRESSIVE = 0xF DEPRECATED */ |
137 |
|
|
} omptool_opts_t; |
138 |
|
|
|
139 |
|
|
typedef enum OMPTMVersion { |
140 |
|
|
OMPTM_NONE, |
141 |
|
|
OMPTM_OMP5, |
142 |
|
|
OMPTM_FREE_AGENTS, |
143 |
|
|
OMPTM_ROLE_SHIFT |
144 |
|
|
} omptm_version_t; |
145 |
|
|
|
146 |
|
8 |
static inline int min_int(int a, int b) { return a < b ? a : b; } |
147 |
|
2338 |
static inline int max_int(int a, int b) { return a > b ? a : b; } |
148 |
|
3 |
static inline int64_t min_int64(int64_t a, int64_t b) { return a < b ? a : b; } |
149 |
|
12 |
static inline int64_t max_int64(int64_t a, int64_t b) { return a > b ? a : b; } |
150 |
|
294 |
static inline unsigned int min_uint(unsigned int a, unsigned int b) { return a < b ? a : b; } |
151 |
|
|
|
152 |
|
|
int parse_bool(const char *str, bool *value); |
153 |
|
|
bool equivalent_bool(const char *str1, const char *str2); |
154 |
|
|
|
155 |
|
|
int parse_negated_bool(const char *str, bool *value); |
156 |
|
|
bool equivalent_negated_bool(const char *str1, const char *str2); |
157 |
|
|
|
158 |
|
|
int parse_int(const char *str, int *value); |
159 |
|
|
bool equivalent_int(const char *str1, const char *str2); |
160 |
|
|
|
161 |
|
|
/* verbose_opts_t */ |
162 |
|
|
int parse_verbose_opts(const char *str, verbose_opts_t *value); |
163 |
|
|
const char* verbose_opts_tostr(verbose_opts_t value); |
164 |
|
|
const char* get_verbose_opts_choices(void); |
165 |
|
|
bool equivalent_verbose_opts(const char *str1, const char *str2); |
166 |
|
|
|
167 |
|
|
/* verbose_fmt_t */ |
168 |
|
|
int parse_verbose_fmt(const char *str, verbose_fmt_t *value); |
169 |
|
|
const char* verbose_fmt_tostr(verbose_fmt_t value); |
170 |
|
|
const char* get_verbose_fmt_choices(void); |
171 |
|
|
bool equivalent_verbose_fmt(const char *str1, const char *str2); |
172 |
|
|
|
173 |
|
|
/* instrument_item_t */ |
174 |
|
|
int parse_instrument_items(const char *str, instrument_items_t *value); |
175 |
|
|
const char* instrument_items_tostr(instrument_items_t value); |
176 |
|
|
const char* get_instrument_items_choices(void); |
177 |
|
|
bool equivalent_instrument_items(const char *str1, const char *str2); |
178 |
|
|
|
179 |
|
|
/* debug_opts_t */ |
180 |
|
|
int parse_debug_opts(const char *str, debug_opts_t *value); |
181 |
|
|
const char* debug_opts_tostr(debug_opts_t value); |
182 |
|
|
const char* get_debug_opts_choices(void); |
183 |
|
|
bool equivalent_debug_opts(const char *str1, const char *str2); |
184 |
|
|
|
185 |
|
|
/* lewi_affinity_t */ |
186 |
|
|
int parse_lewi_affinity(const char *str, lewi_affinity_t *value); |
187 |
|
|
const char* lewi_affinity_tostr(lewi_affinity_t value); |
188 |
|
|
const char* get_lewi_affinity_choices(void); |
189 |
|
|
bool equivalent_lewi_affinity(const char *str1, const char *str2); |
190 |
|
|
|
191 |
|
|
/* policy_t */ |
192 |
|
|
int parse_policy(const char *str, policy_t *value); |
193 |
|
|
const char* policy_tostr(policy_t policy); |
194 |
|
|
const char* get_policy_choices(void); |
195 |
|
|
bool equivalent_policy(const char *str1, const char *str2); |
196 |
|
|
|
197 |
|
|
/* talp_summary_t */ |
198 |
|
|
int parse_talp_summary(const char *str, talp_summary_t *value); |
199 |
|
|
const char* talp_summary_tostr(talp_summary_t summary); |
200 |
|
|
const char* get_talp_summary_choices(void); |
201 |
|
|
bool equivalent_talp_summary(const char *str1, const char *str2); |
202 |
|
|
|
203 |
|
|
/* talp_model_t */ |
204 |
|
|
int parse_talp_model(const char *str, talp_model_t *value); |
205 |
|
|
const char* talp_model_tostr(talp_model_t value); |
206 |
|
|
const char* get_talp_model_choices(void); |
207 |
|
|
bool equivalent_talp_model(const char *str1, const char *str2); |
208 |
|
|
|
209 |
|
|
/* interaction_mode_t */ |
210 |
|
|
int parse_mode(const char *str, interaction_mode_t *value); |
211 |
|
|
const char* mode_tostr(interaction_mode_t value); |
212 |
|
|
const char* get_mode_choices(void); |
213 |
|
|
bool equivalent_mode(const char *str1, const char *str2); |
214 |
|
|
|
215 |
|
|
/* mpi_set_t */ |
216 |
|
|
int parse_mpiset(const char *str, mpi_set_t *value); |
217 |
|
|
const char* mpiset_tostr(mpi_set_t value); |
218 |
|
|
const char* get_mpiset_choices(void); |
219 |
|
|
bool equivalent_mpiset(const char *str1, const char *str2); |
220 |
|
|
|
221 |
|
|
/* omptool_opts_t */ |
222 |
|
|
int parse_omptool_opts(const char *str, omptool_opts_t *value); |
223 |
|
|
const char* omptool_opts_tostr(omptool_opts_t value); |
224 |
|
|
const char* get_omptool_opts_choices(void); |
225 |
|
|
bool equivalent_omptool_opts(const char *str1, const char *str2); |
226 |
|
|
|
227 |
|
|
/* omptm_version_t */ |
228 |
|
|
int parse_omptm_version(const char *str, omptm_version_t *value); |
229 |
|
|
const char* omptm_version_tostr(omptm_version_t value); |
230 |
|
|
const char* get_omptm_version_choices(void); |
231 |
|
|
bool equivalent_omptm_version_opts(const char *str1, const char *str2); |
232 |
|
|
|
233 |
|
|
#endif /* TYPES_H */ |
234 |
|
|
|