File indexing completed on 2025-02-22 10:47:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef PMIX_GDS_H
0017 #define PMIX_GDS_H
0018
0019 #include "src/include/pmix_config.h"
0020
0021 #include "pmix_common.h"
0022 #include "src/mca/base/pmix_mca_base_framework.h"
0023 #include "src/mca/base/pmix_mca_base_var.h"
0024 #include "src/mca/bfrops/bfrops_types.h"
0025 #include "src/mca/mca.h"
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 BEGIN_C_DECLS
0046
0047 struct pmix_peer_t;
0048 struct pmix_namespace_t;
0049
0050
0051 PMIX_EXPORT extern int pmix_gds_base_output;
0052
0053
0054
0055
0056
0057 typedef pmix_status_t (*pmix_gds_base_module_init_fn_t)(pmix_info_t info[], size_t ninfo);
0058
0059
0060
0061
0062
0063 typedef void (*pmix_gds_base_module_fini_fn_t)(void);
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 typedef pmix_status_t (*pmix_gds_base_assign_module_fn_t)(pmix_info_t *info, size_t ninfo,
0075 int *priority);
0076
0077 #define PMIX_GDS_CHECK_COMPONENT(p, s) (0 == strcmp((p)->nptr->compat.gds->name, (s)))
0078 #define PMIX_GDS_CHECK_PEER_COMPONENT(p1, p2) \
0079 (0 == strcmp((p1)->nptr->compat.gds->name, (p2)->nptr->compat.gds->name))
0080
0081
0082 typedef pmix_status_t (*pmix_gds_base_module_assemb_kvs_req_fn_t)(const pmix_proc_t *proc,
0083 pmix_list_t *kvs,
0084 pmix_buffer_t *buf, void *cbdata);
0085
0086
0087 #define PMIX_GDS_ASSEMB_KVS_REQ(s, p, r, k, b, c) \
0088 do { \
0089 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0090 (s) = PMIX_SUCCESS; \
0091 if (NULL == _g->assemb_kvs_req) { \
0092 if (0 == strcmp(_g->name, "hash")) { \
0093 (s) = PMIX_ERR_NOT_SUPPORTED; \
0094 } else { \
0095 _g = pmix_globals.mypeer->nptr->compat.gds; \
0096 } \
0097 } \
0098 if (NULL != _g->assemb_kvs_req) { \
0099 pmix_output_verbose(1, pmix_gds_base_output, \
0100 "[%s:%d] GDS ASSEMBLE REQ WITH %s", \
0101 __FILE__, __LINE__, _g->name); \
0102 (s) = _g->assemb_kvs_req(r, k, b, (void *) c); \
0103 } \
0104 } while (0)
0105
0106
0107 typedef pmix_status_t (*pmix_gds_base_module_accept_kvs_resp_fn_t)(pmix_buffer_t *buf);
0108
0109
0110 #define PMIX_GDS_ACCEPT_KVS_RESP(s, p, b) \
0111 do { \
0112 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0113 (s) = PMIX_SUCCESS; \
0114 if (NULL == _g->accept_kvs_resp) { \
0115 if (0 == strcmp(_g->name, "hash")) { \
0116 (s) = PMIX_ERR_NOT_SUPPORTED; \
0117 } else { \
0118 _g = pmix_globals.mypeer->nptr->compat.gds; \
0119 } \
0120 } \
0121 if (NULL != _g->accept_kvs_resp) { \
0122 pmix_output_verbose(1, pmix_gds_base_output, \
0123 "[%s:%d] GDS ACCEPT RESP WITH %s", \
0124 __FILE__, __LINE__, _g->name); \
0125 (s) = _g->accept_kvs_resp(b); \
0126 } \
0127 } while (0)
0128
0129
0130
0131
0132
0133
0134
0135 typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_namespace_t *ns,
0136 pmix_info_t info[], size_t ninfo);
0137
0138
0139 #define PMIX_GDS_CACHE_JOB_INFO(s, p, n, i, ni) \
0140 do { \
0141 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0142 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS CACHE JOB INFO WITH %s", \
0143 __FILE__, __LINE__, _g->name); \
0144 (s) = _g->cache_job_info((struct pmix_namespace_t *) (n), (i), (ni)); \
0145 } while (0)
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 typedef pmix_status_t (*pmix_gds_base_module_register_job_info_fn_t)(struct pmix_peer_t *pr,
0175 pmix_buffer_t *reply);
0176
0177
0178
0179 #define PMIX_GDS_REGISTER_JOB_INFO(s, p, b) \
0180 do { \
0181 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0182 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS REG JOB INFO WITH %s", __FILE__, \
0183 __LINE__, _g->name); \
0184 (s) = _g->register_job_info((struct pmix_peer_t *) (p), b); \
0185 } while (0)
0186
0187
0188
0189
0190
0191
0192 typedef pmix_status_t (*pmix_gds_base_module_store_job_info_fn_t)(const char *nspace,
0193 pmix_buffer_t *buf);
0194
0195
0196 #define PMIX_GDS_STORE_JOB_INFO(s, p, n, b) \
0197 do { \
0198 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0199 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS STORE JOB INFO WITH %s", \
0200 __FILE__, __LINE__, _g->name); \
0201 (s) = _g->store_job_info(n, b); \
0202 } while (0)
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222 typedef pmix_status_t (*pmix_gds_base_module_store_fn_t)(const pmix_proc_t *proc,
0223 pmix_scope_t scope, pmix_kval_t *kv);
0224
0225
0226 #define PMIX_GDS_STORE_KV(s, p, pc, sc, k) \
0227 do { \
0228 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0229 (s) = PMIX_SUCCESS; \
0230 if (NULL == _g->store) { \
0231 if (0 == strcmp(_g->name, "hash")) { \
0232 (s) = PMIX_ERR_NOT_SUPPORTED; \
0233 } else { \
0234 _g = pmix_globals.mypeer->nptr->compat.gds; \
0235 } \
0236 } \
0237 if (NULL != _g->store) { \
0238 pmix_output_verbose(1, pmix_gds_base_output, \
0239 "[%s:%d] GDS STORE KV WITH %s", \
0240 __FILE__, __LINE__, _g->name); \
0241 (s) = _g->store(pc, sc, k); \
0242 } \
0243 } while (0)
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259 typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_namespace_t *ns,
0260 pmix_buffer_t *buff, void *cbdata);
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273 #define PMIX_GDS_STORE_MODEX(r, n, b, t) \
0274 do { \
0275 pmix_gds_base_module_t *_g = pmix_globals.mypeer->nptr->compat.gds; \
0276 pmix_output_verbose(1, pmix_gds_base_output, \
0277 "[%s:%d] GDS STORE MODEX WITH %s", __FILE__, \
0278 __LINE__, _g->name); \
0279 (r) = _g->store_modex((struct pmix_namespace_t *)n, b, t); \
0280 } while (0)
0281
0282 typedef pmix_status_t (*pmix_gds_base_module_mark_modex_complete_fn_t)(struct pmix_peer_t *peer,
0283 pmix_list_t *nslist,
0284 pmix_buffer_t *buff);
0285 #define PMIX_GDS_MARK_MODEX_COMPLETE(r, p, l, b) \
0286 do { \
0287 pmix_gds_base_module_t *_g = pmix_globals.mypeer->nptr->compat.gds; \
0288 pmix_output_verbose(1, pmix_gds_base_output, \
0289 "[%s:%d] GDS MARK MODEX COMPLETE WITH %s", \
0290 __FILE__, __LINE__, _g->name); \
0291 (r) = _g->mark_modex_complete(p, l, b); \
0292 } while (0)
0293
0294 typedef pmix_status_t (*pmix_gds_base_module_recv_modex_complete_fn_t)(pmix_buffer_t *buff);
0295 #define PMIX_GDS_RECV_MODEX_COMPLETE(r, p, b) \
0296 do { \
0297 pmix_gds_base_module_t *_g = pmix_globals.mypeer->nptr->compat.gds; \
0298 pmix_output_verbose(1, pmix_gds_base_output, \
0299 "[%s:%d] GDS RECV MODEX COMPLETE WITH %s", \
0300 __FILE__, __LINE__, _g->name); \
0301 (r) = _g->recv_modex_complete(b); \
0302 } while (0)
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346 typedef pmix_status_t (*pmix_gds_base_module_fetch_fn_t)(const pmix_proc_t *proc,
0347 pmix_scope_t scope, bool copy,
0348 const char *key, pmix_info_t info[],
0349 size_t ninfo, pmix_list_t *kvs);
0350
0351
0352
0353 #define PMIX_GDS_FETCH_KV(s, p, c) \
0354 do { \
0355 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0356 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS FETCH KV WITH %s", __FILE__, \
0357 __LINE__, _g->name); \
0358 (s) = _g->fetch((c)->proc, (c)->scope, (c)->copy, (c)->key, (c)->info, (c)->ninfo, \
0359 &(c)->kvs); \
0360 } while (0)
0361
0362
0363
0364
0365
0366
0367
0368
0369 typedef pmix_status_t (*pmix_gds_base_module_setup_fork_fn_t)(const pmix_proc_t *proc, char ***env);
0370
0371
0372
0373
0374
0375
0376
0377
0378 typedef pmix_status_t (*pmix_gds_base_module_add_nspace_fn_t)(const char *nspace,
0379 uint32_t nlocalprocs,
0380 pmix_info_t info[], size_t ninfo);
0381
0382
0383 #define PMIX_GDS_ADD_NSPACE(s, n, ls, i, ni) \
0384 do { \
0385 pmix_gds_base_active_module_t *_g; \
0386 pmix_status_t _s = PMIX_SUCCESS; \
0387 (s) = PMIX_SUCCESS; \
0388 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS ADD NSPACE %s", __FILE__, \
0389 __LINE__, (n)); \
0390 PMIX_LIST_FOREACH (_g, &pmix_gds_globals.actives, pmix_gds_base_active_module_t) { \
0391 if (NULL != _g->module->add_nspace) { \
0392 _s = _g->module->add_nspace(n, ls, i, ni); \
0393 } \
0394 if (PMIX_SUCCESS != _s) { \
0395 (s) = PMIX_ERROR; \
0396 } \
0397 } \
0398 } while (0)
0399
0400
0401
0402
0403
0404
0405
0406
0407 typedef pmix_status_t (*pmix_gds_base_module_del_nspace_fn_t)(const char *nspace);
0408
0409
0410 #define PMIX_GDS_DEL_NSPACE(s, n) \
0411 do { \
0412 pmix_gds_base_active_module_t *_g; \
0413 pmix_status_t _s = PMIX_SUCCESS; \
0414 (s) = PMIX_SUCCESS; \
0415 pmix_output_verbose(1, pmix_gds_base_output, "[%s:%d] GDS DEL NSPACE %s", __FILE__, \
0416 __LINE__, (n)); \
0417 PMIX_LIST_FOREACH (_g, &pmix_gds_globals.actives, pmix_gds_base_active_module_t) { \
0418 if (NULL != _g->module->del_nspace) { \
0419 _s = _g->module->del_nspace(n); \
0420 } \
0421 if (PMIX_SUCCESS != _s) { \
0422 (s) = PMIX_ERROR; \
0423 } \
0424 } \
0425 } while (0)
0426
0427
0428 #define PMIX_GDS_FETCH_IS_TSAFE(s, p) \
0429 do { \
0430 pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \
0431 pmix_output_verbose(1, pmix_gds_base_output, \
0432 "[%s:%d] GDS FETCH IS THREAD SAFE WITH %s", \
0433 __FILE__, __LINE__, _g->name); \
0434 if (true == _g->is_tsafe) { \
0435 (s) = PMIX_SUCCESS; \
0436 } else { \
0437 (s) = PMIX_ERR_NOT_SUPPORTED; \
0438 } \
0439 } while(0)
0440
0441 typedef pmix_status_t (*pmix_gds_base_module_fetch_array_fn_t)(struct pmix_peer_t *pr,
0442 pmix_buffer_t *reply);
0443
0444
0445 #define PMIX_GDS_FETCH_INFO_ARRAYS(s, p, b) \
0446 do { \
0447 pmix_gds_base_module_t *_g = pmix_globals.mypeer->nptr->compat.gds; \
0448 pmix_output_verbose(1, pmix_gds_base_output, \
0449 "[%s:%d] GDS FETCH ARRAYS WITH %s", \
0450 __FILE__, __LINE__, _g->name); \
0451 (s) = _g->fetch_arrays((struct pmix_peer_t*)(p), b); \
0452 } while(0)
0453
0454
0455
0456 typedef struct {
0457 const char *name;
0458 const bool is_tsafe;
0459 pmix_gds_base_module_init_fn_t init;
0460 pmix_gds_base_module_fini_fn_t finalize;
0461 pmix_gds_base_assign_module_fn_t assign_module;
0462 pmix_gds_base_module_cache_job_info_fn_t cache_job_info;
0463 pmix_gds_base_module_register_job_info_fn_t register_job_info;
0464 pmix_gds_base_module_store_job_info_fn_t store_job_info;
0465 pmix_gds_base_module_store_fn_t store;
0466 pmix_gds_base_module_store_modex_fn_t store_modex;
0467 pmix_gds_base_module_fetch_fn_t fetch;
0468 pmix_gds_base_module_setup_fork_fn_t setup_fork;
0469 pmix_gds_base_module_add_nspace_fn_t add_nspace;
0470 pmix_gds_base_module_del_nspace_fn_t del_nspace;
0471 pmix_gds_base_module_assemb_kvs_req_fn_t assemb_kvs_req;
0472 pmix_gds_base_module_accept_kvs_resp_fn_t accept_kvs_resp;
0473 pmix_gds_base_module_fetch_array_fn_t fetch_arrays;
0474 pmix_gds_base_module_mark_modex_complete_fn_t mark_modex_complete;
0475 pmix_gds_base_module_recv_modex_complete_fn_t recv_modex_complete;
0476 } pmix_gds_base_module_t;
0477
0478
0479
0480
0481
0482 typedef pmix_mca_base_component_t pmix_gds_base_component_t;
0483
0484
0485
0486
0487 #define PMIX_GDS_BASE_VERSION_1_0_0 PMIX_MCA_BASE_VERSION_1_0_0("gds", 1, 0, 0)
0488
0489 END_C_DECLS
0490
0491 #endif