|
||||
File indexing completed on 2025-01-17 09:55:56
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-2023 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 /* Log data on behalf of a client. Calls to the host thru this 0327 * function must _NOT_ call the PMIx_Log API as this will 0328 * trigger an infinite loop. Instead, the implementation must 0329 * perform one of three operations: 0330 * 0331 * (a) transfer the data+directives to a "gateway" server 0332 * where they can be logged. Gateways are designated 0333 * servers on nodes (typically service nodes) where 0334 * centralized logging is supported. The data+directives 0335 * may be passed to the PMIx_Log API once arriving at 0336 * that destination. 0337 * 0338 * (b) transfer the data to a logging channel outside of 0339 * PMIx, but directly supported by the host 0340 * 0341 * (c) return an error to the caller indicating that the 0342 * requested action is not supported 0343 */ 0344 typedef void (*pmix_server_log_fn_t)(const pmix_proc_t *client, 0345 const pmix_info_t data[], size_t ndata, 0346 const pmix_info_t directives[], size_t ndirs, 0347 pmix_op_cbfunc_t cbfunc, void *cbdata); 0348 0349 /* Request allocation modifications on behalf of a client */ 0350 typedef pmix_status_t (*pmix_server_alloc_fn_t)(const pmix_proc_t *client, 0351 pmix_alloc_directive_t directive, 0352 const pmix_info_t data[], size_t ndata, 0353 pmix_info_cbfunc_t cbfunc, void *cbdata); 0354 0355 /* Execute a job control action on behalf of a client */ 0356 typedef pmix_status_t (*pmix_server_job_control_fn_t)(const pmix_proc_t *requestor, 0357 const pmix_proc_t targets[], size_t ntargets, 0358 const pmix_info_t directives[], size_t ndirs, 0359 pmix_info_cbfunc_t cbfunc, void *cbdata); 0360 0361 /* Request that a client be monitored for activity */ 0362 typedef pmix_status_t (*pmix_server_monitor_fn_t)(const pmix_proc_t *requestor, 0363 const pmix_info_t *monitor, pmix_status_t error, 0364 const pmix_info_t directives[], size_t ndirs, 0365 pmix_info_cbfunc_t cbfunc, void *cbdata); 0366 0367 /* Request a credential from the host SMS 0368 * Input values include: 0369 * 0370 * proc - pointer to a pmix_proc_t identifier of the process on whose behalf 0371 * the request is being made (i.e., the client originating the request) 0372 * 0373 * directives - an array of pmix_info_t structures containing directives pertaining 0374 * to the request. This will typically include any pmix_info_t structs 0375 * passed by the requesting client, but may also include directives 0376 * required by (or available from) the PMIx server implementation - e.g., 0377 * the effective user and group ID's of the requesting process. 0378 * 0379 * ndirs - number of pmix_info_t structures in the directives array 0380 * 0381 * cbfunc - the pmix_credential_cbfunc_t function to be called upon completion 0382 * of the request 0383 * 0384 * cbdata - pointer to an object to be returned when cbfunc is called 0385 * 0386 * Returned values: 0387 * PMIX_SUCCESS - indicates that the request is being processed by the host system 0388 * management stack. The response will be coming in the provided 0389 * callback function. 0390 * 0391 * Any other value indicates an appropriate error condition. The callback function 0392 * will _not_ be called in such cases. 0393 */ 0394 typedef pmix_status_t (*pmix_server_get_cred_fn_t)(const pmix_proc_t *proc, 0395 const pmix_info_t directives[], size_t ndirs, 0396 pmix_credential_cbfunc_t cbfunc, void *cbdata); 0397 0398 /* Request validation of a credential from the host SMS 0399 * Input values include: 0400 * 0401 * proc - pointer to a pmix_proc_t identifier of the process on whose behalf 0402 * the request is being made (i.e., the client issuing the request) 0403 * 0404 * cred - pointer to a pmix_byte_object_t containing the provided credential 0405 * 0406 * directives - an array of pmix_info_t structures containing directives pertaining 0407 * to the request. This will typically include any pmix_info_t structs 0408 * passed by the requesting client, but may also include directives 0409 * used by the PMIx server implementation 0410 * 0411 * ndirs - number of pmix_info_t structures in the directives array 0412 * 0413 * cbfunc - the pmix_validation_cbfunc_t function to be called upon completion 0414 * of the request 0415 * 0416 * cbdata - pointer to an object to be returned when cbfunc is called 0417 * 0418 * Returned values: 0419 * PMIX_SUCCESS - indicates that the request is being processed by the host system 0420 * management stack. The response will be coming in the provided 0421 * callback function. 0422 * 0423 * Any other value indicates an appropriate error condition. The callback function 0424 * will _not_ be called in such cases. 0425 */ 0426 typedef pmix_status_t (*pmix_server_validate_cred_fn_t)(const pmix_proc_t *proc, 0427 const pmix_byte_object_t *cred, 0428 const pmix_info_t directives[], size_t ndirs, 0429 pmix_validation_cbfunc_t cbfunc, void *cbdata); 0430 0431 /* Request the specified IO channels be forwarded from the given array of procs. 0432 * The function shall return PMIX_SUCCESS once the host RM accepts the request for 0433 * processing, or a PMIx error code if the request itself isn't correct or supported. 0434 * The callback function shall be called when the request has been processed, 0435 * returning either PMIX_SUCCESS to indicate that IO shall be forwarded as requested, 0436 * or some appropriate error code if the request has been denied. 0437 * 0438 * NOTE: STDIN is not supported in this call! The forwarding of stdin is a "push" 0439 * process - procs cannot request that it be "pulled" from some other source 0440 * 0441 * procs - array of process identifiers whose IO is being requested. 0442 * 0443 * nprocs - size of the procs array 0444 * 0445 * directives - array of key-value attributes further defining the request. This 0446 * might include directives on buffering and security credentials for 0447 * access to protected channels 0448 * 0449 * ndirs - size of the directives array 0450 * 0451 * channels - bitmask identifying the channels to be forwarded 0452 * 0453 * cbfunc - callback function when the IO forwarding has been setup 0454 * 0455 * cbdata - object to be returned in cbfunc 0456 * 0457 * This call serves as a registration with the host RM for the given IO channels from 0458 * the specified procs - the host RM is expected to ensure that this local PMIx server 0459 * is on the distribution list for the channel/proc combination. IF the PMIX_IOF_STOP 0460 * is included in the directives, then the local PMIx server is requesting that the 0461 * host RM remove the server from the distribution list for the specified channel/proc 0462 * combination. 0463 */ 0464 typedef pmix_status_t (*pmix_server_iof_fn_t)(const pmix_proc_t procs[], size_t nprocs, 0465 const pmix_info_t directives[], size_t ndirs, 0466 pmix_iof_channel_t channels, 0467 pmix_op_cbfunc_t cbfunc, void *cbdata); 0468 0469 /* Passes stdin to the host RM for transmission to specified recipients. The host RM is 0470 * responsible for forwarding the data to all PMIx servers that host the specified 0471 * target. 0472 * 0473 * source - pointer to the identifier of the process whose stdin is being provided 0474 * 0475 * targets - array of process identifiers to which the data is to be delivered. Note 0476 * that a WILDCARD rank indicates that all procs in the given nspace are 0477 * to receive a copy of the data 0478 * 0479 * ntargets - number of procs in the targets array 0480 * 0481 * directives - array of key-value attributes further defining the request. This 0482 * might include directives on buffering and security credentials for 0483 * access to protected channels 0484 * 0485 * ndirs - size of the directives array 0486 * 0487 * bo - pointer to a byte object containing the stdin data 0488 * 0489 * cbfunc - callback function when the data has been forwarded 0490 * 0491 * cbdata - object to be returned in cbfunc 0492 * 0493 */ 0494 0495 typedef pmix_status_t (*pmix_server_stdin_fn_t)(const pmix_proc_t *source, 0496 const pmix_proc_t targets[], size_t ntargets, 0497 const pmix_info_t directives[], size_t ndirs, 0498 const pmix_byte_object_t *bo, 0499 pmix_op_cbfunc_t cbfunc, void *cbdata); 0500 0501 0502 /* Perform a "fence" operation across the specified procs, plus any special 0503 * actions included in the directives. Return the result of any special action 0504 * requests in the info cbfunc when the fence is completed. Actions may include: 0505 * 0506 * PMIX_GROUP_ASSIGN_CONTEXT_ID - request that the RM assign a unique 0507 * numerical (size_t) ID to this group 0508 * 0509 * grp - user-assigned string ID of this group 0510 * 0511 * op - pmix_group_operation_t value indicating the operation to perform 0512 * Current values support construct and destruct of the group 0513 * 0514 * procs - pointer to array of pmix_proc_t ID's of group members 0515 * 0516 * nprocs - number of group members 0517 * 0518 * directives - array of key-value attributes specifying special actions. 0519 * 0520 * ndirs - size of the directives array 0521 * 0522 * cbfunc - callback function when the operation is completed 0523 * 0524 * cbdata - object to be returned in cbfunc 0525 */ 0526 typedef pmix_status_t (*pmix_server_grp_fn_t)(pmix_group_operation_t op, char grp[], 0527 const pmix_proc_t procs[], size_t nprocs, 0528 const pmix_info_t directives[], size_t ndirs, 0529 pmix_info_cbfunc_t cbfunc, void *cbdata); 0530 0531 /* Retrieve fabric-related information from the server supporting 0532 * the system scheduler. 0533 */ 0534 typedef pmix_status_t (*pmix_server_fabric_fn_t)(const pmix_proc_t *requestor, 0535 pmix_fabric_operation_t op, 0536 const pmix_info_t directives[], size_t ndirs, 0537 pmix_info_cbfunc_t cbfunc, void *cbdata); 0538 0539 /* Execute a session control operation request */ 0540 typedef pmix_status_t (*pmix_server_session_control_fn_t)(const pmix_proc_t *requestor, 0541 uint32_t sessionID, 0542 const pmix_info_t directives[], size_t ndirs, 0543 pmix_info_cbfunc_t cbfunc, void *cbdata); 0544 0545 typedef struct pmix_server_module_4_0_0_t { 0546 /* v1x interfaces */ 0547 pmix_server_client_connected_fn_t client_connected; 0548 pmix_server_client_finalized_fn_t client_finalized; 0549 pmix_server_abort_fn_t abort; 0550 pmix_server_fencenb_fn_t fence_nb; 0551 pmix_server_dmodex_req_fn_t direct_modex; 0552 pmix_server_publish_fn_t publish; 0553 pmix_server_lookup_fn_t lookup; 0554 pmix_server_unpublish_fn_t unpublish; 0555 pmix_server_spawn_fn_t spawn; 0556 pmix_server_connect_fn_t connect; 0557 pmix_server_disconnect_fn_t disconnect; 0558 pmix_server_register_events_fn_t register_events; 0559 pmix_server_deregister_events_fn_t deregister_events; 0560 pmix_server_listener_fn_t listener; 0561 /* v2x interfaces */ 0562 pmix_server_notify_event_fn_t notify_event; 0563 pmix_server_query_fn_t query; 0564 pmix_server_tool_connection_fn_t tool_connected; 0565 pmix_server_log_fn_t log; 0566 pmix_server_alloc_fn_t allocate; 0567 pmix_server_job_control_fn_t job_control; 0568 pmix_server_monitor_fn_t monitor; 0569 /* v3x interfaces */ 0570 pmix_server_get_cred_fn_t get_credential; 0571 pmix_server_validate_cred_fn_t validate_credential; 0572 pmix_server_iof_fn_t iof_pull; 0573 pmix_server_stdin_fn_t push_stdin; 0574 /* v4x interfaces */ 0575 pmix_server_grp_fn_t group; 0576 pmix_server_fabric_fn_t fabric; 0577 pmix_server_client_connected2_fn_t client_connected2; 0578 /* v5x interfaces */ 0579 pmix_server_session_control_fn_t session_control; 0580 } pmix_server_module_t; 0581 0582 /**** HOST RM FUNCTIONS FOR INTERFACE TO PMIX SERVER ****/ 0583 0584 /* Initialize the server support library, and provide a 0585 * pointer to a pmix_server_module_t structure 0586 * containing the caller's callback functions. The 0587 * array of pmix_info_t structs is used to pass 0588 * additional info that may be required by the server 0589 * when initializing - e.g., a user/group ID to set 0590 * on the rendezvous file for the Unix Domain Socket. It 0591 * also may include the PMIX_SERVER_TOOL_SUPPORT key, thereby 0592 * indicating that the daemon is willing to accept connection 0593 * requests from tools */ 0594 PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, 0595 pmix_info_t info[], size_t ninfo); 0596 0597 /* Finalize the server support library. If internal comm is 0598 * in-use, the server will shut it down at this time. All 0599 * memory usage is released */ 0600 PMIX_EXPORT pmix_status_t PMIx_server_finalize(void); 0601 0602 /* Given a comma-separated list of \refarg{input} values, generate 0603 * a reduced size representation of the input that can be passed 0604 * down to PMIx_server_register_nspace for parsing. The order of 0605 * the individual values in the \refarg{input} string is preserved 0606 * across the operation. The caller is responsible for releasing 0607 * the returned data. 0608 * 0609 * The returned representation may be an arbitrary array of bytes 0610 * as opposed to a valid NULL-terminated string. However, the 0611 * method used to generate the representation shall be identified 0612 * with a colon-delimited string at the beginning of the output. 0613 * For example, an output starting with "pmix:" indicates that 0614 * the representation is a PMIx-defined regular expression. 0615 * In contrast, an output starting with "blob:" is a compressed 0616 * binary array. 0617 */ 0618 PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regex); 0619 0620 /* The input shall consist of a semicolon-separated list of ranges 0621 * representing the ranks of processes on each node of the job - 0622 * e.g., "1-4;2-5;8,10,11,12;6,7,9". Each field of the input must 0623 * correspond to the node name provided at that position in the 0624 * input to PMIx_generate_regex. Thus, in the example, ranks 1-4 0625 * would be located on the first node of the comma-separated list 0626 * of names provided to PMIx_generate_regex, and ranks 2-5 would 0627 * be on the second name in the list. 0628 * 0629 * The returned representation may be an arbitrary array of bytes 0630 * as opposed to a valid NULL-terminated string. However, the 0631 * method used to generate the representation shall be identified 0632 * with a colon-delimited string at the beginning of the output. 0633 * For example, an output starting with "pmix:" indicates that 0634 * the representation is a PMIx-defined regular expression. 0635 * In contrast, an output starting with "blob:" is a compressed 0636 * binary array. 0637 */ 0638 PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **ppn); 0639 0640 /* Setup the data about a particular nspace so it can 0641 * be passed to any child process upon startup. The PMIx 0642 * connection procedure provides an opportunity for the 0643 * host PMIx server to pass job-related info down to a 0644 * child process. This might include the number of 0645 * processes in the job, relative local ranks of the 0646 * processes within the job, and other information of 0647 * use to the process. The server is free to determine 0648 * which, if any, of the supported elements it will 0649 * provide - defined values are provided in pmix_common.h. 0650 * 0651 * NOTE: the server must register ALL nspaces that will 0652 * participate in collective operations with local processes. 0653 * This means that the server must register an nspace even 0654 * if it will not host any local procs from within that 0655 * nspace IF any local proc might at some point perform 0656 * a collective operation involving one or more procs from 0657 * that nspace. This is necessary so that the collective 0658 * operation can know when it is locally complete. 0659 * 0660 * The caller must also provide the number of local procs 0661 * that will be launched within this nspace. This is required 0662 * for the PMIx server library to correctly handle collectives 0663 * as a collective operation call can occur before all the 0664 * procs have been started */ 0665 PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace, int nlocalprocs, 0666 pmix_info_t info[], size_t ninfo, 0667 pmix_op_cbfunc_t cbfunc, void *cbdata); 0668 0669 /* Deregister an nspace and purge all objects relating to 0670 * it, including any client info from that nspace. This is 0671 * intended to support persistent PMIx servers by providing 0672 * an opportunity for the host RM to tell the PMIx server 0673 * library to release all memory for a completed job */ 0674 PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, 0675 pmix_op_cbfunc_t cbfunc, void *cbdata); 0676 0677 /* Register a client process with the PMIx server library. The 0678 * expected user ID and group ID of the child process helps the 0679 * server library to properly authenticate clients as they connect 0680 * by requiring the two values to match. 0681 * 0682 * The host server can also, if it desires, provide an object 0683 * it wishes to be returned when a server function is called 0684 * that relates to a specific process. For example, the host 0685 * server may have an object that tracks the specific client. 0686 * Passing the object to the library allows the library to 0687 * return that object when the client calls "finalize", thus 0688 * allowing the host server to access the object without 0689 * performing a lookup. */ 0690 PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, 0691 uid_t uid, gid_t gid, 0692 void *server_object, 0693 pmix_op_cbfunc_t cbfunc, void *cbdata); 0694 0695 /* Deregister a client and purge all data relating to it. The 0696 * deregister_nspace API will automatically delete all client 0697 * info for that nspace - this API is therefore intended solely 0698 * for use in exception cases */ 0699 PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, 0700 pmix_op_cbfunc_t cbfunc, void *cbdata); 0701 0702 /* Setup the environment of a child process to be forked 0703 * by the host so it can correctly interact with the PMIx 0704 * server. The PMIx client needs some setup information 0705 * so it can properly connect back to the server. This function 0706 * will set appropriate environmental variables for this purpose. */ 0707 PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char ***env); 0708 0709 /* Define a callback function the PMIx server will use to return 0710 * direct modex requests to the host server. The PMIx server 0711 * will free the data blob upon return from the response fn */ 0712 typedef void (*pmix_dmodex_response_fn_t)(pmix_status_t status, 0713 char *data, size_t sz, 0714 void *cbdata); 0715 0716 /* Define a function by which the host server can request modex data 0717 * from the local PMIx server. This is used to support the direct modex 0718 * operation - i.e., where data is cached locally on each PMIx 0719 * server for its own local clients, and is obtained on-demand 0720 * for remote requests. Upon receiving a request from a remote 0721 * server, the host server will call this function to pass the 0722 * request into the PMIx server. The PMIx server will return a blob 0723 * (once it becomes available) via the cbfunc - the host 0724 * server shall send the blob back to the original requestor */ 0725 PMIX_EXPORT pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc, 0726 pmix_dmodex_response_fn_t cbfunc, 0727 void *cbdata); 0728 0729 /* define a callback function for the setup_application API. The returned info 0730 * array is owned by the PMIx server library and will be free'd when the 0731 * provided cbfunc is called. */ 0732 typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status, 0733 pmix_info_t info[], size_t ninfo, 0734 void *provided_cbdata, 0735 pmix_op_cbfunc_t cbfunc, void *cbdata); 0736 0737 /* Provide a function by which the resource manager can request 0738 * any application-specific environmental variables, resource 0739 * assignments, and/or other data prior to launch of an application. 0740 * For example, network libraries may opt to provide security 0741 * credentials for the application. This is defined as a non-blocking 0742 * operation in case network libraries need to perform some action 0743 * before responding. Any returned env will be distributed along 0744 * with the application */ 0745 PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const pmix_nspace_t nspace, 0746 pmix_info_t info[], size_t ninfo, 0747 pmix_setup_application_cbfunc_t cbfunc, void *cbdata); 0748 0749 /* Provide a function by which the local PMIx server can perform 0750 * any application-specific operations prior to spawning local 0751 * clients of a given application. For example, a network library 0752 * might need to setup the local driver for "instant on" addressing. 0753 * Data provided in the info array will be stored in the job-info 0754 * region for the nspace. Operations included in the info array 0755 * will be cached until the server calls PMIx_server_setup_fork, 0756 * thereby indicating that local clients of this nspace will exist. 0757 * Operations indicated by the provided data will only be executed 0758 * for the first local client - i.e., they will only be executed 0759 * once for a given nspace 0760 */ 0761 PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const pmix_nspace_t nspace, 0762 pmix_info_t info[], size_t ninfo, 0763 pmix_op_cbfunc_t cbfunc, void *cbdata); 0764 0765 /* Provide a function by which the host RM can pass forwarded IO 0766 * to the local PMIx server for distribution to its clients. The 0767 * PMIx server is responsible for determining which of its clients 0768 * have actually registered for the provided data 0769 * 0770 * Parameters include: 0771 * 0772 * source - the process that provided the data being forwarded 0773 * 0774 * channel - the IOF channel (stdin, stdout, etc.) 0775 * 0776 * bo - a byte object containing the data 0777 * 0778 * info - an optional array of metadata describing the data, including 0779 * attributes such as PMIX_IOF_COMPLETE to indicate that the 0780 * source channel has been closed 0781 * 0782 * ninfo - number of elements in the info array 0783 * 0784 * cbfunc - a callback function to be executed once the provided data 0785 * is no longer required. The host RM is required to retain 0786 * the byte object until the callback is executed, or a 0787 * non-success status is returned by the function 0788 * 0789 * cbdata - object pointer to be returned in the callback function 0790 */ 0791 PMIX_EXPORT pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, 0792 pmix_iof_channel_t channel, 0793 const pmix_byte_object_t *bo, 0794 const pmix_info_t info[], size_t ninfo, 0795 pmix_op_cbfunc_t cbfunc, void *cbdata); 0796 0797 /* Collect inventory of local resources. This is a non-blocking 0798 * API as it may involve somewhat lengthy operations to obtain 0799 * the requested information. Servers designated as "gateways" 0800 * and whose plugins support collection of infrastructure info 0801 * (e.g., switch and fabric topology, connectivity maps) shall 0802 * return that information - plugins on non-gateway servers 0803 * shall only return the node-local inventory. */ 0804 PMIX_EXPORT pmix_status_t PMIx_server_collect_inventory(pmix_info_t directives[], size_t ndirs, 0805 pmix_info_cbfunc_t cbfunc, void *cbdata); 0806 0807 /* Deliver collected inventory for archiving by the corresponding 0808 * plugins. Typically executed on a "gateway" associated with the 0809 * system scheduler to enable use of inventory information by the 0810 * the scheduling algorithm. May also be used on compute nodes to 0811 * store a broader picture of the system for access by applications, 0812 * if desired */ 0813 PMIX_EXPORT pmix_status_t PMIx_server_deliver_inventory(pmix_info_t info[], size_t ninfo, 0814 pmix_info_t directives[], size_t ndirs, 0815 pmix_op_cbfunc_t cbfunc, void *cbdata); 0816 0817 0818 /****** ATTRIBUTE REGISTRATION ******/ 0819 /** 0820 * This function is used by the host environment to register with its 0821 * server library the attributes it supports for each pmix_server_module_t 0822 * function. 0823 * 0824 * Parameters include: 0825 * 0826 * function - the string name of the server module function 0827 * (e.g., "register_events", "validate_credential", 0828 * or "allocate") whose attributes are being registered. 0829 * 0830 * attrs - NULL-terminated argv array of attributes supported 0831 * by the host environment for the specified function 0832 * 0833 */ 0834 PMIX_EXPORT pmix_status_t PMIx_Register_attributes(char *function, char *attrs[]); 0835 0836 /* Generate a PMIx locality string from a given cpuset. 0837 * Provide a function by which the host environment can generate a PMIx locality 0838 * string for inclusion in the call to PMIx_server_register_nspace . This function 0839 * shall only be called for local client processes, with the returned locality 0840 * included in the job-level information (via the PMIX_LOCALITY_STRING attribute) 0841 * provided to local clients. 0842 */ 0843 PMIX_EXPORT pmix_status_t PMIx_server_generate_locality_string(const pmix_cpuset_t *cpuset, 0844 char **locality); 0845 0846 /* Generate a PMIx string representation of the provided cpuset. 0847 * Provide a function by which the host environment can generate a string 0848 * representation of the cpuset bitmap for inclusion in the call to 0849 * PMIx_server_register_nspace . This function shall only be called for local 0850 * client processes, with the returned string included in the job-level information 0851 * (via the PMIX_CPUSET attribute) provided to local clients. 0852 */ 0853 PMIX_EXPORT pmix_status_t PMIx_server_generate_cpuset_string(const pmix_cpuset_t *cpuset, 0854 char **cpuset_string); 0855 0856 /* Define a process set 0857 * Provide a function by which the host environment can define a new process set. 0858 */ 0859 PMIX_EXPORT pmix_status_t PMIx_server_define_process_set(const pmix_proc_t *members, 0860 size_t nmembers, const char *pset_name); 0861 0862 /* Delete a process set 0863 * Provide a function by which the host environment can delete a new process set. 0864 */ 0865 PMIX_EXPORT pmix_status_t PMIx_server_delete_process_set(char *pset_name); 0866 0867 0868 /* Register non-namespace related information with the local PMIx server library. 0869 */ 0870 PMIX_EXPORT pmix_status_t PMIx_server_register_resources(pmix_info_t info[], size_t ninfo, 0871 pmix_op_cbfunc_t cbfunc, 0872 void *cbdata); 0873 0874 /* Remove specified non-namespace related information from the local PMIx server library. 0875 */ 0876 PMIX_EXPORT pmix_status_t PMIx_server_deregister_resources(pmix_info_t info[], size_t ninfo, 0877 pmix_op_cbfunc_t cbfunc, 0878 void *cbdata); 0879 0880 #if defined(c_plusplus) || defined(__cplusplus) 0881 } 0882 #endif 0883 0884 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |