|
||||
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) 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_TOOL_API_H 0061 #define PMIx_TOOL_API_H 0062 0063 /* provide access to the rest of the client functions */ 0064 #include <pmix.h> 0065 #include <pmix_server.h> 0066 0067 #if defined(c_plusplus) || defined(__cplusplus) 0068 extern "C" { 0069 #endif 0070 0071 /**** TOOL INIT/FINALIZE FUNCTIONS ****/ 0072 0073 /* Initialize the PMIx tool, returning the process identifier assigned 0074 * to this tool in the provided pmix_proc_t struct. 0075 * 0076 * When called the PMIx tool library will check for the required connection 0077 * information of the local PMIx server and will establish the connection. 0078 * If the information is not found, or the server connection fails, then 0079 * an appropriate error constant will be returned. 0080 * 0081 * If successful, the function will return PMIX_SUCCESS and will fill the 0082 * provided structure with the server-assigned namespace and rank of the tool. 0083 * 0084 * Note that the PMIx tool library is referenced counted, and so multiple 0085 * calls to PMIx_tool_init are allowed. Thus, one way to obtain the namespace and 0086 * rank of the process is to simply call PMIx_tool_init with a non-NULL parameter. 0087 * 0088 * The info array is used to pass user requests pertaining to the init 0089 * and subsequent operations. Passing a _NULL_ value for the array pointer 0090 * is supported if no directives are desired. 0091 */ 0092 PMIX_EXPORT pmix_status_t PMIx_tool_init(pmix_proc_t *proc, 0093 pmix_info_t info[], size_t ninfo); 0094 0095 /* Provide an entry point by which a tool can provide a server function 0096 * pointer module. 0097 */ 0098 PMIX_EXPORT pmix_status_t PMIx_tool_set_server_module(pmix_server_module_t *module); 0099 0100 /* Finalize the PMIx tool library, closing the connection to the local server. 0101 * An error code will be returned if, for some reason, the connection 0102 * cannot be closed. 0103 * 0104 * The info array is used to pass user requests regarding the finalize 0105 * operation. */ 0106 PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void); 0107 0108 /* Check if the tool is connected to a PMIx server */ 0109 PMIX_EXPORT bool PMIx_tool_is_connected(void); 0110 0111 /* Establish a connection to a PMIx server. The target server can 0112 * be given as: 0113 * 0114 * - PMIX_CONNECT_TO_SYSTEM: connect solely to the system server 0115 * 0116 * - PMIX_CONNECT_SYSTEM_FIRST: a request to use the system server first, 0117 * if existing, and then look for the server specified in a different 0118 * attribute 0119 * 0120 * - PMIX_SERVER_URI: connect to the server at the given URI 0121 * 0122 * - PMIX_SERVER_NSPACE: connect to the server of a given nspace 0123 * 0124 * - PMIX_SERVER_PIDINFO: connect to a server embedded in the process with 0125 * the given pid 0126 * 0127 * Passing a _NULL_ value for the info array pointer is not allowed and will 0128 * result in return of an error. 0129 * 0130 * NOTE: PMIx does not currently support on-the-fly changes to the tool's 0131 * identifier. Thus, the new server must be under the same nspace manager 0132 * (e.g., host RM) as the prior server so that the original nspace remains 0133 * a unique assignment. The proc parameter is included here for obsolence 0134 * protection in case this constraint is someday removed. Meantime, the 0135 * proc parameter will be filled with the tool's existing nspace/rank, and 0136 * the caller is welcome to pass _NULL_ in that location 0137 */ 0138 /* REPLACES CONNECT_TO_SERVER, ADDING ABILITY TO RETURN 0139 * IDENTIFIER OF SERVER TO WHICH TOOL ATTACHED 0140 */ 0141 PMIX_EXPORT pmix_status_t PMIx_tool_attach_to_server(pmix_proc_t *myproc, pmix_proc_t *server, 0142 pmix_info_t info[], size_t ninfo); 0143 0144 0145 /* Disconnect the PMIx tool from the specified server connection while 0146 * leaving the tool library initialized. 0147 * 0148 * server - Process identifier of the server from which the tool is 0149 * to be disconnected 0150 * 0151 * Returns PMIX_SUCCESS or a PMIx error constant 0152 */ 0153 PMIX_EXPORT pmix_status_t PMIx_tool_disconnect(const pmix_proc_t *server); 0154 0155 0156 /* Get an array containing the pmix_proc_t process identifiers of all 0157 * servers to which the tool is currently connected. 0158 * 0159 * servers - Address where the pointer to an array of pmix_proc_t 0160 * structures shall be returned 0161 * 0162 * nservers - Address where the number of elements in servers 0163 * shall be returned 0164 * 0165 * Returns PMIX_SUCCESS or a PMIx error constant 0166 */ 0167 PMIX_EXPORT pmix_status_t PMIx_tool_get_servers(pmix_proc_t *servers[], size_t *nservers); 0168 0169 0170 /* Designate a server as the tool’s primary server. 0171 * 0172 * server - Process identifier of the target server 0173 * 0174 * Returns PMIX_SUCCESS or a PMIx error constant 0175 */ 0176 PMIX_EXPORT pmix_status_t PMIx_tool_set_server(const pmix_proc_t *server, 0177 pmix_info_t info[], size_t ninfo); 0178 0179 0180 /* Define a callback function for delivering forwarded IO to a process 0181 * This function will be called whenever data becomes available, or a 0182 * specified buffering size and/or time has been met. The function 0183 * will be passed the following values: 0184 * 0185 * iofhdlr - the returned registration number of the handler being invoked. 0186 * This is required when deregistering the handler. 0187 * 0188 * channel - a bitmask identifying the channel the data arrived on 0189 * 0190 * source - the nspace/rank of the process that generated the data 0191 * 0192 * payload - pointer to a PMIx byte object containing the data. Note that 0193 * multiple strings may be included, and that the data may 0194 * _not_ be NULL terminated 0195 * 0196 * info - an optional array of info provided by the source containing 0197 * metadata about the payload. This could include PMIX_IOF_COMPLETE 0198 * 0199 * ninfo - number of elements in the optional info array 0200 */ 0201 typedef void (*pmix_iof_cbfunc_t)(size_t iofhdlr, pmix_iof_channel_t channel, 0202 pmix_proc_t *source, pmix_byte_object_t *payload, 0203 pmix_info_t info[], size_t ninfo); 0204 0205 0206 /* Register to receive output forwarded from a remote process. 0207 * 0208 * procs - array of identifiers for sources whose IO is being 0209 * requested. Wildcard rank indicates that all procs 0210 * in the specified nspace are included in the request 0211 * 0212 * nprocs - number of identifiers in the procs array 0213 * 0214 * directives - optional array of attributes to control the 0215 * behavior of the request. For example, this 0216 * might include directives on buffering IO 0217 * before delivery, and/or directives to include 0218 * or exclude any backlogged data 0219 * 0220 * ndirs - number of elements in the directives array 0221 * 0222 * channel - bitmask of IO channels included in the request. 0223 * NOTE: STDIN is not supported as it will always 0224 * be delivered to the stdin file descriptor 0225 * 0226 * cbfunc - function to be called when relevant IO is received. A 0227 * NULL indicates that the IO is to be written to stdout 0228 * or stderr as per the originating channel 0229 * 0230 * regcbfunc - since registration is async, this is the 0231 * function to be called when registration is 0232 * completed. The function itself will return 0233 * a non-success error if the registration cannot 0234 * be submitted - in this case, the regcbfunc 0235 * will _not_ be called. 0236 * If regcbfunc is NULL, then this will be treated 0237 * as a BLOCKING call - a positive return value 0238 * represents the reference ID for the request, 0239 * while negative values indicate the corresponding 0240 * error 0241 * 0242 * cbdata - pointer to object to be returned in regcbfunc 0243 */ 0244 PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs, 0245 const pmix_info_t directives[], size_t ndirs, 0246 pmix_iof_channel_t channel, pmix_iof_cbfunc_t cbfunc, 0247 pmix_hdlr_reg_cbfunc_t regcbfunc, void *regcbdata); 0248 0249 /* Deregister from output forwarded from a remote process. 0250 * 0251 * iofhdlr - the registration number returned from the 0252 * call to PMIx_IOF_pull 0253 * 0254 * directives - optional array of attributes to control the 0255 * behavior of the request. For example, this 0256 * might include directives regarding what to 0257 * do with any data currently in the IO buffer 0258 * for this process 0259 * 0260 * cbfunc - function to be called when deregistration has 0261 * been completed. Note that any IO to be flushed 0262 * may continue to be received after deregistration 0263 * has completed. If cbfunc is NULL, then this is 0264 * treated as a BLOCKING call and the result of 0265 * the operation will be provided in the returned status 0266 * 0267 * cbdata - pointer to object to be returned in cbfunc 0268 */ 0269 PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, 0270 const pmix_info_t directives[], size_t ndirs, 0271 pmix_op_cbfunc_t cbfunc, void *cbdata); 0272 0273 /* Push data collected locally (typically from stdin) to 0274 * stdin of target recipients. 0275 * 0276 * targets - array of process identifiers to which the data is to be delivered. Note 0277 * that a WILDCARD rank indicates that all procs in the given nspace are 0278 * to receive a copy of the data 0279 * 0280 * ntargets - number of procs in the targets array 0281 * 0282 * directives - optional array of attributes to control the 0283 * behavior of the request. For example, this 0284 * might include directives on buffering IO 0285 * before delivery, and/or directives to include 0286 * or exclude any backlogged data 0287 * 0288 * ndirs - number of elements in the directives array 0289 * 0290 * bo - pointer to a byte object containing the stdin data 0291 * 0292 * cbfunc - callback function when the data has been forwarded. If 0293 * cbfunc is NULL, then this is treated as a BLOCKING call 0294 * and the result of the operation will be provided in the 0295 * returned status 0296 * 0297 * cbdata - object to be returned in cbfunc 0298 */ 0299 PMIX_EXPORT pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, 0300 pmix_byte_object_t *bo, 0301 const pmix_info_t directives[], size_t ndirs, 0302 pmix_op_cbfunc_t cbfunc, void *cbdata); 0303 0304 #if defined(c_plusplus) || defined(__cplusplus) 0305 } 0306 #endif 0307 0308 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |