1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #ifndef PMIX_GLOBALS_H
26 #define PMIX_GLOBALS_H
27
28 #include <src/include/pmix_config.h>
29
30 #include <pmix_common.h>
31
32 #include <src/include/types.h>
33
34 #include <unistd.h>
35 #ifdef HAVE_SYS_TYPES_H
36 #include <sys/types.h>
37 #endif
38 #include PMIX_EVENT_HEADER
39
40 #include <pmix.h>
41 #include <pmix_common.h>
42
43 #include "src/class/pmix_hash_table.h"
44 #include "src/class/pmix_list.h"
45 #include "src/class/pmix_hotel.h"
46 #include "src/event/pmix_event.h"
47 #include "src/threads/threads.h"
48
49 #include "src/mca/bfrops/bfrops.h"
50 #include "src/mca/gds/gds.h"
51 #include "src/mca/psec/psec.h"
52 #include "src/mca/ptl/ptl.h"
53
54 BEGIN_C_DECLS
55
56
57 #define PMIX_MAX_CRED_SIZE 131072
58 #define PMIX_MAX_ERR_CONSTANT INT_MIN
59
60
61 #define PMIX_BFROPS_MODULE "pmix.bfrops.mod"
62 #define PMIX_PNET_SETUP_APP "pmix.pnet.setapp"
63
64
65 #define PMIX_INFO_OP_COMPLETE 0x80000000
66 #define PMIX_INFO_OP_COMPLETED(m) \
67 ((pmix_info_t*)(m))->flags |= PMIX_INFO_OP_COMPLETE
68 #define PMIX_INFO_OP_IS_COMPLETE(m) \
69 ((m)->flags & PMIX_INFO_OP_COMPLETE)
70
71
72
73 typedef struct {
74 char *nspace;
75 pmix_rank_t rank;
76 } pmix_name_t;
77
78
79
80 typedef struct {
81 pmix_list_item_t super;
82 pmix_name_t *pname;
83 } pmix_namelist_t;
84 PMIX_CLASS_DECLARATION(pmix_namelist_t);
85
86
87
88 typedef uint8_t pmix_cmd_t;
89
90
91 #define PMIX_REQ_CMD 0
92 #define PMIX_ABORT_CMD 1
93 #define PMIX_COMMIT_CMD 2
94 #define PMIX_FENCENB_CMD 3
95 #define PMIX_GETNB_CMD 4
96 #define PMIX_FINALIZE_CMD 5
97 #define PMIX_PUBLISHNB_CMD 6
98 #define PMIX_LOOKUPNB_CMD 7
99 #define PMIX_UNPUBLISHNB_CMD 8
100 #define PMIX_SPAWNNB_CMD 9
101 #define PMIX_CONNECTNB_CMD 10
102 #define PMIX_DISCONNECTNB_CMD 11
103 #define PMIX_NOTIFY_CMD 12
104 #define PMIX_REGEVENTS_CMD 13
105 #define PMIX_DEREGEVENTS_CMD 14
106 #define PMIX_QUERY_CMD 15
107 #define PMIX_LOG_CMD 16
108 #define PMIX_ALLOC_CMD 17
109 #define PMIX_JOB_CONTROL_CMD 18
110 #define PMIX_MONITOR_CMD 19
111 #define PMIX_GET_CREDENTIAL_CMD 20
112 #define PMIX_VALIDATE_CRED_CMD 21
113 #define PMIX_IOF_PULL_CMD 22
114 #define PMIX_IOF_PUSH_CMD 23
115 #define PMIX_GROUP_CONSTRUCT_CMD 24
116 #define PMIX_GROUP_JOIN_CMD 25
117 #define PMIX_GROUP_INVITE_CMD 26
118 #define PMIX_GROUP_LEAVE_CMD 27
119 #define PMIX_GROUP_DESTRUCT_CMD 28
120
121
122 const char* pmix_command_string(pmix_cmd_t cmd);
123
124
125 PMIX_EXPORT extern pmix_status_t pmix_tool_init_info(void);
126
127
128
129 typedef enum {
130 PMIX_COLLECT_INVALID = -1,
131 PMIX_COLLECT_NO,
132 PMIX_COLLECT_YES,
133 PMIX_COLLECT_MAX
134 } pmix_collect_t;
135
136
137
138
139
140
141
142
143 typedef struct pmix_personality_t {
144 pmix_bfrop_buffer_type_t type;
145 pmix_bfrops_module_t *bfrops;
146 pmix_psec_module_t *psec;
147 pmix_ptl_module_t *ptl;
148 pmix_gds_base_module_t *gds;
149 } pmix_personality_t;
150
151
152 typedef struct pmix_epilog_t {
153 uid_t uid;
154 gid_t gid;
155 pmix_list_t cleanup_dirs;
156 pmix_list_t cleanup_files;
157 pmix_list_t ignores;
158 } pmix_epilog_t;
159
160 typedef struct {
161 pmix_list_item_t super;
162 char *path;
163 } pmix_cleanup_file_t;
164 PMIX_CLASS_DECLARATION(pmix_cleanup_file_t);
165
166 typedef struct {
167 pmix_list_item_t super;
168 char *path;
169 bool recurse;
170 bool leave_topdir;
171 } pmix_cleanup_dir_t;
172 PMIX_CLASS_DECLARATION(pmix_cleanup_dir_t);
173
174
175 typedef struct {
176 pmix_list_item_t super;
177 char *nspace;
178 pmix_rank_t nprocs;
179 size_t nlocalprocs;
180 bool all_registered;
181 bool version_stored;
182 pmix_buffer_t *jobbkt;
183 size_t ndelivered;
184 size_t nfinalized;
185 pmix_list_t ranks;
186
187
188
189
190 pmix_personality_t compat;
191 pmix_epilog_t epilog;
192
193 pmix_list_t setup_data;
194
195 } pmix_namespace_t;
196 PMIX_CLASS_DECLARATION(pmix_namespace_t);
197
198
199
200 typedef struct {
201 pmix_list_item_t super;
202 pmix_namespace_t *ns;
203 } pmix_nspace_caddy_t;
204 PMIX_CLASS_DECLARATION(pmix_nspace_caddy_t);
205
206 typedef struct pmix_rank_info_t {
207 pmix_list_item_t super;
208 int peerid;
209 pmix_name_t pname;
210 uid_t uid;
211 gid_t gid;
212 bool modex_recvd;
213 int proc_cnt;
214 void *server_object;
215 } pmix_rank_info_t;
216 PMIX_CLASS_DECLARATION(pmix_rank_info_t);
217
218
219
220
221 typedef struct {
222 pmix_list_item_t super;
223 pmix_info_t *info;
224 size_t ninfo;
225 } pmix_info_caddy_t;
226 PMIX_CLASS_DECLARATION(pmix_info_caddy_t);
227
228 typedef struct {
229 pmix_list_item_t super;
230 pmix_info_t info;
231 } pmix_infolist_t;
232 PMIX_CLASS_DECLARATION(pmix_infolist_t);
233
234
235
236
237
238
239 typedef struct pmix_peer_t {
240 pmix_object_t super;
241 pmix_namespace_t *nptr;
242 pmix_rank_info_t *info;
243 pmix_proc_type_t proc_type;
244 pmix_listener_protocol_t protocol;
245 int proc_cnt;
246 int index;
247 int sd;
248 bool finalized;
249 pmix_event_t send_event;
250 bool send_ev_active;
251 pmix_event_t recv_event;
252 bool recv_ev_active;
253 pmix_list_t send_queue;
254 pmix_ptl_send_t *send_msg;
255 pmix_ptl_recv_t *recv_msg;
256 int commit_cnt;
257 pmix_epilog_t epilog;
258
259 } pmix_peer_t;
260 PMIX_CLASS_DECLARATION(pmix_peer_t);
261
262
263
264 typedef struct {
265 pmix_list_item_t super;
266 pmix_peer_t *peer;
267 pmix_name_t pname;
268 pmix_iof_channel_t channels;
269 pmix_iof_cbfunc_t cbfunc;
270 } pmix_iof_req_t;
271 PMIX_CLASS_DECLARATION(pmix_iof_req_t);
272
273
274
275 typedef struct {
276 pmix_object_t super;
277 pmix_event_t ev;
278 pmix_lock_t lock;
279 pmix_status_t status;
280 pmix_query_t *queries;
281 size_t nqueries;
282 pmix_proc_t *targets;
283 size_t ntargets;
284 pmix_info_t *info;
285 size_t ninfo;
286 pmix_list_t results;
287 pmix_byte_object_t bo;
288 pmix_info_cbfunc_t cbfunc;
289 pmix_value_cbfunc_t valcbfunc;
290 pmix_release_cbfunc_t relcbfunc;
291 pmix_credential_cbfunc_t credcbfunc;
292 pmix_validation_cbfunc_t validcbfunc;
293 void *cbdata;
294 } pmix_query_caddy_t;
295 PMIX_CLASS_DECLARATION(pmix_query_caddy_t);
296
297
298
299 typedef struct {
300 pmix_list_item_t super;
301 pmix_event_t ev;
302 bool event_active;
303 bool host_called;
304 bool local;
305 char *id;
306 pmix_cmd_t type;
307 pmix_proc_t pname;
308 bool hybrid;
309 pmix_proc_t *pcs;
310 size_t npcs;
311 pmix_list_t nslist;
312 pmix_lock_t lock;
313 bool def_complete;
314 pmix_list_t local_cbs;
315
316
317 uint32_t nlocal;
318 uint32_t local_cnt;
319 pmix_info_t *info;
320 size_t ninfo;
321 pmix_collect_t collect_type;
322 pmix_modex_cbfunc_t modexcbfunc;
323 pmix_op_cbfunc_t op_cbfunc;
324 void *cbdata;
325 } pmix_server_trkr_t;
326 PMIX_CLASS_DECLARATION(pmix_server_trkr_t);
327
328
329
330
331
332 typedef struct {
333 pmix_list_item_t super;
334 pmix_event_t ev;
335 bool event_active;
336 pmix_server_trkr_t *trk;
337 pmix_ptl_hdr_t hdr;
338 pmix_peer_t *peer;
339 } pmix_server_caddy_t;
340 PMIX_CLASS_DECLARATION(pmix_server_caddy_t);
341
342
343
344 typedef struct {
345 pmix_object_t super;
346 pmix_event_t ev;
347 pmix_lock_t lock;
348 pmix_status_t status;
349 pmix_status_t *codes;
350 size_t ncodes;
351 pmix_name_t pname;
352 const char *data;
353 size_t ndata;
354 const char *key;
355 pmix_info_t *info;
356 size_t ninfo;
357 pmix_info_t *directives;
358 size_t ndirs;
359 pmix_notification_fn_t evhdlr;
360 pmix_iof_req_t *iofreq;
361 pmix_kval_t *kv;
362 pmix_value_t *vptr;
363 pmix_server_caddy_t *cd;
364 pmix_server_trkr_t *tracker;
365 bool enviro;
366 union {
367 pmix_release_cbfunc_t relfn;
368 pmix_hdlr_reg_cbfunc_t hdlrregcbfn;
369 pmix_op_cbfunc_t opcbfn;
370 pmix_modex_cbfunc_t modexcbfunc;
371 } cbfunc;
372 void *cbdata;
373 size_t ref;
374 } pmix_shift_caddy_t;
375 PMIX_CLASS_DECLARATION(pmix_shift_caddy_t);
376
377
378 typedef struct {
379 pmix_list_item_t super;
380 pmix_event_t ev;
381 pmix_lock_t lock;
382 bool checked;
383 int status;
384 pmix_status_t pstatus;
385 pmix_scope_t scope;
386 pmix_buffer_t data;
387 union {
388 pmix_ptl_cbfunc_t ptlfn;
389 pmix_op_cbfunc_t opfn;
390 pmix_value_cbfunc_t valuefn;
391 pmix_lookup_cbfunc_t lookupfn;
392 pmix_spawn_cbfunc_t spawnfn;
393 pmix_hdlr_reg_cbfunc_t hdlrregfn;
394 } cbfunc;
395 size_t errhandler_ref;
396 void *cbdata;
397 pmix_name_t pname;
398 char *key;
399 pmix_value_t *value;
400 pmix_proc_t *proc;
401 pmix_proc_t *procs;
402 size_t nprocs;
403 pmix_info_t *info;
404 size_t ninfo;
405 size_t nvals;
406 pmix_list_t kvs;
407 bool copy;
408 bool timer_running;
409 } pmix_cb_t;
410 PMIX_CLASS_DECLARATION(pmix_cb_t);
411
412 #define PMIX_THREADSHIFT(r, c) \
413 do { \
414 pmix_event_assign(&((r)->ev), pmix_globals.evbase, \
415 -1, EV_WRITE, (c), (r)); \
416 PMIX_POST_OBJECT((r)); \
417 pmix_event_active(&((r)->ev), EV_WRITE, 1); \
418 } while (0)
419
420
421 typedef struct {
422 pmix_object_t super;
423 pmix_event_t ev;
424 pmix_lock_t lock;
425
426
427 time_t ts;
428
429 int room;
430 pmix_status_t status;
431 pmix_proc_t source;
432 pmix_data_range_t range;
433
434
435
436
437 pmix_proc_t *targets;
438 size_t ntargets;
439 size_t nleft;
440
441
442
443
444
445
446
447
448
449 pmix_proc_t *affected;
450 size_t naffected;
451
452
453 bool nondefault;
454
455
456 pmix_info_t *info;
457 size_t ninfo;
458 pmix_buffer_t *buf;
459 pmix_op_cbfunc_t cbfunc;
460 void *cbdata;
461 } pmix_notify_caddy_t;
462 PMIX_CLASS_DECLARATION(pmix_notify_caddy_t);
463
464
465
466
467
468
469 typedef struct {
470 int init_cntr;
471 pmix_proc_t myid;
472 pmix_peer_t *mypeer;
473 uid_t uid;
474 gid_t gid;
475 char *hostname;
476 uint32_t nodeid;
477 int pindex;
478 pmix_event_base_t *evbase;
479 bool external_evbase;
480 int debug_output;
481 pmix_events_t events;
482 bool connected;
483 bool commits_pending;
484 struct timeval event_window;
485 pmix_list_t cached_events;
486 pmix_list_t iof_requests;
487 int max_events;
488 int event_eviction_time;
489 pmix_hotel_t notifications;
490
491
492
493
494
495
496 pmix_gds_base_module_t *mygds;
497
498 bool pushstdin;
499 pmix_list_t stdin_targets;
500 bool tag_output;
501 bool xml_output;
502 bool timestamp_output;
503 size_t output_limit;
504 } pmix_globals_t;
505
506
507 PMIX_EXPORT void pmix_execute_epilog(pmix_epilog_t *ep);
508
509 PMIX_EXPORT extern pmix_globals_t pmix_globals;
510 PMIX_EXPORT extern pmix_lock_t pmix_global_lock;
511
512 END_C_DECLS
513
514 #endif