|
|
|||
Warning, file /include/pmix_server.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. 0003 * Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>. 0004 * All rights reserved. 0005 * Copyright (c) 2015 Research Organization for Information Science 0006 * and Technology (RIST). All rights reserved. 0007 * Copyright (c) 2021-2025 Nanook Consulting All rights reserved. 0008 * $COPYRIGHT$ 0009 * 0010 * Redistribution and use in source and binary forms, with or without 0011 * modification, are permitted provided that the following conditions are 0012 * met: 0013 * 0014 * - Redistributions of source code must retain the above copyright 0015 * notice, this list of conditions and the following disclaimer. 0016 * 0017 * - Redistributions in binary form must reproduce the above copyright 0018 * notice, this list of conditions and the following disclaimer listed 0019 * in this license in the documentation and/or other materials 0020 * provided with the distribution. 0021 * 0022 * - Neither the name of the copyright holders nor the names of its 0023 * contributors may be used to endorse or promote products derived from 0024 * this software without specific prior written permission. 0025 * 0026 * The copyright holders provide no reassurances that the source code 0027 * provided does not infringe any patent, copyright, or any other 0028 * intellectual property rights of third parties. The copyright holders 0029 * disclaim any liability to any recipient for claims brought against 0030 * recipient by any third party for infringement of that parties 0031 * intellectual property rights. 0032 * 0033 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0034 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0035 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0036 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0037 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0038 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0039 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0040 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0041 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0042 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0043 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0044 * 0045 * $HEADER$ 0046 * 0047 * PMIx provides a "function-shipping" approach to support for 0048 * implementing the server-side of the protocol. This method allows 0049 * resource managers to implement the server without being burdened 0050 * with PMIx internal details. Accordingly, each PMIx API is mirrored 0051 * here in a function call to be provided by the server. When a 0052 * request is received from the client, the corresponding server function 0053 * will be called with the information. 0054 * 0055 * Any functions not supported by the RM can be indicated by a NULL for 0056 * the function pointer. Client calls to such functions will have a 0057 * "not supported" error returned. 0058 */ 0059 0060 #ifndef PMIx_SERVER_API_H 0061 #define PMIx_SERVER_API_H 0062 0063 /* Structure and constant definitions */ 0064 #include <pmix_common.h> 0065 0066 #if defined(c_plusplus) || defined(__cplusplus) 0067 extern "C" { 0068 #endif 0069 0070 /**** SERVER FUNCTION-SHIPPED APIs ****/ 0071 /* NOTE: for performance purposes, the host server is required to 0072 * return as quickly as possible from all functions. Execution of 0073 * the function is thus to be done asynchronously so as to allow 0074 * the PMIx server support library to handle multiple client requests 0075 * as quickly and scalably as possible. 0076 * 0077 * ALL data passed to the host server functions is "owned" by the 0078 * PMIX server support library and MUST NOT be free'd. Data returned 0079 * by the host server via callback function is owned by the host 0080 * server, which is free to release it upon return from the callback */ 0081 0082 /* Notify the host server that a client connected to us - note 0083 * that the client will be in a blocked state until the host server 0084 * executes the callback function, thus allowing the PMIx server support 0085 * library to release the client */ 0086 typedef pmix_status_t (*pmix_server_client_connected_fn_t)(const pmix_proc_t *proc, void* server_object, 0087 pmix_op_cbfunc_t cbfunc, void *cbdata); 0088 0089 /* REPLACES ABOVE FUNCTION TO ALLOW PASSING ADDITIONAL INFO */ 0090 typedef pmix_status_t (*pmix_server_client_connected2_fn_t)(const pmix_proc_t *proc, void* server_object, 0091 pmix_info_t info[], size_t ninfo, 0092 pmix_op_cbfunc_t cbfunc, void *cbdata); 0093 0094 0095 /* Notify the host server that a client called PMIx_Finalize - note 0096 * that the client will be in a blocked state until the host server 0097 * executes the callback function, thus allowing the PMIx server support 0098 * library to release the client */ 0099 typedef pmix_status_t (*pmix_server_client_finalized_fn_t)(const pmix_proc_t *proc, void* server_object, 0100 pmix_op_cbfunc_t cbfunc, void *cbdata); 0101 0102 /* A local client called PMIx_Abort - note that the client will be in a blocked 0103 * state until the host server executes the callback function, thus 0104 * allowing the PMIx server support library to release the client. The 0105 * array of procs indicates which processes are to be terminated. A NULL 0106 * indicates that all procs in the client's nspace are to be terminated */ 0107 typedef pmix_status_t (*pmix_server_abort_fn_t)(const pmix_proc_t *proc, void *server_object, 0108 int status, const char msg[], 0109 pmix_proc_t procs[], size_t nprocs, 0110 pmix_op_cbfunc_t cbfunc, void *cbdata); 0111 0112 /* At least one client called either PMIx_Fence or PMIx_Fence_nb. In either case, 0113 * the host server will be called via a non-blocking function to execute 0114 * the specified operation once all participating local procs have 0115 * contributed. All processes in the specified array are required to participate 0116 * in the Fence[_nb] operation. The callback is to be executed once each daemon 0117 * hosting at least one participant has called the host server's fencenb function. 0118 * 0119 * The provided data is to be collectively shared with all PMIx 0120 * servers involved in the fence operation, and returned in the modex 0121 * cbfunc. A _NULL_ data value indicates that the local procs had 0122 * no data to contribute. 0123 * 0124 * The array of info structs is used to pass user-requested options to the server. 0125 * This can include directives as to the algorithm to be used to execute the 0126 * fence operation. The directives are optional _unless_ the _mandatory_ flag 0127 * has been set - in such cases, the host RM is required to return an error 0128 * if the directive cannot be met. */ 0129 typedef pmix_status_t (*pmix_server_fencenb_fn_t)(const pmix_proc_t procs[], size_t nprocs, 0130 const pmix_info_t info[], size_t ninfo, 0131 char *data, size_t ndata, 0132 pmix_modex_cbfunc_t cbfunc, void *cbdata); 0133 0134 0135 /* Used by the PMIx server to request its local host contact the 0136 * PMIx server on the remote node that hosts the specified proc to 0137 * obtain and return a direct modex blob for that proc. 0138 * 0139 * The array of info structs is used to pass user-requested options to the server. 0140 * This can include a timeout to preclude an indefinite wait for data that 0141 * may never become available. The directives are optional _unless_ the _mandatory_ flag 0142 * has been set - in such cases, the host RM is required to return an error 0143 * if the directive cannot be met. */ 0144 typedef pmix_status_t (*pmix_server_dmodex_req_fn_t)(const pmix_proc_t *proc, 0145 const pmix_info_t info[], size_t ninfo, 0146 pmix_modex_cbfunc_t cbfunc, void *cbdata); 0147 0148 0149 /* Publish data per the PMIx API specification. The callback is to be executed 0150 * upon completion of the operation. The default data range is expected to be 0151 * PMIX_SESSION, and the default persistence PMIX_PERSIST_SESSION. These values 0152 * can be modified by including the respective pmix_info_t struct in the 0153 * provided array. 0154 * 0155 * Note that the host server is not required to guarantee support for any specific 0156 * range - i.e., the server does not need to return an error if the data store 0157 * doesn't support range-based isolation. However, the server must return an error 0158 * (a) if the key is duplicative within the storage range, and (b) if the server 0159 * does not allow overwriting of published info by the original publisher - it is 0160 * left to the discretion of the host server to allow info-key-based flags to modify 0161 * this behavior. 0162 * 0163 * The persistence indicates how long the server should retain the data. 0164 * 0165 * The identifier of the publishing process is also provided and is expected to 0166 * be returned on any subsequent lookup request */ 0167 typedef pmix_status_t (*pmix_server_publish_fn_t)(const pmix_proc_t *proc, 0168 const pmix_info_t info[], size_t ninfo, 0169 pmix_op_cbfunc_t cbfunc, void *cbdata); 0170 0171 /* Lookup published data. The host server will be passed a NULL-terminated array 0172 * of string keys. 0173 * 0174 * The array of info structs is used to pass user-requested options to the server. 0175 * This can include a wait flag to indicate that the server should wait for all 0176 * data to become available before executing the callback function, or should 0177 * immediately callback with whatever data is available. In addition, a timeout 0178 * can be specified on the wait to preclude an indefinite wait for data that 0179 * may never be published. */ 0180 typedef pmix_status_t (*pmix_server_lookup_fn_t)(const pmix_proc_t *proc, char **keys, 0181 const pmix_info_t info[], size_t ninfo, 0182 pmix_lookup_cbfunc_t cbfunc, void *cbdata); 0183 0184 /* Delete data from the data store. The host server will be passed a NULL-terminated array 0185 * of string keys, plus potential directives such as the data range within which the 0186 * keys should be deleted. The callback is to be executed upon completion of the delete 0187 * procedure */ 0188 typedef pmix_status_t (*pmix_server_unpublish_fn_t)(const pmix_proc_t *proc, char **keys, 0189 const pmix_info_t info[], size_t ninfo, 0190 pmix_op_cbfunc_t cbfunc, void *cbdata); 0191 0192 /* Spawn a set of applications/processes as per the PMIx API. Note that 0193 * applications are not required to be MPI or any other programming model. 0194 * Thus, the host server cannot make any assumptions as to their required 0195 * support. The callback function is to be executed once all processes have 0196 * been started. An error in starting any application or process in this 0197 * request shall cause all applications and processes in the request to 0198 * be terminated, and an error returned to the originating caller. 0199 * 0200 * Note that a timeout can be specified in the job_info array to indicate 0201 * that failure to start the requested job within the given time should 0202 * result in termination to avoid hangs */ 0203 typedef pmix_status_t (*pmix_server_spawn_fn_t)(const pmix_proc_t *proc, 0204 const pmix_info_t job_info[], size_t ninfo, 0205 const pmix_app_t apps[], size_t napps, 0206 pmix_spawn_cbfunc_t cbfunc, void *cbdata); 0207 0208 /* Record the specified processes as "connected". This means that the resource 0209 * manager should treat the failure of any process in the specified group as 0210 * a reportable event, and take appropriate action. The callback function is 0211 * to be called once all participating processes have called connect. Note that 0212 * a process can only engage in *one* connect operation involving the identical 0213 * set of procs at a time. However, a process *can* be simultaneously engaged 0214 * in multiple connect operations, each involving a different set of procs 0215 * 0216 * Note also that this is a collective operation within the client library, and 0217 * thus the client will be blocked until all procs participate. Thus, the info 0218 * array can be used to pass user directives, including a timeout. 0219 * The directives are optional _unless_ the _mandatory_ flag 0220 * has been set - in such cases, the host RM is required to return an error 0221 * if the directive cannot be met. */ 0222 typedef pmix_status_t (*pmix_server_connect_fn_t)(const pmix_proc_t procs[], size_t nprocs, 0223 const pmix_info_t info[], size_t ninfo, 0224 pmix_op_cbfunc_t cbfunc, void *cbdata); 0225 0226 /* Disconnect a previously connected set of processes. An error should be returned 0227 * if the specified set of procs was not previously "connected". As above, a process 0228 * may be involved in multiple simultaneous disconnect operations. However, a process 0229 * is not allowed to reconnect to a set of ranges that has not fully completed 0230 * disconnect - i.e., you have to fully disconnect before you can reconnect to the 0231 * same group of processes. 0232 * 0233 * Note also that this is a collective operation within the client library, and 0234 * thus the client will be blocked until all procs participate. Thus, the info 0235 * array can be used to pass user directives, including a timeout. 0236 * The directives are optional _unless_ the _mandatory_ flag 0237 * has been set - in such cases, the host RM is required to return an error 0238 * if the directive cannot be met. */ 0239 typedef pmix_status_t (*pmix_server_disconnect_fn_t)(const pmix_proc_t procs[], size_t nprocs, 0240 const pmix_info_t info[], size_t ninfo, 0241 pmix_op_cbfunc_t cbfunc, void *cbdata); 0242 0243 /* Register to receive notifications for the specified events. The resource 0244 * manager is _required_ to pass along to the local PMIx server all events 0245 * that directly relate to a registered namespace. However, the RM may have 0246 * access to events beyond those - e.g., environmental events. The PMIx server 0247 * will register to receive environmental events that match specific PMIx 0248 * event codes. If the host RM supports such notifications, it will need to 0249 * translate its own internal event codes to fit into a corresponding PMIx event 0250 * code - any specific info beyond that can be passed in via the pmix_info_t 0251 * upon notification. 0252 * 0253 * The info array included in this API is reserved for possible future directives 0254 * to further steer notification. 0255 */ 0256 typedef pmix_status_t (*pmix_server_register_events_fn_t)(pmix_status_t *codes, size_t ncodes, 0257 const pmix_info_t info[], size_t ninfo, 0258 pmix_op_cbfunc_t cbfunc, void *cbdata); 0259 0260 /* Deregister to receive notifications for the specified environmental events 0261 * for which the PMIx server has previously registered. The host RM remains 0262 * required to notify of any job-related events */ 0263 typedef pmix_status_t (*pmix_server_deregister_events_fn_t)(pmix_status_t *codes, size_t ncodes, 0264 pmix_op_cbfunc_t cbfunc, void *cbdata); 0265 0266 /* Notify the specified processes of an event generated either by 0267 * the PMIx server itself, or by one of its local clients. The process 0268 * generating the event is provided in the source parameter. */ 0269 typedef pmix_status_t (*pmix_server_notify_event_fn_t)(pmix_status_t code, 0270 const pmix_proc_t *source, 0271 pmix_data_range_t range, 0272 pmix_info_t info[], size_t ninfo, 0273 pmix_op_cbfunc_t cbfunc, void *cbdata); 0274 0275 /* Callback function for incoming connection requests from 0276 * local clients */ 0277 typedef void (*pmix_connection_cbfunc_t)(int incoming_sd, void *cbdata); 0278 0279 /* Register a socket the host server can monitor for connection 0280 * requests, harvest them, and then call our internal callback 0281 * function for further processing. A listener thread is essential 0282 * to efficiently harvesting connection requests from large 0283 * numbers of local clients such as occur when running on large 0284 * SMPs. The host server listener is required to call accept 0285 * on the incoming connection request, and then passing the 0286 * resulting soct to the provided cbfunc. A NULL for this function 0287 * will cause the internal PMIx server to spawn its own listener 0288 * thread */ 0289 typedef pmix_status_t (*pmix_server_listener_fn_t)(int listening_sd, 0290 pmix_connection_cbfunc_t cbfunc, 0291 void *cbdata); 0292 0293 /* Query information from the resource manager. The query will include 0294 * the nspace/rank of the proc that is requesting the info, an 0295 * array of pmix_query_t describing the request, and a callback 0296 * function/data for the return. */ 0297 typedef pmix_status_t (*pmix_server_query_fn_t)(pmix_proc_t *proct, 0298 pmix_query_t *queries, size_t nqueries, 0299 pmix_info_cbfunc_t cbfunc, 0300 void *cbdata); 0301 0302 /* Callback function for incoming tool connections - the host 0303 * RM shall provide an nspace/rank for the connecting tool. We 0304 * assume that a rank=0 will be the normal assignment, but allow 0305 * for the future possibility of a parallel set of tools 0306 * connecting, and thus each proc requiring a rank*/ 0307 typedef void (*pmix_tool_connection_cbfunc_t)(pmix_status_t status, 0308 pmix_proc_t *proc, void *cbdata); 0309 0310 /* Register that a tool has connected to the server, and request 0311 * that the tool be assigned an nspace/rank for further interactions. 0312 * The optional pmix_info_t array can be used to pass qualifiers for 0313 * the connection request: 0314 * 0315 * (a) PMIX_USERID - effective userid of the tool 0316 * (b) PMIX_GRPID - effective groupid of the tool 0317 * (c) PMIX_FWD_STDOUT - forward any stdout to this tool 0318 * (d) PMIX_FWD_STDERR - forward any stderr to this tool 0319 * (e) PMIX_FWD_STDIN - forward stdin from this tool to any 0320 * processes spawned on its behalf 0321 */ 0322 typedef void (*pmix_server_tool_connection_fn_t)(pmix_info_t *info, size_t ninfo, 0323 pmix_tool_connection_cbfunc_t cbfunc, 0324 void *cbdata); 0325 0326 typedef pmix_status_t (*pmix_server_tool_connection2_fn_t)(pmix_info_t *info, size_t ninfo, 0327 pmix_tool_connection_cbfunc_t cbfunc, 0328 void *cbdata); 0329 0330 /* Log data on behalf of a client. Calls to the host thru this 0331 * function must _NOT_ call the PMIx_Log API as this will 0332 * trigger an infinite loop. Instead, the implementation must 0333 * perform one of three operations: 0334 * 0335 * (a) transfer the data+directives to a "gateway" server 0336 * where they can be logged. Gateways are designated 0337 * servers on nodes (typically service nodes) where 0338 * centralized logging is supported. The data+directives 0339 * may be passed to the PMIx_Log API once arriving at 0340 * that destination. 0341 * 0342 * (b) transfer the data to a logging channel outside of 0343 * PMIx, but directly supported by the host 0344 * 0345 * (c) return an error to the caller indicating that the 0346 * requested action is not supported 0347 */ 0348 typedef void (*pmix_server_log_fn_t)(const pmix_proc_t *client, 0349 const pmix_info_t data[], size_t ndata, 0350 const pmix_info_t directives[], size_t ndirs, 0351 pmix_op_cbfunc_t cbfunc, void *cbdata); 0352 0353 typedef pmix_status_t (*pmix_server_log2_fn_t)(const pmix_proc_t *client, 0354 const pmix_info_t data[], size_t ndata, 0355 const pmix_info_t directives[], size_t ndirs, 0356 pmix_op_cbfunc_t cbfunc, void *cbdata); 0357 0358 /* Request allocation modifications on behalf of a client */ 0359 typedef pmix_status_t (*pmix_server_alloc_fn_t)(const pmix_proc_t *client, 0360 pmix_alloc_directive_t directive, 0361 const pmix_info_t data[], size_t ndata, 0362 pmix_info_cbfunc_t cbfunc, void *cbdata); 0363 0364 /* Execute a job control action on behalf of a client */ 0365 typedef pmix_status_t (*pmix_server_job_control_fn_t)(const pmix_proc_t *requestor, 0366 const pmix_proc_t targets[], size_t ntargets, 0367 const pmix_info_t directives[], size_t ndirs, 0368 pmix_info_cbfunc_t cbfunc, void *cbdata); 0369 0370 /* Request that a client be monitored for activity */ 0371 typedef pmix_status_t (*pmix_server_monitor_fn_t)(const pmix_proc_t *requestor, 0372 const pmix_info_t *monitor, pmix_status_t error, 0373 const pmix_info_t directives[], size_t ndirs, 0374 pmix_info_cbfunc_t cbfunc, void *cbdata); 0375 0376 /* Request a credential from the host SMS 0377 * Input values include: 0378 * 0379 * proc - pointer to a pmix_proc_t identifier of the process on whose behalf 0380 * the request is being made (i.e., the client originating the request) 0381 * 0382 * directives - an array of pmix_info_t structures containing directives pertaining 0383 * to the request. This will typically include any pmix_info_t structs 0384 * passed by the requesting client, but may also include directives 0385 * required by (or available from) the PMIx server implementation - e.g., 0386 * the effective user and group ID's of the requesting process. 0387 * 0388 * ndirs - number of pmix_info_t structures in the directives array 0389 * 0390 * cbfunc - the pmix_credential_cbfunc_t function to be called upon completion 0391 * of the request 0392 * 0393 * cbdata - pointer to an object to be returned when cbfunc is called 0394 * 0395 * Returned values: 0396 * PMIX_SUCCESS - indicates that the request is being processed by the host system 0397 * management stack. The response will be coming in the provided 0398 * callback function. 0399 * 0400 * Any other value indicates an appropriate error condition. The callback function 0401 * will _not_ be called in such cases. 0402 */ 0403 typedef pmix_status_t (*pmix_server_get_cred_fn_t)(const pmix_proc_t *proc, 0404 const pmix_info_t directives[], size_t ndirs, 0405 pmix_credential_cbfunc_t cbfunc, void *cbdata); 0406 0407 /* Request validation of a credential from the host SMS 0408 * Input values include: 0409 * 0410 * proc - pointer to a pmix_proc_t identifier of the process on whose behalf 0411 * the request is being made (i.e., the client issuing the request) 0412 * 0413 * cred - pointer to a pmix_byte_object_t containing the provided credential 0414 * 0415 * directives - an array of pmix_info_t structures containing directives pertaining 0416 * to the request. This will typically include any pmix_info_t structs 0417 * passed by the requesting client, but may also include directives 0418 * used by the PMIx server implementation 0419 * 0420 * ndirs - number of pmix_info_t structures in the directives array 0421 * 0422 * cbfunc - the pmix_validation_cbfunc_t function to be called upon completion 0423 * of the request 0424 * 0425 * cbdata - pointer to an object to be returned when cbfunc is called 0426 * 0427 * Returned values: 0428 * PMIX_SUCCESS - indicates that the request is being processed by the host system 0429 * management stack. The response will be coming in the provided 0430 * callback function. 0431 * 0432 * Any other value indicates an appropriate error condition. The callback function 0433 * will _not_ be called in such cases. 0434 */ 0435 typedef pmix_status_t (*pmix_server_validate_cred_fn_t)(const pmix_proc_t *proc, 0436 const pmix_byte_object_t *cred, 0437 const pmix_info_t directives[], size_t ndirs, 0438 pmix_validation_cbfunc_t cbfunc, void *cbdata); 0439 0440 /* Request the specified IO channels be forwarded from the given array of procs. 0441 * The function shall return PMIX_SUCCESS once the host RM accepts the request for 0442 * processing, or a PMIx error code if the request itself isn't correct or supported. 0443 * The callback function shall be called when the request has been processed, 0444 * returning either PMIX_SUCCESS to indicate that IO shall be forwarded as requested, 0445 * or some appropriate error code if the request has been denied. 0446 * 0447 * NOTE: STDIN is not supported in this call! The forwarding of stdin is a "push" 0448 * process - procs cannot request that it be "pulled" from some other source 0449 * 0450 * procs - array of process identifiers whose IO is being requested. 0451 * 0452 * nprocs - size of the procs array 0453 * 0454 * directives - array of key-value attributes further defining the request. This 0455 * might include directives on buffering and security credentials for 0456 * access to protected channels 0457 * 0458 * ndirs - size of the directives array 0459 * 0460 * channels - bitmask identifying the channels to be forwarded 0461 * 0462 * cbfunc - callback function when the IO forwarding has been setup 0463 * 0464 * cbdata - object to be returned in cbfunc 0465 * 0466 * This call serves as a registration with the host RM for the given IO channels from 0467 * the specified procs - the host RM is expected to ensure that this local PMIx server 0468 * is on the distribution list for the channel/proc combination. IF the PMIX_IOF_STOP 0469 * is included in the directives, then the local PMIx server is requesting that the 0470 * host RM remove the server from the distribution list for the specified channel/proc 0471 * combination. 0472 */ 0473 typedef pmix_status_t (*pmix_server_iof_fn_t)(const pmix_proc_t procs[], size_t nprocs, 0474 const pmix_info_t directives[], size_t ndirs, 0475 pmix_iof_channel_t channels, 0476 pmix_op_cbfunc_t cbfunc, void *cbdata); 0477 0478 /* Passes stdin to the host RM for transmission to specified recipients. The host RM is 0479 * responsible for forwarding the data to all PMIx servers that host the specified 0480 * target. 0481 * 0482 * source - pointer to the identifier of the process whose stdin is being provided 0483 * 0484 * targets - array of process identifiers to which the data is to be delivered. Note 0485 * that a WILDCARD rank indicates that all procs in the given nspace are 0486 * to receive a copy of the data 0487 * 0488 * ntargets - number of procs in the targets array 0489 * 0490 * directives - array of key-value attributes further defining the request. This 0491 * might include directives on buffering and security credentials for 0492 * access to protected channels 0493 * 0494 * ndirs - size of the directives array 0495 * 0496 * bo - pointer to a byte object containing the stdin data 0497 * 0498 * cbfunc - callback function when the data has been forwarded 0499 * 0500 * cbdata - object to be returned in cbfunc 0501 * 0502 */ 0503 0504 typedef pmix_status_t (*pmix_server_stdin_fn_t)(const pmix_proc_t *source, 0505 const pmix_proc_t targets[], size_t ntargets, 0506 const pmix_info_t directives[], size_t ndirs, 0507 const pmix_byte_object_t *bo, 0508 pmix_op_cbfunc_t cbfunc, void *cbdata); 0509 0510 0511 /* Perform a "fence" operation across the specified procs, plus any special 0512 * actions included in the directives. Return the result of any special action 0513 * requests in the info cbfunc when the fence is completed. Actions may include: 0514 * 0515 * PMIX_GROUP_ASSIGN_CONTEXT_ID - request that the RM assign a unique 0516 * numerical (size_t) ID to this group 0517 * 0518 * grp - user-assigned string ID of this group 0519 * 0520 * op - pmix_group_operation_t value indicating the operation to perform 0521 * Current values support construct and destruct of the group 0522 * 0523 * procs - pointer to array of pmix_proc_t ID's of group members 0524 * 0525 * nprocs - number of group members 0526 * 0527 * directives - array of key-value attributes specifying special actions. 0528 * 0529 * ndirs - size of the directives array 0530 * 0531 * cbfunc - callback function when the operation is completed 0532 * 0533 * cbdata - object to be returned in cbfunc 0534 */ 0535 typedef pmix_status_t (*pmix_server_grp_fn_t)(pmix_group_operation_t op, char grp[], 0536 const pmix_proc_t procs[], size_t nprocs, 0537 const pmix_info_t directives[], size_t ndirs, 0538 pmix_info_cbfunc_t cbfunc, void *cbdata); 0539 0540 /* Retrieve fabric-related information from the server supporting 0541 * the system scheduler. 0542 */ 0543 typedef pmix_status_t (*pmix_server_fabric_fn_t)(const pmix_proc_t *requestor, 0544 pmix_fabric_operation_t op, 0545 const pmix_info_t directives[], size_t ndirs, 0546 pmix_info_cbfunc_t cbfunc, void *cbdata); 0547 0548 /* Execute a session control operation request */ 0549 typedef pmix_status_t (*pmix_server_session_control_fn_t)(const pmix_proc_t *requestor, 0550 uint32_t sessionID, 0551 const pmix_info_t directives[], size_t ndirs, 0552 pmix_info_cbfunc_t cbfunc, void *cbdata); 0553 0554 /* Define/delete or extend/remove resources from a resource block */ 0555 typedef pmix_status_t (*pmix_server_resource_block_fn_t)(const pmix_proc_t *requestor, 0556 pmix_resource_block_directive_t directive, 0557 const char *block, 0558 const pmix_resource_unit_t *units, size_t nunit, 0559 const pmix_info_t *info, size_t ninfo, 0560 pmix_op_cbfunc_t cbfunc, void *cbdata); 0561 0562 0563 typedef struct pmix_server_module_4_0_0_t { 0564 /* v1x interfaces */ 0565 pmix_server_client_connected_fn_t client_connected; // DEPRECATED 0566 pmix_server_client_finalized_fn_t client_finalized; 0567 pmix_server_abort_fn_t abort; 0568 pmix_server_fencenb_fn_t fence_nb; 0569 pmix_server_dmodex_req_fn_t direct_modex; 0570 pmix_server_publish_fn_t publish; 0571 pmix_server_lookup_fn_t lookup; 0572 pmix_server_unpublish_fn_t unpublish; 0573 pmix_server_spawn_fn_t spawn; 0574 pmix_server_connect_fn_t connect; 0575 pmix_server_disconnect_fn_t disconnect; 0576 pmix_server_register_events_fn_t register_events; 0577 pmix_server_deregister_events_fn_t deregister_events; 0578 pmix_server_listener_fn_t listener; 0579 /* v2x interfaces */ 0580 pmix_server_notify_event_fn_t notify_event; 0581 pmix_server_query_fn_t query; 0582 pmix_server_tool_connection_fn_t tool_connected; // DEPRECATED 0583 pmix_server_log_fn_t log; // DEPRECATED 0584 pmix_server_alloc_fn_t allocate; 0585 pmix_server_job_control_fn_t job_control; 0586 pmix_server_monitor_fn_t monitor; 0587 /* v3x interfaces */ 0588 pmix_server_get_cred_fn_t get_credential; 0589 pmix_server_validate_cred_fn_t validate_credential; 0590 pmix_server_iof_fn_t iof_pull; 0591 pmix_server_stdin_fn_t push_stdin; 0592 /* v4x interfaces */ 0593 pmix_server_grp_fn_t group; 0594 pmix_server_fabric_fn_t fabric; 0595 /* v6x interfaces */ 0596 pmix_server_client_connected2_fn_t client_connected2; 0597 pmix_server_tool_connection2_fn_t tool_connected2; 0598 pmix_server_log2_fn_t log2; 0599 /* pending interfaces */ 0600 pmix_server_session_control_fn_t session_control; 0601 pmix_server_resource_block_fn_t resource_block; 0602 0603 } pmix_server_module_t; 0604 0605 /**** HOST RM FUNCTIONS FOR INTERFACE TO PMIX SERVER ****/ 0606 0607 /* Initialize the server support library, and provide a 0608 * pointer to a pmix_server_module_t structure 0609 * containing the caller's callback functions. The 0610 * array of pmix_info_t structs is used to pass 0611 * additional info that may be required by the server 0612 * when initializing - e.g., a user/group ID to set 0613 * on the rendezvous file for the Unix Domain Socket. It 0614 * also may include the PMIX_SERVER_TOOL_SUPPORT key, thereby 0615 * indicating that the daemon is willing to accept connection 0616 * requests from tools */ 0617 PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, 0618 pmix_info_t info[], size_t ninfo); 0619 0620 /* Finalize the server support library. If internal comm is 0621 * in-use, the server will shut it down at this time. All 0622 * memory usage is released */ 0623 PMIX_EXPORT pmix_status_t PMIx_server_finalize(void); 0624 0625 /* Given a comma-separated list of \refarg{input} values, generate 0626 * a reduced size representation of the input that can be passed 0627 * down to PMIx_server_register_nspace for parsing. The order of 0628 * the individual values in the \refarg{input} string is preserved 0629 * across the operation. The caller is responsible for releasing 0630 * the returned data. 0631 * 0632 * The returned representation may be an arbitrary array of bytes 0633 * as opposed to a valid NULL-terminated string. However, the 0634 * method used to generate the representation shall be identified 0635 * with a colon-delimited string at the beginning of the output. 0636 * For example, an output starting with "pmix:" indicates that 0637 * the representation is a PMIx-defined regular expression. 0638 * In contrast, an output starting with "blob:" is a compressed 0639 * binary array. 0640 */ 0641 PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regex); 0642 0643 /* The input shall consist of a semicolon-separated list of ranges 0644 * representing the ranks of processes on each node of the job - 0645 * e.g., "1-4;2-5;8,10,11,12;6,7,9". Each field of the input must 0646 * correspond to the node name provided at that position in the 0647 * input to PMIx_generate_regex. Thus, in the example, ranks 1-4 0648 * would be located on the first node of the comma-separated list 0649 * of names provided to PMIx_generate_regex, and ranks 2-5 would 0650 * be on the second name in the list. 0651 * 0652 * The returned representation may be an arbitrary array of bytes 0653 * as opposed to a valid NULL-terminated string. However, the 0654 * method used to generate the representation shall be identified 0655 * with a colon-delimited string at the beginning of the output. 0656 * For example, an output starting with "pmix:" indicates that 0657 * the representation is a PMIx-defined regular expression. 0658 * In contrast, an output starting with "blob:" is a compressed 0659 * binary array. 0660 */ 0661 PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **ppn); 0662 0663 /* Setup the data about a particular nspace so it can 0664 * be passed to any child process upon startup. The PMIx 0665 * connection procedure provides an opportunity for the 0666 * host PMIx server to pass job-related info down to a 0667 * child process. This might include the number of 0668 * processes in the job, relative local ranks of the 0669 * processes within the job, and other information of 0670 * use to the process. The server is free to determine 0671 * which, if any, of the supported elements it will 0672 * provide - defined values are provided in pmix_common.h. 0673 * 0674 * NOTE: the server must register ALL nspaces that will 0675 * participate in collective operations with local processes. 0676 * This means that the server must register an nspace even 0677 * if it will not host any local procs from within that 0678 * nspace IF any local proc might at some point perform 0679 * a collective operation involving one or more procs from 0680 * that nspace. This is necessary so that the collective 0681 * operation can know when it is locally complete. 0682 * 0683 * The caller must also provide the number of local procs 0684 * that will be launched within this nspace. This is required 0685 * for the PMIx server library to correctly handle collectives 0686 * as a collective operation call can occur before all the 0687 * procs have been started */ 0688 PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace, int nlocalprocs, 0689 pmix_info_t info[], size_t ninfo, 0690 pmix_op_cbfunc_t cbfunc, void *cbdata); 0691 0692 /* Deregister an nspace and purge all objects relating to 0693 * it, including any client info from that nspace. This is 0694 * intended to support persistent PMIx servers by providing 0695 * an opportunity for the host RM to tell the PMIx server 0696 * library to release all memory for a completed job */ 0697 PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, 0698 pmix_op_cbfunc_t cbfunc, void *cbdata); 0699 0700 /* Register a client process with the PMIx server library. The 0701 * expected user ID and group ID of the child process helps the 0702 * server library to properly authenticate clients as they connect 0703 * by requiring the two values to match. 0704 * 0705 * The host server can also, if it desires, provide an object 0706 * it wishes to be returned when a server function is called 0707 * that relates to a specific process. For example, the host 0708 * server may have an object that tracks the specific client. 0709 * Passing the object to the library allows the library to 0710 * return that object when the client calls "finalize", thus 0711 * allowing the host server to access the object without 0712 * performing a lookup. */ 0713 PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, 0714 uid_t uid, gid_t gid, 0715 void *server_object, 0716 pmix_op_cbfunc_t cbfunc, void *cbdata); 0717 0718 /* Deregister a client and purge all data relating to it. The 0719 * deregister_nspace API will automatically delete all client 0720 * info for that nspace - this API is therefore intended solely 0721 * for use in exception cases */ 0722 PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, 0723 pmix_op_cbfunc_t cbfunc, void *cbdata); 0724 0725 /* Setup the environment of a child process to be forked 0726 * by the host so it can correctly interact with the PMIx 0727 * server. The PMIx client needs some setup information 0728 * so it can properly connect back to the server. This function 0729 * will set appropriate environmental variables for this purpose. */ 0730 PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char ***env); 0731 0732 /* Define a callback function the PMIx server will use to return 0733 * direct modex requests to the host server. The PMIx server 0734 * will free the data blob upon return from the response fn */ 0735 typedef void (*pmix_dmodex_response_fn_t)(pmix_status_t status, 0736 char *data, size_t sz, 0737 void *cbdata); 0738 0739 /* Define a function by which the host server can request modex data 0740 * from the local PMIx server. This is used to support the direct modex 0741 * operation - i.e., where data is cached locally on each PMIx 0742 * server for its own local clients, and is obtained on-demand 0743 * for remote requests. Upon receiving a request from a remote 0744 * server, the host server will call this function to pass the 0745 * request into the PMIx server. The PMIx server will return a blob 0746 * (once it becomes available) via the cbfunc - the host 0747 * server shall send the blob back to the original requestor */ 0748 PMIX_EXPORT pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc, 0749 pmix_dmodex_response_fn_t cbfunc, 0750 void *cbdata); 0751 0752 /* define a callback function for the setup_application API. The returned info 0753 * array is owned by the PMIx server library and will be free'd when the 0754 * provided cbfunc is called. */ 0755 typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status, 0756 pmix_info_t info[], size_t ninfo, 0757 void *provided_cbdata, 0758 pmix_op_cbfunc_t cbfunc, void *cbdata); 0759 0760 /* Provide a function by which the resource manager can request 0761 * any application-specific environmental variables, resource 0762 * assignments, and/or other data prior to launch of an application. 0763 * For example, network libraries may opt to provide security 0764 * credentials for the application. This is defined as a non-blocking 0765 * operation in case network libraries need to perform some action 0766 * before responding. Any returned env will be distributed along 0767 * with the application */ 0768 PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const pmix_nspace_t nspace, 0769 pmix_info_t info[], size_t ninfo, 0770 pmix_setup_application_cbfunc_t cbfunc, void *cbdata); 0771 0772 /* Provide a function by which the local PMIx server can perform 0773 * any application-specific operations prior to spawning local 0774 * clients of a given application. For example, a network library 0775 * might need to setup the local driver for "instant on" addressing. 0776 * Data provided in the info array will be stored in the job-info 0777 * region for the nspace. Operations included in the info array 0778 * will be cached until the server calls PMIx_server_setup_fork, 0779 * thereby indicating that local clients of this nspace will exist. 0780 * Operations indicated by the provided data will only be executed 0781 * for the first local client - i.e., they will only be executed 0782 * once for a given nspace 0783 */ 0784 PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const pmix_nspace_t nspace, 0785 pmix_info_t info[], size_t ninfo, 0786 pmix_op_cbfunc_t cbfunc, void *cbdata); 0787 0788 /* Provide a function by which the host RM can pass forwarded IO 0789 * to the local PMIx server for distribution to its clients. The 0790 * PMIx server is responsible for determining which of its clients 0791 * have actually registered for the provided data 0792 * 0793 * Parameters include: 0794 * 0795 * source - the process that provided the data being forwarded 0796 * 0797 * channel - the IOF channel (stdin, stdout, etc.) 0798 * 0799 * bo - a byte object containing the data 0800 * 0801 * info - an optional array of metadata describing the data, including 0802 * attributes such as PMIX_IOF_COMPLETE to indicate that the 0803 * source channel has been closed 0804 * 0805 * ninfo - number of elements in the info array 0806 * 0807 * cbfunc - a callback function to be executed once the provided data 0808 * is no longer required. The host RM is required to retain 0809 * the byte object until the callback is executed, or a 0810 * non-success status is returned by the function 0811 * 0812 * cbdata - object pointer to be returned in the callback function 0813 */ 0814 PMIX_EXPORT pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, 0815 pmix_iof_channel_t channel, 0816 const pmix_byte_object_t *bo, 0817 const pmix_info_t info[], size_t ninfo, 0818 pmix_op_cbfunc_t cbfunc, void *cbdata); 0819 0820 /* Collect inventory of local resources. This is a non-blocking 0821 * API as it may involve somewhat lengthy operations to obtain 0822 * the requested information. Servers designated as "gateways" 0823 * and whose plugins support collection of infrastructure info 0824 * (e.g., switch and fabric topology, connectivity maps) shall 0825 * return that information - plugins on non-gateway servers 0826 * shall only return the node-local inventory. */ 0827 PMIX_EXPORT pmix_status_t PMIx_server_collect_inventory(pmix_info_t directives[], size_t ndirs, 0828 pmix_info_cbfunc_t cbfunc, void *cbdata); 0829 0830 /* Deliver collected inventory for archiving by the corresponding 0831 * plugins. Typically executed on a "gateway" associated with the 0832 * system scheduler to enable use of inventory information by the 0833 * the scheduling algorithm. May also be used on compute nodes to 0834 * store a broader picture of the system for access by applications, 0835 * if desired */ 0836 PMIX_EXPORT pmix_status_t PMIx_server_deliver_inventory(pmix_info_t info[], size_t ninfo, 0837 pmix_info_t directives[], size_t ndirs, 0838 pmix_op_cbfunc_t cbfunc, void *cbdata); 0839 0840 0841 /****** ATTRIBUTE REGISTRATION ******/ 0842 /** 0843 * This function is used by the host environment to register with its 0844 * server library the attributes it supports for each pmix_server_module_t 0845 * function. 0846 * 0847 * Parameters include: 0848 * 0849 * function - the string name of the server module function 0850 * (e.g., "register_events", "validate_credential", 0851 * or "allocate") whose attributes are being registered. 0852 * 0853 * attrs - NULL-terminated argv array of attributes supported 0854 * by the host environment for the specified function 0855 * 0856 */ 0857 PMIX_EXPORT pmix_status_t PMIx_Register_attributes(char *function, char *attrs[]); 0858 0859 /* Generate a PMIx locality string from a given cpuset. 0860 * Provide a function by which the host environment can generate a PMIx locality 0861 * string for inclusion in the call to PMIx_server_register_nspace . This function 0862 * shall only be called for local client processes, with the returned locality 0863 * included in the job-level information (via the PMIX_LOCALITY_STRING attribute) 0864 * provided to local clients. 0865 */ 0866 PMIX_EXPORT pmix_status_t PMIx_server_generate_locality_string(const pmix_cpuset_t *cpuset, 0867 char **locality); 0868 0869 /* Generate a PMIx string representation of the provided cpuset. 0870 * Provide a function by which the host environment can generate a string 0871 * representation of the cpuset bitmap for inclusion in the call to 0872 * PMIx_server_register_nspace . This function shall only be called for local 0873 * client processes, with the returned string included in the job-level information 0874 * (via the PMIX_CPUSET attribute) provided to local clients. 0875 */ 0876 PMIX_EXPORT pmix_status_t PMIx_server_generate_cpuset_string(const pmix_cpuset_t *cpuset, 0877 char **cpuset_string); 0878 0879 /* Generate a cpuset from the provided PMIx string representation. 0880 * Provide a function by which the host environment can convert a PMIx 0881 * string representation of a cpuset into the corresponding cpuset bitmap. 0882 * Caller must provide storage for the pmix_cpuset_t. 0883 */ 0884 PMIX_EXPORT pmix_status_t PMIx_server_generate_cpuset(const char *cpuset_string, 0885 pmix_cpuset_t *cpuset); 0886 0887 /* Define a process set 0888 * Provide a function by which the host environment can define a new process set. 0889 */ 0890 PMIX_EXPORT pmix_status_t PMIx_server_define_process_set(const pmix_proc_t *members, 0891 size_t nmembers, const char *pset_name); 0892 0893 /* Delete a process set 0894 * Provide a function by which the host environment can delete a new process set. 0895 */ 0896 PMIX_EXPORT pmix_status_t PMIx_server_delete_process_set(char *pset_name); 0897 0898 0899 /* Register non-namespace related information with the local PMIx server library. 0900 * This API can be used for a variety of purposes. For example, one could use it 0901 * to register information on the physical cluster that you want passed to every 0902 * nspace during "register nspace". 0903 * 0904 * Another usage is to register data collected during various operations - e.g., 0905 * PMIx_Group_construct when returning group and endpoint information during a 0906 * bootstrap operation. In such cases, not every local host will have at least 0907 * one client involved in directly calling the construct API - i.e., all local 0908 * "participants" may be doing so as "add members" and just waiting for an invite 0909 * event. Thus, there is no callback function registered by the PMIx server 0910 * library that can be used to store the returned endpoint, group info, and job 0911 * data. This API fills that hole 0912 */ 0913 PMIX_EXPORT pmix_status_t PMIx_server_register_resources(pmix_info_t info[], size_t ninfo, 0914 pmix_op_cbfunc_t cbfunc, 0915 void *cbdata); 0916 0917 /* Remove specified non-namespace related information from the local PMIx server library. 0918 */ 0919 PMIX_EXPORT pmix_status_t PMIx_server_deregister_resources(pmix_info_t info[], size_t ninfo, 0920 pmix_op_cbfunc_t cbfunc, 0921 void *cbdata); 0922 0923 /* collect job-level info for an array of procs */ 0924 PMIX_EXPORT pmix_status_t PMIx_server_collect_job_info(pmix_proc_t *procs, size_t nprocs, 0925 pmix_data_buffer_t *dbuf); 0926 0927 0928 #if defined(c_plusplus) || defined(__cplusplus) 0929 } 0930 #endif 0931 0932 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|