Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:55

0001 /*
0002  * Copyright (c) 2013-2020 Intel, Inc.  All rights reserved.
0003  * Copyright (c) 2016      Research Organization for Information Science
0004  *                         and Technology (RIST). All rights reserved.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions are
0008  * met:
0009  *
0010  * - Redistributions of source code must retain the above copyright
0011  *   notice, this list of conditions and the following disclaimer.
0012  *
0013  * - Redistributions in binary form must reproduce the above copyright
0014  *   notice, this list of conditions and the following disclaimer listed
0015  *   in this license in the documentation and/or other materials
0016  *   provided with the distribution.
0017  *
0018  * - Neither the name of the copyright holders nor the names of its
0019  *   contributors may be used to endorse or promote products derived from
0020  *   this software without specific prior written permission.
0021  *
0022  * The copyright holders provide no reassurances that the source code
0023  * provided does not infringe any patent, copyright, or any other
0024  * intellectual property rights of third parties.  The copyright holders
0025  * disclaim any liability to any recipient for claims brought against
0026  * recipient by any third party for infringement of that parties
0027  * intellectual property rights.
0028  *
0029  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0030  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0031  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0032  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0033  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0034  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0035  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0036  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0037  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0038  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0039  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0040  *
0041  * Copyright (c) 2021-2023 Nanook Consulting.  All rights reserved.
0042  * $COPYRIGHT$
0043  *
0044  * Additional copyrights may follow
0045  *
0046  * $HEADER$
0047  */
0048 
0049 #ifndef PMIx_H
0050 #define PMIx_H
0051 
0052 /* Structure and constant definitions */
0053 #include <pmix_common.h>
0054 
0055 #if defined(c_plusplus) || defined(__cplusplus)
0056 extern "C" {
0057 #endif
0058 
0059 /****    PMIX API    ****/
0060 
0061 /* Initialize the PMIx client, returning the process identifier assigned
0062  * to this client's application in the provided pmix_proc_t struct.
0063  * Passing a parameter of _NULL_ for this parameter is allowed if the user
0064  * wishes solely to initialize the PMIx system and does not require
0065  * return of the identifier at that time.
0066  *
0067  * When called the PMIx client will check for the required connection
0068  * information of the local PMIx server and will establish the connection.
0069  * If the information is not found, or the server connection fails, then
0070  * an appropriate error constant will be returned.
0071  *
0072  * If successful, the function will return PMIX_SUCCESS and will fill the
0073  * provided structure with the server-assigned namespace and rank of the
0074  * process within the application.
0075  *
0076  * Note that the PMIx client library is referenced counted, and so multiple
0077  * calls to PMIx_Init are allowed. Thus, one way to obtain the namespace and
0078  * rank of the process is to simply call PMIx_Init with a non-NULL parameter.
0079  *
0080  * The info array is used to pass user requests pertaining to the init
0081  * and subsequent operations. Pass a _NULL_ value for the array pointer
0082  * is supported if no directives are desired.
0083  */
0084 PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
0085                                     pmix_info_t info[], size_t ninfo);
0086 
0087 /* Finalize the PMIx client, closing the connection to the local server.
0088  * An error code will be returned if, for some reason, the connection
0089  * cannot be closed.
0090  *
0091  * The info array is used to pass user requests regarding the finalize
0092  * operation. This can include:
0093  *
0094  * (a) PMIX_EMBED_BARRIER - By default, PMIx_Finalize does not include an
0095  * internal barrier operation. This attribute directs PMIx_Finalize to
0096  * execute a barrier as part of the finalize operation.
0097  */
0098 PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo);
0099 
0100 
0101 /* Returns _true_ if the PMIx client has been successfully initialized,
0102  * returns _false_ otherwise. Note that the function only reports the
0103  * internal state of the PMIx client - it does not verify an active
0104  * connection with the server, nor that the server is functional. */
0105 PMIX_EXPORT int PMIx_Initialized(void);
0106 
0107 
0108 /* Request that the provided array of procs be aborted, returning the
0109  * provided _status_ and printing the provided message. A _NULL_
0110  * for the proc array indicates that all processes in the caller's
0111  * nspace are to be aborted.
0112  *
0113  * The response to this request is somewhat dependent on the specific resource
0114  * manager and its configuration (e.g., some resource managers will
0115  * not abort the application if the provided _status_ is zero unless
0116  * specifically configured to do so), and thus lies outside the control
0117  * of PMIx itself. However, the client will inform the RM of
0118  * the request that the application be aborted, regardless of the
0119  * value of the provided _status_.
0120  *
0121  * Passing a _NULL_ msg parameter is allowed. Note that race conditions
0122  * caused by multiple processes calling PMIx_Abort are left to the
0123  * server implementation to resolve with regard to which status is
0124  * returned and what messages (if any) are printed. */
0125 PMIX_EXPORT pmix_status_t PMIx_Abort(int status, const char msg[],
0126                                      pmix_proc_t procs[], size_t nprocs);
0127 
0128 
0129 /* Push a value into the client's namespace. The client library will cache
0130  * the information locally until _PMIx_Commit_ is called. The provided scope
0131  * value is passed to the local PMIx server, which will distribute the data
0132  * as directed. */
0133 PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope,
0134                                    const char key[],
0135                                    pmix_value_t *val);
0136 
0137 
0138 /* Push all previously _PMIx_Put_ values to the local PMIx server.
0139  * This is an asynchronous operation - the library will immediately
0140  * return to the caller while the data is transmitted to the local
0141  * server in the background */
0142 PMIX_EXPORT pmix_status_t PMIx_Commit(void);
0143 
0144 
0145 /* Execute a blocking barrier across the processes identified in the
0146  * specified array. Passing a _NULL_ pointer as the _procs_ parameter
0147  * indicates that the barrier is to span all processes in the client's
0148  * namespace. Each provided pmix_proc_t struct can pass PMIX_RANK_WILDCARD to
0149  * indicate that all processes in the given namespace are
0150  * participating.
0151  *
0152  * The info array is used to pass user requests regarding the fence
0153  * operation. This can include:
0154  *
0155  * (a) PMIX_COLLECT_DATA - a boolean indicating whether or not the barrier
0156  *     operation is to return the _put_ data from all participating processes.
0157  *     A value of _false_ indicates that the callback is just used as a release
0158  *     and no data is to be returned at that time. A value of _true_ indicates
0159  *     that all _put_ data is to be collected by the barrier. Returned data is
0160  *     cached at the server to reduce memory footprint, and can be retrieved
0161  *     as needed by calls to PMIx_Get(nb).
0162  *
0163  *     Note that for scalability reasons, the default behavior for PMIx_Fence
0164  *     is to _not_ collect the data.
0165  *
0166  * (b) PMIX_COLLECTIVE_ALGO - a comma-delimited string indicating the algos
0167  *     to be used for executing the barrier, in priority order.
0168  *
0169  * (c) PMIX_COLLECTIVE_ALGO_REQD - instructs the host RM that it should return
0170  *     an error if none of the specified algos are available. Otherwise, the RM
0171  *     is to use one of the algos if possible, but is otherwise free to use any
0172  *     of its available methods to execute the operation.
0173  *
0174  * (d) PMIX_TIMEOUT - maximum time for the fence to execute before declaring
0175  *     an error. By default, the RM shall terminate the operation and notify participants
0176  *     if one or more of the indicated procs fails during the fence. However,
0177  *     the timeout parameter can help avoid "hangs" due to programming errors
0178  *     that prevent one or more procs from reaching the "fence".
0179  */
0180 PMIX_EXPORT pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs,
0181                                      const pmix_info_t info[], size_t ninfo);
0182 
0183 /* Non-blocking version of PMIx_Fence. Note that the function will return
0184  * an error if a _NULL_ callback function is given. */
0185 PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs,
0186                                         const pmix_info_t info[], size_t ninfo,
0187                                         pmix_op_cbfunc_t cbfunc, void *cbdata);
0188 
0189 
0190 /* Retrieve information for the specified _key_ as published by the process
0191  * identified in the given pmix_proc_t, returning a pointer to the value in the
0192  * given address.
0193  *
0194  * This is a blocking operation - the caller will block until
0195  * the specified data has been _PMIx_Put_ by the specified rank. The caller is
0196  * responsible for freeing all memory associated with the returned value when
0197  * no longer required.
0198  *
0199  * The info array is used to pass user requests regarding the get
0200  * operation. This can include:
0201  *
0202  * (a) PMIX_TIMEOUT - maximum time for the get to execute before declaring
0203  *     an error. The timeout parameter can help avoid "hangs" due to programming
0204  *     errors that prevent the target proc from ever exposing its data.
0205  */
0206 PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
0207                                    const pmix_info_t info[], size_t ninfo,
0208                                    pmix_value_t **val);
0209 
0210 /* A non-blocking operation version of PMIx_Get - the callback function will
0211  * be executed once the specified data has been _PMIx_Put_
0212  * by the identified process and retrieved by the local server. The info
0213  * array is used as described above for the blocking form of this call. */
0214 PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[],
0215                                       const pmix_info_t info[], size_t ninfo,
0216                                       pmix_value_cbfunc_t cbfunc, void *cbdata);
0217 
0218 
0219 /* Publish the data in the info array for lookup. By default,
0220  * the data will be published into the PMIX_SESSION range and
0221  * with PMIX_PERSIST_APP persistence. Changes to those values,
0222  * and any additional directives, can be included in the pmix_info_t
0223  * array.
0224  *
0225  * Note that the keys must be unique within the specified
0226  * data range or else an error will be returned (first published
0227  * wins). Attempts to access the data by procs outside of
0228  * the provided data range will be rejected.
0229  *
0230  * The persistence parameter instructs the server as to how long
0231  * the data is to be retained.
0232  *
0233  * The blocking form will block until the server confirms that the
0234  * data has been posted and is available. The non-blocking form will
0235  * return immediately, executing the callback when the server confirms
0236  * availability of the data.
0237  */
0238 PMIX_EXPORT pmix_status_t PMIx_Publish(const pmix_info_t info[], size_t ninfo);
0239 PMIX_EXPORT pmix_status_t PMIx_Publish_nb(const pmix_info_t info[], size_t ninfo,
0240                                           pmix_op_cbfunc_t cbfunc, void *cbdata);
0241 
0242 
0243 /* Lookup information published by this or another process. By default,
0244  * the search will be conducted across the PMIX_SESSION range. Changes
0245  * to the range, and any additional directives, can be provided
0246  * in the pmix_info_t array. Note that the search is also constrained
0247  * to only data published by the current user ID - i.e., the search
0248  * will not return data published by an application being executed
0249  * by another user. There currently is no option to override this
0250  * behavior - such an option may become available later via an
0251  * appropriate pmix_info_t directive.
0252  *
0253  * The "data" parameter consists of an array of pmix_pdata_t struct with the
0254  * keys specifying the requested information. Data will be returned
0255  * for each key in the associated info struct - any key that cannot
0256  * be found will return with a data type of "PMIX_UNDEF". The function
0257  * will return SUCCESS if _any_ values can be found, so the caller
0258  * must check each data element to ensure it was returned.
0259  *
0260  * The proc field in each pmix_pdata_t struct will contain the
0261  * nspace/rank of the process that published the data.
0262  *
0263  * Note: although this is a blocking function, it will _not_ wait
0264  * by default for the requested data to be published. Instead, it
0265  * will block for the time required by the server to lookup its current
0266  * data and return any found items. Thus, the caller is responsible for
0267  * ensuring that data is published prior to executing a lookup, or
0268  * for retrying until the requested data is found
0269  *
0270  * Optionally, the info array can be used to modify this behavior
0271  * by including:
0272  *
0273  * (a) PMIX_WAIT - wait for the requested data to be published. The
0274  *     server is to wait until all data has become available.
0275  *
0276  * (b) PMIX_TIMEOUT - max time to wait for data to become available.
0277  *
0278  */
0279 PMIX_EXPORT pmix_status_t PMIx_Lookup(pmix_pdata_t data[], size_t ndata,
0280                                       const pmix_info_t info[], size_t ninfo);
0281 
0282 /* Non-blocking form of the _PMIx_Lookup_ function. Data for
0283  * the provided NULL-terminated keys array will be returned
0284  * in the provided callback function. As above, the default
0285  * behavior is to _not_ wait for data to be published. The
0286  * info keys can be used to modify the behavior as previously
0287  * described */
0288 PMIX_EXPORT pmix_status_t PMIx_Lookup_nb(char **keys, const pmix_info_t info[], size_t ninfo,
0289                                          pmix_lookup_cbfunc_t cbfunc, void *cbdata);
0290 
0291 
0292 /* Unpublish data posted by this process using the given keys.
0293  * The function will block until the data has been removed by
0294  * the server. A value of _NULL_ for the keys parameter instructs
0295  * the server to remove _all_ data published by this process.
0296  *
0297  * By default, the range is assumed to be PMIX_SESSION. Changes
0298  * to the range, and any additional directives, can be provided
0299  * in the pmix_info_t array */
0300 PMIX_EXPORT pmix_status_t PMIx_Unpublish(char **keys,
0301                                          const pmix_info_t info[], size_t ninfo);
0302 
0303 /* Non-blocking form of the _PMIx_Unpublish_ function. The
0304  * callback function will be executed once the server confirms
0305  * removal of the specified data. */
0306 PMIX_EXPORT pmix_status_t PMIx_Unpublish_nb(char **keys,
0307                                             const pmix_info_t info[], size_t ninfo,
0308                                             pmix_op_cbfunc_t cbfunc, void *cbdata);
0309 
0310 
0311 /* Spawn a new job. The assigned namespace of the spawned applications
0312  * is returned in the nspace parameter - a _NULL_ value in that
0313  * location indicates that the caller doesn't wish to have the
0314  * namespace returned. The nspace array must be at least of size
0315  * PMIX_MAX_NSLEN+1. Behavior of individual resource managers
0316  * may differ, but it is expected that failure of any application
0317  * process to start will result in termination/cleanup of _all_
0318  * processes in the newly spawned job and return of an error
0319  * code to the caller.
0320  *
0321  * By default, the spawned processes will be PMIx "connected" to
0322  * the parent process upon successful launch (see PMIx_Connect
0323  * description for details). Note that this only means that the
0324  * parent process (a) will be given a copy of the  new job's
0325  * information so it can query job-level info without
0326  * incurring any communication penalties, and (b) will receive
0327  * notification of errors from process in the child job.
0328  *
0329  * Job-level directives can be specified in the job_info array. This
0330  * can include:
0331  *
0332  * (a) PMIX_NON_PMI - processes in the spawned job will
0333  *     not be calling PMIx_Init
0334  *
0335  * (b) PMIX_TIMEOUT - declare the spawn as having failed if the launched
0336  *     procs do not call PMIx_Init within the specified time
0337  *
0338  * (c) PMIX_NOTIFY_COMPLETION - notify the parent process when the
0339  *     child job terminates, either normally or with error
0340  */
0341 PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
0342                                      const pmix_app_t apps[], size_t napps,
0343                                      pmix_nspace_t nspace);
0344 
0345 
0346 /* Non-blocking form of the _PMIx_Spawn_ function. The callback
0347  * will be executed upon launch of the specified applications,
0348  * or upon failure to launch any of them. */
0349 PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t ninfo,
0350                                         const pmix_app_t apps[], size_t napps,
0351                                         pmix_spawn_cbfunc_t cbfunc, void *cbdata);
0352 
0353 /* Record the specified processes as "connected". Both blocking and non-blocking
0354  * versions are provided. This means that the resource manager should treat the
0355  * failure of any process in the specified group as a reportable event, and take
0356  * appropriate action. Note that different resource managers may respond to
0357  * failures in different manners.
0358  *
0359  * The callback function is to be called once all participating processes have
0360  * called connect. The server is required to return any job-level info for the
0361  * connecting processes that might not already have - i.e., if the connect
0362  * request involves procs from different nspaces, then each proc shall receive
0363  * the job-level info from those nspaces other than their own.
0364  *
0365  * Note: a process can only engage in _one_ connect operation involving the identical
0366  * set of processes at a time. However, a process _can_ be simultaneously engaged
0367  * in multiple connect operations, each involving a different set of processes
0368  *
0369  * As in the case of the fence operation, the info array can be used to pass
0370  * user-level directives regarding the algorithm to be used for the collective
0371  * operation involved in the "connect", timeout constraints, and other options
0372  * available from the host RM */
0373 PMIX_EXPORT pmix_status_t PMIx_Connect(const pmix_proc_t procs[], size_t nprocs,
0374                                        const pmix_info_t info[], size_t ninfo);
0375 
0376 PMIX_EXPORT pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t nprocs,
0377                                           const pmix_info_t info[], size_t ninfo,
0378                                           pmix_op_cbfunc_t cbfunc, void *cbdata);
0379 
0380 /* Disconnect a previously connected set of processes. An error will be returned
0381  * if the specified set of procs was not previously "connected". As above, a process
0382  * may be involved in multiple simultaneous disconnect operations. However, a process
0383  * is not allowed to reconnect to a set of procs that has not fully completed
0384  * disconnect - i.e., you have to fully disconnect before you can reconnect to the
0385  * _same_ group of processes. The info array is used as above. */
0386 PMIX_EXPORT pmix_status_t PMIx_Disconnect(const pmix_proc_t procs[], size_t nprocs,
0387                                           const pmix_info_t info[], size_t ninfo);
0388 
0389 PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t nprocs,
0390                                              const pmix_info_t info[], size_t ninfo,
0391                                              pmix_op_cbfunc_t cbfunc, void *cbdata);
0392 
0393 /* Given a node name, return an array of processes within the specified nspace
0394  * on that node. If the nspace is NULL, then all processes on the node will
0395  * be returned. If the specified node does not currently host any processes,
0396  * then the returned array will be NULL, and nprocs=0. The caller is responsible
0397  * for releasing the array when done with it - the PMIX_PROC_FREE macro is
0398  * provided for this purpose.
0399  */
0400 PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename,
0401                                              const pmix_nspace_t nspace,
0402                                              pmix_proc_t **procs, size_t *nprocs);
0403 
0404 
0405 /* Given an nspace, return the list of nodes hosting processes within
0406  * that nspace. The returned string will contain a comma-delimited list
0407  * of nodenames. The caller is responsible for releasing the string
0408  * when done with it */
0409 PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist);
0410 
0411 /* Query information about the system in general - can include
0412  * a list of active nspaces, network topology, etc. Also can be
0413  * used to query node-specific info such as the list of peers
0414  * executing on a given node. We assume that the host RM will
0415  * exercise appropriate access control on the information.
0416  *
0417  * The following return status codes are provided in the callback:
0418  *
0419  * PMIX_SUCCESS - all data has been returned
0420  * PMIX_ERR_NOT_FOUND - none of the requested data was available
0421  * PMIX_ERR_PARTIAL_SUCCESS - some of the data has been returned
0422  * PMIX_ERR_NOT_SUPPORTED - the host RM does not support this function
0423  */
0424 PMIX_EXPORT pmix_status_t PMIx_Query_info(pmix_query_t queries[], size_t nqueries,
0425                                           pmix_info_t **results, size_t *nresults);
0426 
0427 PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries,
0428                                              pmix_info_cbfunc_t cbfunc, void *cbdata);
0429 
0430 /* Log data to a central data service/store, subject to the
0431  * services offered by the host resource manager. The data to
0432  * be logged is provided in the data array. The (optional) directives
0433  * can be used to request specific storage options and direct
0434  * the choice of storage option.
0435  *
0436  * The callback function will be executed when the log operation
0437  * has been completed. The data array must be maintained until
0438  * the callback is provided
0439  */
0440 PMIX_EXPORT pmix_status_t PMIx_Log(const pmix_info_t data[], size_t ndata,
0441                                    const pmix_info_t directives[], size_t ndirs);
0442 
0443 PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata,
0444                                       const pmix_info_t directives[], size_t ndirs,
0445                                       pmix_op_cbfunc_t cbfunc, void *cbdata);
0446 
0447 /* Request an allocation operation from the host scheduler.
0448  * Several broad categories are envisioned, including the ability to:
0449  *
0450  * - request allocation of additional resources, including memory,
0451  *   bandwidth, and compute. This should be accomplished in a
0452  *   non-blocking manner so that the application can continue to
0453  *   progress while waiting for resources to become available. Note
0454  *   that the new allocation will be disjoint from (i.e., not
0455  *   affiliated with) the allocation of the requestor - thus the
0456  *   termination of one allocation will not impact the other.
0457  *
0458  * - extend the reservation on currently allocated resources, subject
0459  *   to scheduling availability and priorities. This includes extending
0460  *   the time limit on current resources, and/or requesting additional
0461  *   resources be allocated to the requesting job. Any additional
0462  *   allocated resources will be considered as part of the current
0463  *   allocation, and thus will be released at the same time.
0464  *
0465  * - release currently allocated resources that are no longer required.
0466  *   This is intended to support partial release of resources since all
0467  *   resources are normally released upon termination of the job. The
0468  *   identified use-cases include resource variations across discrete steps
0469  *   of a workflow, as well as applications that spawn sub-jobs and/or
0470  *   dynamically grow/shrink over time
0471  *
0472  * - "lend" resources back to the scheduler with an expectation of getting
0473  *   them back at some later time in the job. This can be a proactive
0474  *   operation (e.g., to save on computing costs when resources are
0475  *   temporarily not required), or in response to scheduler requests in
0476  *   lieue of preemption. A corresponding ability to "reacquire" resources
0477  *   previously released is included.
0478  */
0479 PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directive,
0480                                                   pmix_info_t *info, size_t ninfo,
0481                                                   pmix_info_t **results, size_t *nresults);
0482 
0483 PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t directive,
0484                                                      pmix_info_t *info, size_t ninfo,
0485                                                      pmix_info_cbfunc_t cbfunc, void *cbdata);
0486 
0487 /* Request a session control action. The sessionID identifies the session
0488  * to which the specified control action is to be applied. A NULL
0489  * value can be used to indicate all sessions under the caller's control.
0490  *
0491  * The directives are provided as pmix_info_t structs in the directives
0492  * array. The callback function provides a status to indicate whether or
0493  * not the request was granted, and to provide some information as to the
0494  * reason for any denial in the pmix_info_cbfunc_t' array of pmix_info_t
0495  * structures. If non-NULL, then the specified release_fn must be called
0496  * when the callback function completes - this will be used to release any
0497  * provided pmix_info_t array.
0498 
0499  * Passing NULL as the cbfunc to this call indicates that it shall be treated
0500  * as a blocking operation, with the return status indicative of the overall
0501  * operation's completion.
0502  */
0503 PMIX_EXPORT pmix_status_t PMIx_Session_control(uint32_t sessionID,
0504                                                const pmix_info_t directives[], size_t ndirs,
0505                                                pmix_info_cbfunc_t cbfunc, void *cbdata);
0506 
0507 /* Request a job control action. The targets array identifies the
0508  * processes to which the requested job control action is to be applied.
0509  * A NULL value can be used to indicate all processes in the caller's
0510  * nspace. The use of PMIX_RANK_WILDARD can also be used to indicate
0511  * that all processes in the given nspace are to be included.
0512  *
0513  * The directives are provided as pmix_info_t structs in the directives
0514  * array. The callback function provides a status to indicate whether or
0515  * not the request was granted, and to provide some information as to
0516  * the reason for any denial in the pmix_info_cbfunc_t array of pmix_info_t
0517  * structures. If non-NULL, then the specified release_fn must be called
0518  * when the callback function completes - this will be used to release
0519  * any provided pmix_info_t array.
0520  */
0521 PMIX_EXPORT pmix_status_t PMIx_Job_control(const pmix_proc_t targets[], size_t ntargets,
0522                                            const pmix_info_t directives[], size_t ndirs,
0523                                            pmix_info_t **results, size_t *nresults);
0524 
0525 PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_t ntargets,
0526                                               const pmix_info_t directives[], size_t ndirs,
0527                                               pmix_info_cbfunc_t cbfunc, void *cbdata);
0528 
0529 /* Request that something be monitored - e.g., that the server monitor
0530  * this process for periodic heartbeats as an indication that the process
0531  * has not become "wedged". When a monitor detects the specified alarm
0532  * condition, it will generate an event notification using the provided
0533  * error code and passing along any available relevant information. It is
0534  * up to the caller to register a corresponding event handler.
0535  *
0536  * Params:
0537  *
0538  * monitor: attribute indicating the type of monitor being requested - e.g.,
0539  *          PMIX_MONITOR_FILE to indicate that the requestor is asking that
0540  *          a file be monitored.
0541  *
0542  * error: the status code to be used when generating an event notification
0543  *        alerting that the monitor has been triggered. The range of the
0544  *        notification defaults to PMIX_RANGE_NAMESPACE - this can be
0545  *        changed by providing a PMIX_RANGE directive
0546  *
0547  * directives: characterize the monitoring request (e.g., monitor file size)
0548  *             and frequency of checking to be done
0549  *
0550  * cbfunc: provides a status to indicate whether or not the request was granted,
0551  *         and to provide some information as to the reason for any denial in
0552  *         the pmix_info_cbfunc_t array of pmix_info_t structures.
0553  *
0554  * Note: a process can send a heartbeat to the server using the PMIx_Heartbeat
0555  * macro provided below*/
0556 PMIX_EXPORT pmix_status_t PMIx_Process_monitor(const pmix_info_t *monitor, pmix_status_t error,
0557                                                const pmix_info_t directives[], size_t ndirs,
0558                                                pmix_info_t **results, size_t *nresults);
0559 
0560 PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pmix_status_t error,
0561                                                   const pmix_info_t directives[], size_t ndirs,
0562                                                   pmix_info_cbfunc_t cbfunc, void *cbdata);
0563 
0564 /* define a special macro to simplify sending of a heartbeat */
0565 #define PMIx_Heartbeat()                                                    \
0566     do {                                                                    \
0567         pmix_info_t _in;                                                    \
0568         PMIX_INFO_CONSTRUCT(&_in);                                          \
0569         PMIX_INFO_LOAD(&_in, PMIX_SEND_HEARTBEAT, NULL, PMIX_POINTER);      \
0570         PMIx_Process_monitor_nb(&_in, PMIX_SUCCESS, NULL, 0, NULL, NULL);   \
0571         PMIX_INFO_DESTRUCT(&_in);                                           \
0572     } while(0)
0573 
0574 /* Request a credential from the PMIx server/SMS.
0575  * Input values include:
0576  *
0577  * info - an array of pmix_info_t structures containing any directives the
0578  *        caller may wish to pass. Typical usage might include:
0579  *            PMIX_TIMEOUT - how long to wait (in seconds) for a credential
0580  *                           before timing out and returning an error
0581  *            PMIX_CRED_TYPE - a prioritized, comma-delimited list of desired
0582  *                             credential types for use in environments where
0583  *                             multiple authentication mechanisms may be
0584  *                             available
0585  *
0586  * ninfo - number of elements in the info array
0587  *
0588  * cbfunc - the pmix_credential_cbfunc_t function to be called upon completion
0589  *          of the request
0590  *
0591  * cbdata - pointer to an object to be returned when cbfunc is called
0592  *
0593  * Returned values:
0594  * PMIX_SUCCESS - indicates that the request has been successfully communicated to
0595  *                the local PMIx server. The response will be coming in the provided
0596  *                callback function.
0597  *
0598  * Any other value indicates an appropriate error condition. The callback function
0599  * will _not_ be called in such cases.
0600  */
0601 PMIX_EXPORT pmix_status_t PMIx_Get_credential(const pmix_info_t info[], size_t ninfo,
0602                                               pmix_byte_object_t *credential);
0603 
0604 PMIX_EXPORT pmix_status_t PMIx_Get_credential_nb(const pmix_info_t info[], size_t ninfo,
0605                                                  pmix_credential_cbfunc_t cbfunc, void *cbdata);
0606 
0607 /* Request validation of a credential by the PMIx server/SMS
0608  * Input values include:
0609  *
0610  * cred - pointer to a pmix_byte_object_t containing the credential
0611  *
0612  * info - an array of pmix_info_t structures containing any directives the
0613  *        caller may wish to pass. Typical usage might include:
0614  *            PMIX_TIMEOUT - how long to wait (in seconds) for validation
0615  *                           before timing out and returning an error
0616  *            PMIX_USERID - the expected effective userid of the credential
0617  *                          to be validated
0618  *            PMIX_GROUPID - the expected effective group id of the credential
0619  *                          to be validated
0620  *
0621  * ninfo - number of elements in the info array
0622  *
0623  * cbfunc - the pmix_validation_cbfunc_t function to be called upon completion
0624  *          of the request
0625  *
0626  * cbdata - pointer to an object to be returned when cbfunc is called
0627  *
0628  * Returned values:
0629  * PMIX_SUCCESS - indicates that the request has been successfully communicated to
0630  *                the local PMIx server. The response will be coming in the provided
0631  *                callback function.
0632  *
0633  * Any other value indicates an appropriate error condition. The callback function
0634  * will _not_ be called in such cases.
0635  */
0636 PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cred,
0637                                                    const pmix_info_t info[], size_t ninfo,
0638                                                    pmix_info_t **results, size_t *nresults);
0639 
0640 PMIX_EXPORT pmix_status_t PMIx_Validate_credential_nb(const pmix_byte_object_t *cred,
0641                                                       const pmix_info_t info[], size_t ninfo,
0642                                                       pmix_validation_cbfunc_t cbfunc, void *cbdata);
0643 
0644 
0645 /* Construct a new group composed of the specified processes and identified with
0646  * the provided group identifier. Both blocking and non-blocking versions
0647  * are provided (the callback function for the non-blocking form will be called
0648  * once all specified processes have joined the group). The group identifier is
0649  * a user-defined, NULL-terminated character array of length less than or equal
0650  * to PMIX_MAX_NSLEN. Only characters accepted by standard string comparison
0651  * functions (e.g., strncmp) are supported.
0652  *
0653  * Processes may engage in multiple simultaneous group construct operations as
0654  * desired so long as each is provided with a unique group ID. The info array
0655  * can be used to pass user-level directives regarding timeout constraints and
0656  * other options available from the PMIx server.
0657  *
0658  * The construct leader (if PMIX_GROUP_LEADER is provided) or all participants
0659  * will receive events (if registered for the PMIX_GROUP_MEMBER_FAILED event)
0660  * whenever a process fails or terminates prior to calling
0661  * PMIx_Group_construct(_nb) – the events will contain the identifier of the
0662  * process that failed to join plus any other information that the resource
0663  * manager provided. This provides an opportunity for the leader to react to
0664  * the event – e.g., to invite an alternative member to the group or to decide
0665  * to proceed with a smaller group. The decision to proceed with a smaller group
0666  * is communicated to the PMIx library in the results array at the end of the
0667  * event handler. This allows PMIx to properly adjust accounting for procedure
0668  * completion. When construct is complete, the participating PMIx servers will
0669  * be alerted to any change in participants and each group member will (if
0670  * registered) receive a PMIX_GROUP_MEMBERSHIP_UPDATE event updating the group
0671  * membership.
0672  *
0673  * Processes in a group under construction are not allowed to leave the group
0674  * until group construction is complete. Upon completion of the construct
0675  * procedure, each group member will have access to the job-level information
0676  * of all nspaces represented in the group and the contact information for
0677  * every group member.
0678  *
0679  * Failure of the leader at any time will cause a PMIX_GROUP_LEADER_FAILED event
0680  * to be delivered to all participants so they can optionally declare a new leader.
0681  * A new leader is identified by providing the PMIX_GROUP_LEADER attribute in
0682  * the results array in the return of the event handler. Only one process is
0683  * allowed to return that attribute, declaring itself as the new leader. Results
0684  * of the leader selection will be communicated to all participants via a
0685  * PMIX_GROUP_LEADER_SELECTED event identifying the new leader. If no leader
0686  * was selected, then the status code provided in the event handler will provide
0687  * an error value so the participants can take appropriate action.
0688  *
0689  * Any participant that returns PMIX_GROUP_CONSTRUCT_ABORT from the leader failed
0690  * event handler will cause the construct process to abort. Those processes
0691  * engaged in the blocking construct will return from the call with the
0692  * PMIX_GROUP_CONSTRUCT_ABORT status. Non-blocking participants will have
0693  * their callback function executed with that status.
0694  *
0695  * Some relevant attributes for this operation:
0696  *    PMIX_GROUP_LEADER - declare this process to be the leader of the construction
0697  *                        procedure. If a process provides this attribute, then
0698  *                        failure notification for any participating process will
0699  *                        go only to that one process. In the absence of a
0700  *                        declared leader, failure events go to all participants.
0701  *    PMIX_GROUP_OPTIONAL - participation is optional - do not return an error if
0702  *                          any of the specified processes terminate
0703  *                          without having joined (default=false)
0704  *    PMIX_GROUP_NOTIFY_TERMINATION - notify remaining members when another member
0705  *                                    terminates without first leaving the
0706  *                                    group (default=false)
0707  *    PMIX_GROUP_ASSIGN_CONTEXT_ID - requests that the RM assign a unique context
0708  *                                   ID (size_t) to the group. The value is returned
0709  *                                   in the PMIX_GROUP_CONSTRUCT_COMPLETE event
0710  *    PMIX_TIMEOUT - return an error if the group doesn't assemble within the
0711  *                   specified number of seconds. Targets the scenario where a
0712  *                   process fails to call PMIx_Group_connect due to hanging
0713  *
0714  */
0715 PMIX_EXPORT pmix_status_t PMIx_Group_construct(const char grp[],
0716                                                const pmix_proc_t procs[], size_t nprocs,
0717                                                const pmix_info_t directives[], size_t ndirs,
0718                                                pmix_info_t **results, size_t *nresults);
0719 
0720 PMIX_EXPORT pmix_status_t PMIx_Group_construct_nb(const char grp[],
0721                                                   const pmix_proc_t procs[], size_t nprocs,
0722                                                   const pmix_info_t info[], size_t ninfo,
0723                                                   pmix_info_cbfunc_t cbfunc, void *cbdata);
0724 
0725 /* Explicitly invite specified processes to join a group.
0726  *
0727  * Each invited process will be notified of the invitation via the PMIX_GROUP_INVITED
0728  * event. The processes being invited must have registered for the PMIX_GROUP_INVITED
0729  * event in order to be notified of the invitation. When ready to respond, each invited
0730  * process provides a response using the appropriate form of PMIx_Group_join. This will
0731  * notify the inviting process that the invitation was either accepted (via the
0732  * PMIX_GROUP_INVITE_ACCEPTED event) or declined (via the PMIX_GROUP_INVITE_DECLINED event).
0733  * The inviting process will also receive PMIX_GROUP_MEMBER_FAILED events whenever a
0734  * process fails or terminates prior to responding to the invitation.
0735  *
0736  * Upon accepting the invitation, both the inviting and invited process will receive
0737  * access to the job-level information of each other’s nspaces and the contact
0738  * information of the other process.
0739  *
0740  * Some relevant attributes for this operation:
0741  *    PMIX_GROUP_ASSIGN_CONTEXT_ID - requests that the RM assign a unique context
0742  *                                   ID (size_t) to the group. The value is returned
0743  *                                   in the PMIX_GROUP_CONSTRUCT_COMPLETE event
0744  *    PMIX_TIMEOUT (int): return an error if the group doesn’t assemble within the
0745  *                        specified number of seconds. Targets the scenario where a
0746  *                        process fails to call PMIx_Group_connect due to hanging
0747  *
0748  * The inviting process is automatically considered the leader of the asynchronous
0749  * group construction procedure and will receive all failure or termination events
0750  * for invited members prior to completion. The inviting process is required to
0751  * provide a PMIX_GROUP_CONSTRUCT_COMPLETE event once the group has been fully
0752  * assembled – this event will be distributed to all participants along with the
0753  * final membership.
0754  *
0755  * Failure of the leader at any time will cause a PMIX_GROUP_LEADER_FAILED event
0756  * to be delivered to all participants so they can optionally declare a new leader.
0757  * A new leader is identified by providing the PMIX_GROUP_LEADER attribute in
0758  * the results array in the return of the event handler. Only one process is
0759  * allowed to return that attribute, declaring itself as the new leader. Results
0760  * of the leader selection will be communicated to all participants via a
0761  * PMIX_GROUP_LEADER_SELECTED event identifying the new leader. If no leader
0762  * was selected, then the status code provided in the event handler will provide
0763  * an error value so the participants can take appropriate action.
0764  *
0765  * Any participant that returns PMIX_GROUP_CONSTRUCT_ABORT from the event
0766  * handler will cause all participants to receive an event notifying them
0767  * of that status.
0768  */
0769 PMIX_EXPORT pmix_status_t PMIx_Group_invite(const char grp[],
0770                                             const pmix_proc_t procs[], size_t nprocs,
0771                                             const pmix_info_t info[], size_t ninfo,
0772                                             pmix_info_t **results, size_t *nresult);
0773 
0774 PMIX_EXPORT pmix_status_t PMIx_Group_invite_nb(const char grp[],
0775                                                const pmix_proc_t procs[], size_t nprocs,
0776                                                const pmix_info_t info[], size_t ninfo,
0777                                                pmix_info_cbfunc_t cbfunc, void *cbdata);
0778 
0779 /* Respond to an invitation to join a group that is being asynchronously constructed.
0780  *
0781  * The process must have registered for the PMIX_GROUP_INVITED event in order to be
0782  * notified of the invitation. When ready to respond, the process provides a response
0783  * using the appropriate form of PMIx_Group_join.
0784  *
0785  * Critical Note: Since the process is alerted to the invitation in a PMIx event handler,
0786  * the process must not use the blocking form of this call unless it first “thread shifts”
0787  * out of the handler and into its own thread context. Likewise, while it is safe to call
0788  * the non-blocking form of the API from the event handler, the process must not block
0789  * in the handler while waiting for the callback function to be called.
0790  *
0791  * Calling this function causes the group “leader” to be notified that the process has
0792  * either accepted or declined the request. The blocking form of the API will return
0793  * once the group has been completely constructed or the group’s construction has failed
0794  * (as determined by the leader) – likewise, the callback function of the non-blocking
0795  * form will be executed upon the same conditions.
0796  *
0797  * Failure of the leader at any time will cause a PMIX_GROUP_LEADER_FAILED event
0798  * to be delivered to all participants so they can optionally declare a new leader.
0799  * A new leader is identified by providing the PMIX_GROUP_LEADER attribute in
0800  * the results array in the return of the event handler. Only one process is
0801  * allowed to return that attribute, declaring itself as the new leader. Results
0802  * of the leader selection will be communicated to all participants via a
0803  * PMIX_GROUP_LEADER_SELECTED event identifying the new leader. If no leader
0804  * was selected, then the status code provided in the event handler will provide
0805  * an error value so the participants can take appropriate action.
0806  *
0807  * Any participant that returns PMIX_GROUP_CONSTRUCT_ABORT from the leader failed
0808  * event handler will cause all participants to receive an event notifying them
0809  * of that status. Similarly, the leader may elect to abort the procedure
0810  * by either returning PMIX_GROUP_CONSTRUCT_ABORT from the handler assigned
0811  * to the PMIX_GROUP_INVITE_ACCEPTED or PMIX_GROUP_INVITE_DECLINED codes, or
0812  * by generating an event for the abort code. Abort events will be sent to
0813  * all invited participants.
0814  */
0815 PMIX_EXPORT pmix_status_t PMIx_Group_join(const char grp[],
0816                                           const pmix_proc_t *leader,
0817                                           pmix_group_opt_t opt,
0818                                           const pmix_info_t info[], size_t ninfo,
0819                                           pmix_info_t **results, size_t *nresult);
0820 
0821 PMIX_EXPORT pmix_status_t PMIx_Group_join_nb(const char grp[],
0822                                              const pmix_proc_t *leader,
0823                                              pmix_group_opt_t opt,
0824                                              const pmix_info_t info[], size_t ninfo,
0825                                              pmix_info_cbfunc_t cbfunc, void *cbdata);
0826 
0827 /* Leave a PMIx Group. Calls to PMIx_Group_leave (or its non-blocking form) will cause
0828  * a PMIX_GROUP_LEFT event to be generated notifying all members of the group of the
0829  * caller’s departure. The function will return (or the non-blocking function will
0830  * execute the specified callback function) once the event has been locally generated
0831  * and is not indicative of remote receipt. All PMIx-based collectives such as
0832  * PMIx_Fence in action across the group will automatically be adjusted if the
0833  * collective was called with the PMIX_GROUP_FT_COLLECTIVE attribute (default is
0834  * false) – otherwise, the standard error return behavior will be provided.
0835  *
0836  * Critical Note: The PMIx_Group_leave API is intended solely for asynchronous
0837  * departures of individual processes from a group as it is not a scalable
0838  * operation – i.e., when a process determines it should no longer be a part of a
0839  * defined group, but the remainder of the group retains a valid reason to continue
0840  * in existence. Developers are advised to use PMIx_Group_destruct (or its
0841  * non-blocking form) for all other scenarios as it represents a more scalable
0842  * operation.
0843  */
0844 PMIX_EXPORT pmix_status_t PMIx_Group_leave(const char grp[],
0845                                            const pmix_info_t info[], size_t ninfo);
0846 
0847 PMIX_EXPORT pmix_status_t PMIx_Group_leave_nb(const char grp[],
0848                                               const pmix_info_t info[], size_t ninfo,
0849                                               pmix_op_cbfunc_t cbfunc, void *cbdata);
0850 
0851 /* Destruct a group identified by the provided group identifier. Both blocking and
0852  * non-blocking versions are provided (the callback function for the non-blocking
0853  * form will be called once all members of the group have called “destruct”).
0854  * Processes may engage in multiple simultaneous group destruct operations as
0855  * desired so long as each involves a unique group ID. The info array can be used
0856  * to pass user-level directives regarding timeout constraints and other options
0857  * available from the PMIx server.
0858  *
0859  * Some relevant attributes for this operation:
0860  *
0861  *    PMIX_TIMEOUT (int): return an error if the group doesn’t destruct within the
0862  *                        specified number of seconds. Targets the scenario where
0863  *                        a process fails to call PMIx_Group_destruct due to hanging
0864  *
0865  * The destruct API will return an error if any group process fails or terminates
0866  * prior to calling PMIx_Group_destruct or its non-blocking version unless the
0867  * PMIX_GROUP_NOTIFY_TERMINATION attribute was provided (with a value of true) at
0868  * time of group construction. If notification was requested, then a event will
0869  * be delivered (using PMIX_GROUP_MEMBER_FAILED) for each process that fails to
0870  * call destruct and the destruct tracker updated to account for the lack of
0871  * participation. The PMIx_Group_destruct operation will subsequently return
0872  * PMIX_SUCCESS when the remaining processes have all called destruct – i.e., the
0873  * event will serve in place of return of an error.
0874  */
0875 PMIX_EXPORT pmix_status_t PMIx_Group_destruct(const char grp[],
0876                                               const pmix_info_t info[], size_t ninfo);
0877 
0878 PMIX_EXPORT pmix_status_t PMIx_Group_destruct_nb(const char grp[],
0879                                                  const pmix_info_t info[], size_t ninfo,
0880                                                  pmix_op_cbfunc_t cbfunc, void *cbdata);
0881 
0882 /****************************************/
0883 /****    COMMON SUPPORT FUNCTIONS    ****/
0884 /****************************************/
0885 
0886 /******     EVENT NOTIFICATION SUPPORT      ******/
0887 /* Register an event handler to report events. Three types of events
0888  * can be reported:
0889  *
0890  * (a) those that occur within the client library, but are not
0891  *     reportable via the API itself (e.g., loss of connection to
0892  *     the server). These events typically occur during behind-the-scenes
0893  *     non-blocking operations.
0894  *
0895  * (b) job-related events such as the failure of another process in
0896  *     the job or in any connected job, impending failure of hardware
0897  *     within the job's usage footprint, etc.
0898  *
0899  * (c) system notifications that are made available by the local
0900  *     administrators
0901  *
0902  * By default, only events that directly affect the process and/or
0903  * any process to which it is connected (via the PMIx_Connect call)
0904  * will be reported. Options to modify that behavior can be provided
0905  * in the info array
0906  *
0907  * Both the client application and the resource manager can register
0908  * err handlers for specific events. PMIx client/server calls the registered
0909  * err handler upon receiving event notify notification (via PMIx_Notify_event)
0910  * from the other end (Resource Manager/Client application).
0911  *
0912  * Multiple err handlers can be registered for different events. PMIX returns
0913  * an integer reference to each register handler in the callback fn. The caller
0914  * must retain the reference in order to deregister the evhdlr.
0915  * Modification of the notification behavior can be accomplished by
0916  * deregistering the current evhdlr, and then registering it
0917  * using a new set of info values.
0918  *
0919  * If cbfunc is NULL, then this is treated as a BLOCKING call - a positive
0920  * return value represents the reference ID for the request, while
0921  * negative values indicate the corresponding error
0922  *
0923  * See pmix_common.h for a description of the notification function */
0924 PMIX_EXPORT pmix_status_t PMIx_Register_event_handler(pmix_status_t codes[], size_t ncodes,
0925                                                       pmix_info_t info[], size_t ninfo,
0926                                                       pmix_notification_fn_t evhdlr,
0927                                                       pmix_hdlr_reg_cbfunc_t cbfunc,
0928                                                       void *cbdata);
0929 
0930 /* Deregister an event handler
0931  * evhdlr_ref is the reference returned by PMIx from the call to
0932  * PMIx_Register_event_handler. If non-NULL, the provided cbfunc
0933  * will be called to confirm removal of the designated handler */
0934 PMIX_EXPORT pmix_status_t PMIx_Deregister_event_handler(size_t evhdlr_ref,
0935                                                         pmix_op_cbfunc_t cbfunc,
0936                                                         void *cbdata);
0937 
0938 /* Report an event for notification via any
0939  * registered evhdlr.
0940  *
0941  * This function allows the host server to direct the server
0942  * convenience library to notify all registered local procs of
0943  * an event. The event can be local, or anywhere in the cluster.
0944  * The status indicates the event being reported.
0945  *
0946  * The client application can also call this function to notify the
0947  * resource manager and/or other processes of an event it encountered.
0948  * It can also be used to asynchronously notify other parts of its
0949  * own internal process - e.g., for one library to notify another
0950  * when initialized inside the process.
0951  *
0952  * status - status code indicating the event being reported
0953  *
0954  * source - the process that generated the event
0955  *
0956  * range - the range in which the event is to be reported. For example,
0957  *         a value of PMIX_RANGE_LOCAL would instruct the system
0958  *         to only notify procs on the same local node as the
0959  *         event generator.
0960  *
0961  * info - an array of pmix_info_t structures provided by the event
0962  *        generator to pass any additional information about the
0963  *        event. This can include an array of pmix_proc_t structs
0964  *        describing the processes impacted by the event, the nature
0965  *        of the event and its severity, etc. The precise contents
0966  *        of the array will depend on the event generator.
0967  *
0968  * ninfo - number of elements in the info array
0969  *
0970  * cbfunc - callback function to be called upon completion of the
0971  *          notify_event function's actions. Note that any messages
0972  *          will have been queued, but may not have been transmitted
0973  *          by this time. Note that the caller is required to maintain
0974  *          the input data until the callback function has been executed!
0975  *          If cbfunc is NULL, then this is treated as a BLOCKING call and
0976  *          the result of the operation is provided in the returned
0977  *          status
0978  *
0979  * cbdata - the caller's provided void* object
0980  */
0981 PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status,
0982                                             const pmix_proc_t *source,
0983                                             pmix_data_range_t range,
0984                                             const pmix_info_t info[], size_t ninfo,
0985                                             pmix_op_cbfunc_t cbfunc, void *cbdata);
0986 
0987 
0988 /******    FABRIC-RELATED APIS    ******/
0989 /* Register for access to fabric-related information, including
0990  * communication cost matrix. This call must be made prior to
0991  * requesting information from a fabric.
0992  *
0993  * fabric - address of a pmix_fabric_t (backed by storage). User
0994  *          may populate the "name" field at will - PMIx does not
0995  *          utilize this field
0996  *
0997  * directives - an optional array of values indicating desired
0998  *              behaviors and/or fabric to be accessed. If NULL,
0999  *              then the highest priority available fabric will
1000  *              be used
1001  *
1002  * ndirs - number of elements in the directives array
1003  *
1004  * Return values include:
1005  *
1006  * PMIX_SUCCESS - indicates success
1007  */
1008 PMIX_EXPORT pmix_status_t PMIx_Fabric_register(pmix_fabric_t *fabric,
1009                                                const pmix_info_t directives[],
1010                                                size_t ndirs);
1011 
1012 PMIX_EXPORT pmix_status_t PMIx_Fabric_register_nb(pmix_fabric_t *fabric,
1013                                                   const pmix_info_t directives[],
1014                                                   size_t ndirs,
1015                                                   pmix_op_cbfunc_t cbfunc, void *cbdata);
1016 
1017 
1018 /* Update fabric-related information. This call can be made at any time to request an update of the
1019  * fabric information contained in the provided pmix_fabric_t object. The caller is not allowed
1020  * to access the provided pmix_fabric_t until the call has returned.
1021  *
1022  * fabric - pointer to the pmix_fabric_t struct provided to
1023  *          the registration function
1024  *
1025  * Return values include:
1026  *
1027  * PMIX_SUCCESS - indicates successful update
1028  */
1029 PMIX_EXPORT pmix_status_t PMIx_Fabric_update(pmix_fabric_t *fabric);
1030 
1031 PMIX_EXPORT pmix_status_t PMIx_Fabric_update_nb(pmix_fabric_t *fabric,
1032                                                 pmix_op_cbfunc_t cbfunc, void *cbdata);
1033 
1034 
1035 /* Deregister a fabric object, providing an opportunity for
1036  * the PMIx server library to cleanup any information
1037  * (e.g., cost matrix) associated with it
1038  *
1039  * fabric - pointer to the pmix_fabric_t struct provided
1040  *          to the registration function
1041  */
1042 PMIX_EXPORT pmix_status_t PMIx_Fabric_deregister(pmix_fabric_t *fabric);
1043 
1044 PMIX_EXPORT pmix_status_t PMIx_Fabric_deregister_nb(pmix_fabric_t *fabric,
1045                                                     pmix_op_cbfunc_t cbfunc, void *cbdata);
1046 
1047 
1048 /* Compute the distance information for the current process
1049  * Returns an array of distances from the current process
1050  * location to each of the local devices of the specified type(s)
1051  *
1052  * distances - pointer to location where the array of
1053  *             distances is to be returned
1054  *
1055  * ndist - number of elements in the distances array
1056  *
1057  * Return values include:
1058  *
1059  * PMIX_SUCCESS - distance array was successfully returned
1060  * Other error
1061  */
1062 PMIX_EXPORT pmix_status_t PMIx_Compute_distances(pmix_topology_t *topo,
1063                                                  pmix_cpuset_t *cpuset,
1064                                                  pmix_info_t info[], size_t ninfo,
1065                                                  pmix_device_distance_t *distances[],
1066                                                  size_t *ndist);
1067 
1068 PMIX_EXPORT pmix_status_t PMIx_Compute_distances_nb(pmix_topology_t *topo,
1069                                                     pmix_cpuset_t *cpuset,
1070                                                     pmix_info_t info[], size_t ninfo,
1071                                                     pmix_device_dist_cbfunc_t cbfunc,
1072                                                     void *cbdata);
1073 
1074 /* Load the local hwardware topology description
1075  *
1076  * topo - pointer to a pmix_topology_t object. This object
1077  *        must be initialized! If the a particular "source"
1078  *        for the topology is required (e.g., "hwloc"), then
1079  *        the "source" field of the object must be set to
1080  *        that value
1081  *
1082  * Return values include:
1083  * PMIX_SUCCESS - indicates return of a valid value
1084  * PMIX_ERR_NOT_FOUND - provided source is not available
1085  * PMIX_ERR_NOT_SUPPORTED - current implementation does not support this option
1086  */
1087 PMIX_EXPORT pmix_status_t PMIx_Load_topology(pmix_topology_t *topo);
1088 
1089 /* Get the PU binding bitmap from its string representation
1090  *
1091  * cpuset_string - string representation of the binding bitmap
1092  *                 (as returned by PMIx_Get using the PMIX_CPUSET key)
1093  *
1094  * cpuset - pointer to a pmix_cpuset_t object where the result
1095  *          is to be stored
1096  *
1097  * Return values include:
1098  * PMIX_SUCCESS - indicates return of a valid value
1099  * PMIX_ERR_NOT_FOUND - provided source is not available
1100  * PMIX_ERR_NOT_SUPPORTED - current implementation does not support this option
1101  */
1102 PMIX_EXPORT pmix_status_t PMIx_Parse_cpuset_string(const char *cpuset_string,
1103                                                    pmix_cpuset_t *cpuset);
1104 
1105 PMIX_EXPORT pmix_status_t PMIx_Get_cpuset(pmix_cpuset_t *cpuset, pmix_bind_envelope_t ref);
1106 
1107 /* Get the relative locality of two local processes given their locality strings.
1108  *
1109  * locality1 - String returned by the PMIx_server_generate_locality_string API
1110  *
1111  * locality2 - String returned by the PMIx_server_generate_locality_string API
1112  *
1113  * locality - Pointer to the location where the relative locality bitmask is
1114  *            to be constructed
1115  *
1116  * Return values include:
1117  * PMIX_SUCCESS - indicates return of a valid value
1118  * other error constant
1119  */
1120 PMIX_EXPORT pmix_status_t PMIx_Get_relative_locality(const char *locality1,
1121                                                      const char *locality2,
1122                                                      pmix_locality_t *locality);
1123 
1124 PMIX_EXPORT void PMIx_Progress(void);
1125 
1126 /******    PRETTY-PRINT DEFINED VALUE TYPES     ******/
1127 /* Provide a string representation for several types of value. Note
1128  * that the provided string is statically defined and must NOT be
1129  * free'd. Supported value types:
1130  *
1131  * - pmix_status_t (PMIX_STATUS)
1132  * - pmix_scope_t   (PMIX_SCOPE)
1133  * - pmix_persistence_t  (PMIX_PERSIST)
1134  * - pmix_data_range_t   (PMIX_DATA_RANGE)
1135  * - pmix_info_directives_t   (PMIX_INFO_DIRECTIVES)
1136  * - pmix_data_type_t   (PMIX_DATA_TYPE)
1137  * - pmix_alloc_directive_t  (PMIX_ALLOC_DIRECTIVE)
1138  * - pmix_iof_channel_t  (PMIX_IOF_CHANNEL)
1139  * - pmix_job_state_t  (PMIX_JOB_STATE)
1140  * - pmix_proc_state_t  (PMIX_PROC_STATE)
1141  * - attribute string value of provided name
1142  * - attribute name corresponding to provided string
1143  * - pmix_link_state_t (PMIX_LINK_STATE)
1144  * - pmix_device_type_t (PMIX_DEVTYPE)
1145  * - pmix_value_cmp_t (enum)
1146  * - pmix_info_t (PMIX_INFO)
1147  * - pmix_value_t (PMIX_VALUE)
1148  * - pmix_info_directives_t (PMIX_INFO_DIRECTIVES)
1149  * - pmix_app_t (PMIX_APP)
1150  */
1151 PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t status);
1152 PMIX_EXPORT pmix_status_t PMIx_Error_code(const char *errname);
1153 PMIX_EXPORT const char* PMIx_Proc_state_string(pmix_proc_state_t state);
1154 PMIX_EXPORT const char* PMIx_Scope_string(pmix_scope_t scope);
1155 PMIX_EXPORT const char* PMIx_Persistence_string(pmix_persistence_t persist);
1156 PMIX_EXPORT const char* PMIx_Data_range_string(pmix_data_range_t range);
1157 PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type);
1158 PMIX_EXPORT const char* PMIx_Alloc_directive_string(pmix_alloc_directive_t directive);
1159 PMIX_EXPORT const char* PMIx_IOF_channel_string(pmix_iof_channel_t channel);
1160 PMIX_EXPORT const char* PMIx_Job_state_string(pmix_job_state_t state);
1161 PMIX_EXPORT const char* PMIx_Get_attribute_string(const char *attribute);
1162 PMIX_EXPORT const char* PMIx_Get_attribute_name(const char *attrstring);
1163 PMIX_EXPORT const char* PMIx_Link_state_string(pmix_link_state_t state);
1164 PMIX_EXPORT const char* PMIx_Device_type_string(pmix_device_type_t type);
1165 PMIX_EXPORT const char* PMIx_Value_comparison_string(pmix_value_cmp_t cmp);
1166 
1167 /* the following print statements return ALLOCATED strings
1168  * that the user must release when done */
1169 PMIX_EXPORT char* PMIx_Info_string(const pmix_info_t *info);
1170 PMIX_EXPORT char* PMIx_Value_string(const pmix_value_t *value);
1171 PMIX_EXPORT char* PMIx_Info_directives_string(pmix_info_directives_t directives);
1172 PMIX_EXPORT char* PMIx_App_string(const pmix_app_t *app);
1173 PMIX_EXPORT char* PMIx_Proc_string(const pmix_proc_t *proc);
1174 
1175 /* Get the PMIx version string. Note that the provided string is
1176  * statically defined and must NOT be free'd  */
1177 PMIX_EXPORT const char* PMIx_Get_version(void);
1178 
1179 /* Store some data locally for retrieval by other areas of the
1180  * proc. This is data that has only internal scope - it will
1181  * never be "pushed" externally */
1182 PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc,
1183                                               const char key[], pmix_value_t *val);
1184 
1185 
1186 /* Compute and return the size (in bytes) of the data
1187  * payload in a pmix_value_t structure. Returns:
1188  *
1189  * - PMIX_SUCCESS if the value could be computed
1190  *
1191  * - an appropriate error value (e.g., PMIX_ERR_UNKNOWN_DATA_TYPE
1192  *   if the data type is unknown) if the value could not be computed.
1193  */
1194 PMIX_EXPORT pmix_status_t PMIx_Value_get_size(const pmix_value_t *val,
1195                                               size_t *size);
1196 
1197 /* Compute and return the size (in bytes) of the data
1198  * payload in a pmix_info_t structure. Returns:
1199  *
1200  * - PMIX_SUCCESS if the value could be computed
1201  *
1202  * - an appropriate error value (e.g., PMIX_ERR_UNKNOWN_DATA_TYPE
1203  *   if the data type is unknown) if the value could not be computed.
1204  */
1205 PMIX_EXPORT pmix_status_t PMIx_Info_get_size(const pmix_info_t *val,
1206                                              size_t *size);
1207 
1208 
1209 /******    DATA BUFFER PACK/UNPACK SUPPORT    ******/
1210 /**
1211  * Top-level interface function to pack one or more values into a
1212  * buffer.
1213  *
1214  * The pack function packs one or more values of a specified type into
1215  * the specified buffer.  The buffer must have already been
1216  * initialized via the PMIX_DATA_BUFFER_CREATE or PMIX_DATA_BUFFER_CONSTRUCT
1217  * call - otherwise, the pack_value function will return an error.
1218  * Providing an unsupported type flag will likewise be reported as an error.
1219  *
1220  * Note that any data to be packed that is not hard type cast (i.e.,
1221  * not type cast to a specific size) may lose precision when unpacked
1222  * by a non-homogeneous recipient.  The PACK function will do its best to deal
1223  * with heterogeneity issues between the packer and unpacker in such
1224  * cases. Sending a number larger than can be handled by the recipient
1225  * will return an error code (generated upon unpacking) -
1226  * the error cannot be detected during packing.
1227  *
1228  * The identity of the intended recipient of the packed buffer (i.e., the
1229  * process that will be unpacking it) is used solely to resolve any data type
1230  * differences between PMIx versions. The recipient must, therefore, be
1231  * known to the user prior to calling the pack function so that the
1232  * PMIx library is aware of the version the recipient is using.
1233  *
1234  * @param *target Pointer to a pmix_proc_t structure containing the
1235  * nspace/rank of the process that will be unpacking the final buffer.
1236  * A NULL value may be used to indicate that the target is based on
1237  * the same PMIx version as the caller.
1238  *
1239  * @param *buffer A pointer to the buffer into which the value is to
1240  * be packed.
1241  *
1242  * @param *src A void* pointer to the data that is to be packed. Note
1243  * that strings are to be passed as (char **) - i.e., the caller must
1244  * pass the address of the pointer to the string as the void*. This
1245  * allows PMIx to use a single pack function, but still allow
1246  * the caller to pass multiple strings in a single call.
1247  *
1248  * @param num_values An int32_t indicating the number of values that are
1249  * to be packed, beginning at the location pointed to by src. A string
1250  * value is counted as a single value regardless of length. The values
1251  * must be contiguous in memory. Arrays of pointers (e.g., string
1252  * arrays) should be contiguous, although (obviously) the data pointed
1253  * to need not be contiguous across array entries.
1254  *
1255  * @param type The type of the data to be packed - must be one of the
1256  * PMIX defined data types.
1257  *
1258  * @retval PMIX_SUCCESS The data was packed as requested.
1259  *
1260  * @retval PMIX_ERROR(s) An appropriate PMIX error code indicating the
1261  * problem encountered. This error code should be handled
1262  * appropriately.
1263  *
1264  * @code
1265  * pmix_data_buffer_t *buffer;
1266  * int32_t src;
1267  *
1268  * PMIX_DATA_BUFFER_CREATE(buffer);
1269  * status_code = PMIx_Data_pack(buffer, &src, 1, PMIX_INT32);
1270  * @endcode
1271  */
1272 PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target,
1273                                          pmix_data_buffer_t *buffer,
1274                                          void *src, int32_t num_vals,
1275                                          pmix_data_type_t type);
1276 
1277 /**
1278  * Unpack values from a buffer.
1279  *
1280  * The unpack function unpacks the next value (or values) of a
1281  * specified type from the specified buffer.
1282  *
1283  * The buffer must have already been initialized via an PMIX_DATA_BUFFER_CREATE or
1284  * PMIX_DATA_BUFFER_CONSTRUCT call (and assumedly filled with some data) -
1285  * otherwise, the unpack_value function will return an
1286  * error. Providing an unsupported type flag will likewise be reported
1287  * as an error, as will specifying a data type that DOES NOT match the
1288  * type of the next item in the buffer. An attempt to read beyond the
1289  * end of the stored data held in the buffer will also return an
1290  * error.
1291  *
1292  * NOTE: it is possible for the buffer to be corrupted and that
1293  * PMIx will *think* there is a proper variable type at the
1294  * beginning of an unpack region - but that the value is bogus (e.g., just
1295  * a byte field in a string array that so happens to have a value that
1296  * matches the specified data type flag). Therefore, the data type error check
1297  * is NOT completely safe. This is true for ALL unpack functions.
1298  *
1299  *
1300  * Unpacking values is a "nondestructive" process - i.e., the values are
1301  * not removed from the buffer. It is therefore possible for the caller
1302  * to re-unpack a value from the same buffer by resetting the unpack_ptr.
1303  *
1304  * Warning: The caller is responsible for providing adequate memory
1305  * storage for the requested data. As noted below, the user
1306  * must provide a parameter indicating the maximum number of values that
1307  * can be unpacked into the allocated memory. If more values exist in the
1308  * buffer than can fit into the memory storage, then the function will unpack
1309  * what it can fit into that location and return an error code indicating
1310  * that the buffer was only partially unpacked.
1311  *
1312  * Note that any data that was not hard type cast (i.e., not type cast
1313  * to a specific size) when packed may lose precision when unpacked by
1314  * a non-homogeneous recipient.  PMIx will do its best to deal with
1315  * heterogeneity issues between the packer and unpacker in such
1316  * cases. Sending a number larger than can be handled by the recipient
1317  * will return an error code generated upon unpacking - these errors
1318  * cannot be detected during packing.
1319  *
1320  * The identity of the source of the packed buffer (i.e., the
1321  * process that packed it) is used solely to resolve any data type
1322  * differences between PMIx versions. The source must, therefore, be
1323  * known to the user prior to calling the unpack function so that the
1324  * PMIx library is aware of the version the source used.
1325  *
1326  * @param *source Pointer to a pmix_proc_t structure containing the
1327  * nspace/rank of the process that packed the provided buffer.
1328  * A NULL value may be used to indicate that the source is based on
1329  * the same PMIx version as the caller.
1330  *
1331  * @param *buffer A pointer to the buffer from which the value will be
1332  * extracted.
1333  *
1334  * @param *dest A void* pointer to the memory location into which the
1335  * data is to be stored. Note that these values will be stored
1336  * contiguously in memory. For strings, this pointer must be to (char
1337  * **) to provide a means of supporting multiple string
1338  * operations. The unpack function will allocate memory for each
1339  * string in the array - the caller must only provide adequate memory
1340  * for the array of pointers.
1341  *
1342  * @param type The type of the data to be unpacked - must be one of
1343  * the BFROP defined data types.
1344  *
1345  * @retval *max_num_values The number of values actually unpacked. In
1346  * most cases, this should match the maximum number provided in the
1347  * parameters - but in no case will it exceed the value of this
1348  * parameter.  Note that if you unpack fewer values than are actually
1349  * available, the buffer will be in an unpackable state - the function will
1350  * return an error code to warn of this condition.
1351  *
1352  * @note The unpack function will return the actual number of values
1353  * unpacked in this location.
1354  *
1355  * @retval PMIX_SUCCESS The next item in the buffer was successfully
1356  * unpacked.
1357  *
1358  * @retval PMIX_ERROR(s) The unpack function returns an error code
1359  * under one of several conditions: (a) the number of values in the
1360  * item exceeds the max num provided by the caller; (b) the type of
1361  * the next item in the buffer does not match the type specified by
1362  * the caller; or (c) the unpack failed due to either an error in the
1363  * buffer or an attempt to read past the end of the buffer.
1364  *
1365  * @code
1366  * pmix_data_buffer_t *buffer;
1367  * int32_t dest;
1368  * char **string_array;
1369  * int32_t num_values;
1370  *
1371  * num_values = 1;
1372  * status_code = PMIx_Data_unpack(buffer, (void*)&dest, &num_values, PMIX_INT32);
1373  *
1374  * num_values = 5;
1375  * string_array = pmix_malloc(num_values*sizeof(char *));
1376  * status_code = PMIx_Data_unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING);
1377  *
1378  * @endcode
1379  */
1380 PMIX_EXPORT pmix_status_t PMIx_Data_unpack(const pmix_proc_t *source,
1381                                            pmix_data_buffer_t *buffer, void *dest,
1382                                            int32_t *max_num_values,
1383                                            pmix_data_type_t type);
1384 
1385 /**
1386  * Copy a data value from one location to another.
1387  *
1388  * Since registered data types can be complex structures, the system
1389  * needs some way to know how to copy the data from one location to
1390  * another (e.g., for storage in the registry). This function, which
1391  * can call other copy functions to build up complex data types, defines
1392  * the method for making a copy of the specified data type.
1393  *
1394  * @param **dest The address of a pointer into which the
1395  * address of the resulting data is to be stored.
1396  *
1397  * @param *src A pointer to the memory location from which the
1398  * data is to be copied.
1399  *
1400  * @param type The type of the data to be copied - must be one of
1401  * the PMIx defined data types.
1402  *
1403  * @retval PMIX_SUCCESS The value was successfully copied.
1404  *
1405  * @retval PMIX_ERROR(s) An appropriate error code.
1406  *
1407  */
1408 PMIX_EXPORT pmix_status_t PMIx_Data_copy(void **dest, void *src,
1409                                          pmix_data_type_t type);
1410 
1411 /**
1412  * Print a data value.
1413  *
1414  * Since registered data types can be complex structures, the system
1415  * needs some way to know how to print them (i.e., convert them to a string
1416  * representation). Provided for debug purposes.
1417  *
1418  * @retval PMIX_SUCCESS The value was successfully printed.
1419  *
1420  * @retval PMIX_ERROR(s) An appropriate error code.
1421  */
1422 PMIX_EXPORT pmix_status_t PMIx_Data_print(char **output, char *prefix,
1423                                           void *src, pmix_data_type_t type);
1424 
1425 /**
1426  * Copy a payload from one buffer to another
1427  *
1428  * This function will append a copy of the payload in one buffer into
1429  * another buffer.
1430  * NOTE: This is NOT a destructive procedure - the
1431  * source buffer's payload will remain intact, as will any pre-existing
1432  * payload in the destination's buffer.
1433  */
1434 PMIX_EXPORT pmix_status_t PMIx_Data_copy_payload(pmix_data_buffer_t *dest,
1435                                                  pmix_data_buffer_t *src);
1436 
1437 /**
1438  * Unload a buffer into a byte object
1439  *
1440  * The unload function provides the caller with a pointer to the data
1441  * payload within the buffer and the size of that payload. This allows
1442  * the user to directly access the payload.
1443  *
1444  * @note This is a destructive operation. While the payload is
1445  * undisturbed, the function will clear the buffer's pointers to the
1446  * payload. Thus, the buffer and the payload are completely separated,
1447  * leaving the caller free to release the buffer.
1448  *
1449  * @param buffer A pointer to the buffer whose payload is to be
1450  * unloaded.
1451  *
1452  * @param payload The address of a pmix_byte_object_t into which
1453  * the buffer is to be unloaded
1454  *
1455  * @retval PMIX_SUCCESS The request was successfully completed.
1456  *
1457  * @retval PMIX_ERROR(s) An appropriate error code indicating the
1458  * problem will be returned. This should be handled appropriately by
1459  * the caller.
1460  *
1461  * @code
1462  * pmix_data_buffer_t *buffer;
1463  * pmix_byte_object_t payload;
1464  *
1465  * status_code = PMIx_Data_unload(buffer, &payload);
1466  * @endcode
1467  */
1468 PMIX_EXPORT pmix_status_t PMIx_Data_unload(pmix_data_buffer_t *buffer,
1469                                            pmix_byte_object_t *payload);
1470 
1471 /**
1472  * Load a data payload into a buffer.
1473  *
1474  * The load function allows the caller to replace the payload in a
1475  * buffer with one provided by the caller. If a payload already exists
1476  * in the buffer, the function will "free" the existing data to
1477  * release it, and then replace the data payload with the one provided
1478  * by the caller.
1479  *
1480  * @note The buffer must be allocated in advance - failing to do so
1481  * will cause the load function to return an error code.
1482  *
1483  * @note The caller is responsible for pre-packing the provided
1484  * payload - the load function cannot convert to network byte order
1485  * any data contained in the provided payload.
1486  *
1487  * @note The "payload" object will be empty upon completion of
1488  * this operation.
1489  *
1490  * @param buffer A pointer to the buffer into which the payload is to
1491  * be loaded.
1492  *
1493  * @param payload A pointer to the pmix_byte_object_t .containing the
1494  * desired payload
1495  *
1496  * @retval PMIX_SUCCESS The request was successfully completed
1497  *
1498  * @retval PMIX_ERROR(s) An appropriate error code indicating the
1499  * problem will be returned. This should be handled appropriately by
1500  * the caller.
1501  *
1502  * @code
1503  * pmix_data_buffer_t *buffer;
1504  * pmix_byte_object_t payload;
1505  *
1506  * PMIX_DATA_BUFFER_CREATE(buffer);
1507  * status_code = PMIx_Data_load(buffer, &payload);
1508  * @endcode
1509  */
1510 PMIX_EXPORT pmix_status_t PMIx_Data_load(pmix_data_buffer_t *buffer,
1511                                          pmix_byte_object_t *payload);
1512 
1513 /**
1514 * Embed a data payload into a buffer.
1515 *
1516 * The embed function is identical in operation to PMIx_Data_load
1517 * except that it does NOT "clear" the payload upon completion.
1518 *
1519 * @note The buffer must be allocated in advance - failing to do so
1520 * will cause the function to return an error code.
1521 *
1522 * @note The caller is responsible for pre-packing the provided
1523 * payload - the load function cannot convert to network byte order
1524 * any data contained in the provided payload.
1525 *
1526 * @note The "payload" object is unaltered by this operation.
1527 *
1528 * @param buffer A pointer to the buffer into which the payload is to
1529 * be loaded.
1530 *
1531 * @param payload A pointer to the pmix_byte_object_t .containing the
1532 * desired payload
1533 *
1534 * @retval PMIX_SUCCESS The request was successfully completed
1535 *
1536 * @retval PMIX_ERROR(s) An appropriate error code indicating the
1537 * problem will be returned. This should be handled appropriately by
1538 * the caller.
1539 *
1540 * @code
1541 * pmix_data_buffer_t *buffer;
1542 * pmix_byte_object_t payload;
1543 *
1544 * PMIX_DATA_BUFFER_CREATE(buffer);
1545 * status_code = PMIx_Data_embed(buffer, &payload);
1546 * @endcode
1547 */
1548 PMIX_EXPORT pmix_status_t PMIx_Data_embed(pmix_data_buffer_t *buffer,
1549                                           const pmix_byte_object_t *payload);
1550 
1551 /**
1552 * Compress data using loss-less compression algorithm.
1553 *
1554 * Compress the provided data block. Destination memory
1555 * will be allocated if successful operation is concluded. Caller
1556 * is responsible for release of the allocated region. The input
1557 * data block will remain unaltered.
1558 *
1559 * Note: the compress function will return "false" if the operation
1560 * would not result in a smaller data block.
1561 *
1562 * @param inbytes A pointer to the data to be compressed
1563 *
1564 * @param size Number of bytes in the input data region
1565 *
1566 * @param outbytes Address where a pointer to the compressed
1567 * data region is to be returned
1568 *
1569 * @param nbytes Address where the number of bytes in the
1570 * compressed data region is to be returned
1571 *
1572 * @retval true The input data was compressed.
1573 *
1574 * @retval false The input data was not compressed
1575 *
1576 */
1577 PMIX_EXPORT bool PMIx_Data_compress(const uint8_t *inbytes,
1578                                     size_t size,
1579                                     uint8_t **outbytes,
1580                                     size_t *nbytes);
1581 
1582 /**
1583 * Decompress data.
1584 *
1585 * Decompress the provided data block. Destination memory
1586 * will be allocated if successful operation is concluded. Caller
1587 * is responsible for release of the allocated region. The input
1588 * data block will remain unaltered.
1589 *
1590 * note: only data compressed using PMIx_Data_compress can
1591 * be input to this function
1592 *
1593 * @param inbytes A pointer to the data to be decompressed
1594 *
1595 * @param size Number of bytes in the input data region
1596 *
1597 * @param outbytes Address where a pointer to the decompressed
1598 * data region is to be returned
1599 *
1600 * @param nbytes Address where the number of bytes in the
1601 * decompressed data region is to be returned
1602 *
1603 * @retval true The input data was decompressed
1604 *
1605 * @retval false The input data was not decompressed
1606 *
1607 */
1608 PMIX_EXPORT bool PMIx_Data_decompress(const uint8_t *inbytes,
1609                                       size_t size,
1610                                       uint8_t **outbytes,
1611                                       size_t *nbytes);
1612 
1613 
1614 /* We had to put some function definitions into pmix_deprecated.h for
1615  * now-deprecated macros that utilize them as there are people who only
1616  * included pmix_common.h if they were using macros but not APIs.
1617  * However, we really want those APIs here so people will
1618  * see them and know they exist. So include them here as well. */
1619 
1620 #ifndef PMIx_DEPRECATED_H
1621 
1622 /* load a key */
1623 PMIX_EXPORT void PMIx_Load_key(pmix_key_t key, const char *src);
1624 
1625 /* check a key */
1626 PMIX_EXPORT bool PMIx_Check_key(const char *key, const char *str);
1627 
1628 /* check to see if a key is a "reserved" key */
1629 PMIX_EXPORT bool PMIx_Check_reserved_key(const char *key);
1630 
1631 /* load a string into a pmix_nspace_t struct */
1632 PMIX_EXPORT void PMIx_Load_nspace(pmix_nspace_t nspace, const char *str);
1633 
1634 /* check two nspace structs for equality */
1635 PMIX_EXPORT bool PMIx_Check_nspace(const char *key1, const char *key2);
1636 
1637 /* check if a namespace is invalid */
1638 PMIX_EXPORT bool PMIx_Nspace_invalid(const char *nspace);
1639 
1640 /* load a process ID struct */
1641 PMIX_EXPORT void PMIx_Load_procid(pmix_proc_t *p, 
1642                                   const char *ns,
1643                                   pmix_rank_t rk);
1644 
1645 /* transfer a process ID struct (non-destructive) */
1646 PMIX_EXPORT void PMIx_Xfer_procid(pmix_proc_t *dst,
1647                                   const pmix_proc_t *src);
1648 
1649 /* check two procIDs for equality */
1650 PMIX_EXPORT bool PMIx_Check_procid(const pmix_proc_t *a,
1651                                    const pmix_proc_t *b);
1652 
1653 /* check two ranks for equality */
1654 PMIX_EXPORT bool PMIx_Check_rank(pmix_rank_t a,
1655                                  pmix_rank_t b);
1656 
1657 /* check if procID is invalid */
1658 PMIX_EXPORT bool PMIx_Procid_invalid(const pmix_proc_t *p);
1659 
1660 PMIX_EXPORT int PMIx_Argv_count(char **a);
1661 PMIX_EXPORT pmix_status_t PMIx_Argv_append_nosize(char ***argv, const char *arg);
1662 PMIX_EXPORT pmix_status_t PMIx_Argv_prepend_nosize(char ***argv, const char *arg);
1663 PMIX_EXPORT pmix_status_t PMIx_Argv_append_unique_nosize(char ***argv, const char *arg);
1664 PMIX_EXPORT void PMIx_Argv_free(char **argv);
1665 PMIX_EXPORT char **PMIx_Argv_split_inter(const char *src_string,
1666                                          int delimiter,
1667                                          bool include_empty);
1668 PMIX_EXPORT char **PMIx_Argv_split_with_empty(const char *src_string, int delimiter);
1669 PMIX_EXPORT char **PMIx_Argv_split(const char *src_string, int delimiter);
1670 PMIX_EXPORT char *PMIx_Argv_join(char **argv, int delimiter);
1671 PMIX_EXPORT char **PMIx_Argv_copy(char **argv);
1672 PMIX_EXPORT pmix_status_t PMIx_Setenv(const char *name,
1673                                       const char *value,
1674                                       bool overwrite,
1675                                       char ***env);
1676 
1677 /* initialize a value struct */
1678 PMIX_EXPORT void PMIx_Value_construct(pmix_value_t *val);
1679 
1680 /* free memory stored inside a value struct */
1681 PMIX_EXPORT void PMIx_Value_destruct(pmix_value_t *val);
1682 
1683 /* create and initialize an array of value structs */
1684 PMIX_EXPORT pmix_value_t* PMIx_Value_create(size_t n);
1685 
1686 /* free memory stored inside an array of coord structs (does
1687  * not free the struct memory itself */
1688 PMIX_EXPORT void PMIx_Value_free(pmix_value_t *v, size_t n);
1689 
1690 /* Check the given value struct to determine if it includes
1691  * a boolean value (includes strings for "true" and "false",
1692  * including abbreviations such as "t" or "f"), and if so,
1693  * then its value. A value type of PMIX_UNDEF is taken to imply
1694  * a boolean "true". */
1695 PMIX_EXPORT pmix_boolean_t PMIx_Value_true(const pmix_value_t *v);
1696 
1697 /* Load data into a pmix_value_t structure. The data can be of any
1698  * PMIx data type - which means the load can be somewhat complex
1699  * to implement (e.g., in the case of a pmix_data_array_t). The
1700  * data is COPIED into the value struct
1701  */
1702 PMIX_EXPORT pmix_status_t PMIx_Value_load(pmix_value_t *val,
1703                                           const void *data,
1704                                           pmix_data_type_t type);
1705 
1706 /* Unload data from a pmix_value_t structure. */
1707 PMIX_EXPORT pmix_status_t PMIx_Value_unload(pmix_value_t *val,
1708                                             void **data,
1709                                             size_t *sz);
1710 
1711 /* Transfer data from one pmix_value_t to another - this is actually
1712  * executed as a COPY operation, so the original data is not altered.
1713  */
1714 PMIX_EXPORT pmix_status_t PMIx_Value_xfer(pmix_value_t *dest,
1715                                           const pmix_value_t *src);
1716 
1717 /* Compare the contents of two pmix_value_t structures */
1718 PMIX_EXPORT pmix_value_cmp_t PMIx_Value_compare(pmix_value_t *v1,
1719                                                 pmix_value_t *v2);
1720 
1721 
1722 
1723 PMIX_EXPORT void PMIx_Data_array_init(pmix_data_array_t *p,
1724                                       pmix_data_type_t type);
1725 PMIX_EXPORT void PMIx_Data_array_construct(pmix_data_array_t *p,
1726                                            size_t num, pmix_data_type_t type);
1727 PMIX_EXPORT void PMIx_Data_array_destruct(pmix_data_array_t *d);
1728 PMIX_EXPORT pmix_data_array_t* PMIx_Data_array_create(size_t n, pmix_data_type_t type);
1729 PMIX_EXPORT void PMIx_Data_array_free(pmix_data_array_t *p);
1730 
1731 
1732 /* initialize an info struct */
1733 PMIX_EXPORT void PMIx_Info_construct(pmix_info_t *p);
1734 
1735 /* free memory stored inside an info struct */
1736 PMIX_EXPORT void PMIx_Info_destruct(pmix_info_t *p);
1737 
1738 /* create and initialize an array of info structs */
1739 PMIX_EXPORT pmix_info_t* PMIx_Info_create(size_t n);
1740 
1741 /* free memory stored inside an array of coord structs (does
1742  * not free the struct memory itself */
1743 PMIX_EXPORT void PMIx_Info_free(pmix_info_t *p, size_t n);
1744 
1745 /* Check the given info struct to determine if it includes
1746  * a boolean value (includes strings for "true" and "false",
1747  * including abbreviations such as "t" or "f"), and if so,
1748  * then its value. A value type of PMIX_UNDEF is taken to imply
1749  * a boolean "true" as the presence of the key defaults to
1750  * indicating "true". */
1751 PMIX_EXPORT pmix_boolean_t PMIx_Info_true(const pmix_info_t *p);
1752 
1753 /* Load key/value data into a pmix_info_t struct. Note that this
1754  * effectively is a PMIX_LOAD_KEY operation to copy the key,
1755  * followed by a PMIx_Value_load to COPY the data into the
1756  * pmix_value_t in the provided info struct */
1757 PMIX_EXPORT pmix_status_t PMIx_Info_load(pmix_info_t *info,
1758                                          const char *key,
1759                                          const void *data,
1760                                          pmix_data_type_t type);
1761 
1762 /* Transfer data from one pmix_info_t to another - this is actually
1763  * executed as a COPY operation, so the original data is not altered */
1764 PMIX_EXPORT pmix_status_t PMIx_Info_xfer(pmix_info_t *dest,
1765                                          const pmix_info_t *src);
1766 
1767 /* mark the info struct as required */
1768 PMIX_EXPORT void PMIx_Info_required(pmix_info_t *p);
1769 
1770 /* mark the info struct as optional */
1771 PMIX_EXPORT void PMIx_Info_optional(pmix_info_t *p);
1772 
1773 /* check if the info struct is required */
1774 PMIX_EXPORT bool PMIx_Info_is_required(const pmix_info_t *p);
1775 
1776 /* check if the info struct is optional */
1777 PMIX_EXPORT bool PMIx_Info_is_optional(const pmix_info_t *p);
1778 
1779 /* mark the info struct as processed */
1780 PMIX_EXPORT void PMIx_Info_processed(pmix_info_t *p);
1781 
1782 /* check if the info struct has been processed */
1783 PMIX_EXPORT bool PMIx_Info_was_processed(const pmix_info_t *p);
1784 
1785 /* mark the info struct as the end of an array */
1786 PMIX_EXPORT void PMIx_Info_set_end(pmix_info_t *p);
1787 
1788 /* check if the info struct is the end of an array */
1789 PMIX_EXPORT bool PMIx_Info_is_end(const pmix_info_t *p);
1790 
1791 /* mark the info as a qualifier */
1792 PMIX_EXPORT void PMIx_Info_qualifier(pmix_info_t *p);
1793 
1794 /* check if the info struct is a qualifier */
1795 PMIX_EXPORT bool PMIx_Info_is_qualifier(const pmix_info_t *p);
1796 
1797 /* mark the info struct as persistent - do NOT release its contents */
1798 PMIX_EXPORT void PMIx_Info_persistent(pmix_info_t *p);
1799 
1800 /* check if the info struct is persistent */
1801 PMIX_EXPORT bool PMIx_Info_is_persistent(const pmix_info_t *p);
1802 
1803 
1804 /* initialize a coord struct */
1805 PMIX_EXPORT void PMIx_Coord_construct(pmix_coord_t *m);
1806 
1807 /* free memory stored inside a coord struct */
1808 PMIX_EXPORT void PMIx_Coord_destruct(pmix_coord_t *m);
1809 
1810 /* create and initialize an array of coord structs */
1811 PMIX_EXPORT pmix_coord_t* PMIx_Coord_create(size_t dims,
1812                                             size_t number);
1813 
1814 /* free memory stored inside an array of coord structs (does
1815  * not free the struct memory itself */
1816 PMIX_EXPORT void PMIx_Coord_free(pmix_coord_t *m, size_t number);
1817 
1818 
1819 /* initialize a topology struct */
1820 PMIX_EXPORT void PMIx_Topology_construct(pmix_topology_t *t);
1821 
1822 /* free memory stored inside a topology struct */
1823 PMIX_EXPORT void PMIx_Topology_destruct(pmix_topology_t *topo);
1824 
1825 /* create and initialize an array of topology structs */
1826 PMIX_EXPORT pmix_topology_t* PMIx_Topology_create(size_t n);
1827 
1828 /* free memory stored inside an array of topology structs (does
1829  * not free the struct memory itself */
1830 PMIX_EXPORT void PMIx_Topology_free(pmix_topology_t *t, size_t n);
1831 
1832 /* initialize a cpuset struct */
1833 PMIX_EXPORT void PMIx_Cpuset_construct(pmix_cpuset_t *cpuset);
1834 
1835 /* free memory stored inside a cpuset struct */
1836 PMIX_EXPORT void PMIx_Cpuset_destruct(pmix_cpuset_t *cpuset);
1837 
1838 /* create and initialize an array of cpuset structs */
1839 PMIX_EXPORT pmix_cpuset_t* PMIx_Cpuset_create(size_t n);
1840 
1841 /* free memory stored inside an array of cpuset structs (does
1842  * not free the struct memory itself */
1843 PMIX_EXPORT void PMIx_Cpuset_free(pmix_cpuset_t *c, size_t n);
1844 
1845 /* initialize a geometry struct */
1846 PMIX_EXPORT void PMIx_Geometry_construct(pmix_geometry_t *g);
1847 
1848 /* free memory stored inside a cpuset struct */
1849 PMIX_EXPORT void PMIx_Geometry_destruct(pmix_geometry_t *g);
1850 
1851 /* create and initialize an array of cpuset structs */
1852 PMIX_EXPORT pmix_geometry_t* PMIx_Geometry_create(size_t n);
1853 
1854 /* free memory stored inside an array of cpuset structs (does
1855  * not free the struct memory itself */
1856 PMIX_EXPORT void PMIx_Geometry_free(pmix_geometry_t *g, size_t n);
1857 
1858 /* initialize a device distance struct */
1859 PMIX_EXPORT void PMIx_Device_distance_construct(pmix_device_distance_t *d);
1860 
1861 /* free memory stored inside a device distance struct */
1862 PMIX_EXPORT void PMIx_Device_distance_destruct(pmix_device_distance_t *d);
1863 
1864 /* create and initialize an array of device distance structs */
1865 PMIX_EXPORT pmix_device_distance_t* PMIx_Device_distance_create(size_t n);
1866 
1867 /* free memory stored inside an array of device distance structs (does
1868  * not free the struct memory itself */
1869 PMIX_EXPORT void PMIx_Device_distance_free(pmix_device_distance_t *d, size_t n);
1870 
1871 
1872 /* initialize a byte object struct */
1873 PMIX_EXPORT void PMIx_Byte_object_construct(pmix_byte_object_t *b);
1874 
1875 /* free memory stored inside a byte object struct */
1876 PMIX_EXPORT void PMIx_Byte_object_destruct(pmix_byte_object_t *g);
1877 
1878 /* create and initialize an array of byte object structs */
1879 PMIX_EXPORT pmix_byte_object_t* PMIx_Byte_object_create(size_t n);
1880 
1881 /* free memory stored inside an array of byte object structs (does
1882  * not free the struct memory itself */
1883 PMIX_EXPORT void PMIx_Byte_object_free(pmix_byte_object_t *g, size_t n);
1884 
1885 /* load a byte object */
1886 PMIX_EXPORT void PMIx_Byte_object_load(pmix_byte_object_t *b,
1887                                        char *d, size_t sz);
1888 
1889 /* initialize an endpoint struct */
1890 PMIX_EXPORT void PMIx_Endpoint_construct(pmix_endpoint_t *e);
1891 
1892 /* free memory stored inside an endpoint struct */
1893 PMIX_EXPORT void PMIx_Endpoint_destruct(pmix_endpoint_t *e);
1894 
1895 /* create and initialize an array of endpoint structs */
1896 PMIX_EXPORT pmix_endpoint_t* PMIx_Endpoint_create(size_t n);
1897 
1898 /* free memory stored inside an array of endpoint structs (does
1899  * not free the struct memory itself */
1900 PMIX_EXPORT void PMIx_Endpoint_free(pmix_endpoint_t *e, size_t n);
1901 
1902 
1903 /* initialize an envar struct */
1904 PMIX_EXPORT void PMIx_Envar_construct(pmix_envar_t *e);
1905 
1906 /* free memory stored inside an envar struct */
1907 PMIX_EXPORT void PMIx_Envar_destruct(pmix_envar_t *e);
1908 
1909 /* create and initialize an array of envar structs */
1910 PMIX_EXPORT pmix_envar_t* PMIx_Envar_create(size_t n);
1911 
1912 /* free memory stored inside an array of envar structs (does
1913  * not free the struct memory itself */
1914 PMIX_EXPORT void PMIx_Envar_free(pmix_envar_t *e, size_t n);
1915 
1916 /* load an envar struct */
1917 PMIX_EXPORT void PMIx_Envar_load(pmix_envar_t *e,
1918                                  char *var,
1919                                  char *value,
1920                                  char separator);
1921 
1922 /* initialize a data buffer struct */
1923 PMIX_EXPORT void PMIx_Data_buffer_construct(pmix_data_buffer_t *b);
1924 
1925 /* free memory stored inside a data buffer struct */
1926 PMIX_EXPORT void PMIx_Data_buffer_destruct(pmix_data_buffer_t *b);
1927 
1928 /* create a data buffer struct */
1929 PMIX_EXPORT pmix_data_buffer_t* PMIx_Data_buffer_create(void);
1930 
1931 /* free memory stored inside a data buffer struct */
1932 PMIX_EXPORT void PMIx_Data_buffer_release(pmix_data_buffer_t *b);
1933 
1934 /* load a data buffer struct */
1935 PMIX_EXPORT void PMIx_Data_buffer_load(pmix_data_buffer_t *b,
1936                                        char *bytes, size_t sz);
1937 
1938 /* unload a data buffer struct */
1939 PMIX_EXPORT void PMIx_Data_buffer_unload(pmix_data_buffer_t *b,
1940                                          char **bytes, size_t *sz);
1941 
1942 
1943 /* initialize a proc struct */
1944 PMIX_EXPORT void PMIx_Proc_construct(pmix_proc_t *p);
1945 
1946 /* clear memory inside a proc struct */
1947 PMIX_EXPORT void PMIx_Proc_destruct(pmix_proc_t *p);
1948 
1949 /* create and initialize an array of proc structs */
1950 PMIX_EXPORT pmix_proc_t* PMIx_Proc_create(size_t n);
1951 
1952 /* free memory stored inside an array of proc structs (does
1953  * not free the struct memory itself */
1954 PMIX_EXPORT void PMIx_Proc_free(pmix_proc_t *p, size_t n);
1955 
1956 /* load a proc struct */
1957 PMIX_EXPORT void PMIx_Proc_load(pmix_proc_t *p,
1958                                 char *nspace, pmix_rank_t rank);
1959 
1960 /* construct a multicluster nspace struct from cluster and nspace values */
1961 PMIX_EXPORT void PMIx_Multicluster_nspace_construct(pmix_nspace_t target,
1962                                                     pmix_nspace_t cluster,
1963                                                     pmix_nspace_t nspace);
1964 
1965 /* parse a multicluster nspace struct to separate out the cluster
1966  * and nspace portions */
1967 PMIX_EXPORT void PMIx_Multicluster_nspace_parse(pmix_nspace_t target,
1968                                                 pmix_nspace_t cluster,
1969                                                 pmix_nspace_t nspace);
1970 
1971 
1972 /* initialize a proc info struct */
1973 PMIX_EXPORT void PMIx_Proc_info_construct(pmix_proc_info_t *p);
1974 
1975 /* clear memory inside a proc info struct */
1976 PMIX_EXPORT void PMIx_Proc_info_destruct(pmix_proc_info_t *p);
1977 
1978 /* create and initialize an array of proc info structs */
1979 PMIX_EXPORT pmix_proc_info_t* PMIx_Proc_info_create(size_t n);
1980 
1981 /* free memory stored inside an array of proc info structs (does
1982  * not free the struct memory itself */
1983 PMIX_EXPORT void PMIx_Proc_info_free(pmix_proc_info_t *p, size_t n);
1984 
1985 
1986 /* initialize a proc stats struct */
1987 PMIX_EXPORT void PMIx_Proc_stats_construct(pmix_proc_stats_t *p);
1988 
1989 /* clear memory inside a proc stats struct */
1990 PMIX_EXPORT void PMIx_Proc_stats_destruct(pmix_proc_stats_t *p);
1991 
1992 /* create and initialize an array of proc stats structs */
1993 PMIX_EXPORT pmix_proc_stats_t* PMIx_Proc_stats_create(size_t n);
1994 
1995 /* free memory stored inside an array of proc stats structs (does
1996  * not free the struct memory itself */
1997 PMIX_EXPORT void PMIx_Proc_stats_free(pmix_proc_stats_t *p, size_t n);
1998 
1999 
2000 /* initialize a disk stats struct */
2001 PMIX_EXPORT void PMIx_Disk_stats_construct(pmix_disk_stats_t *p);
2002 
2003 /* clear memory inside a disk stats struct */
2004 PMIX_EXPORT void PMIx_Disk_stats_destruct(pmix_disk_stats_t *p);
2005 
2006 /* create and initialize an array of disk stats structs */
2007 PMIX_EXPORT pmix_disk_stats_t* PMIx_Disk_stats_create(size_t n);
2008 
2009 /* free memory stored inside an array of disk stats structs (does
2010  * not free the struct memory itself */
2011 PMIX_EXPORT void PMIx_Disk_stats_free(pmix_disk_stats_t *p, size_t n);
2012 
2013 
2014 /* initialize a net stats struct */
2015 PMIX_EXPORT void PMIx_Net_stats_construct(pmix_net_stats_t *p);
2016 
2017 /* clear memory inside a net stats struct */
2018 PMIX_EXPORT void PMIx_Net_stats_destruct(pmix_net_stats_t *p);
2019 
2020 /* create and initialize an array of net stats structs */
2021 PMIX_EXPORT pmix_net_stats_t* PMIx_Net_stats_create(size_t n);
2022 
2023 /* free memory stored inside an array of net stats structs (does
2024  * not free the struct memory itself */
2025 PMIX_EXPORT void PMIx_Net_stats_free(pmix_net_stats_t *p, size_t n);
2026 
2027 
2028 /* initialize a pdata struct */
2029 PMIX_EXPORT void PMIx_Pdata_construct(pmix_pdata_t *p);
2030 
2031 /* clear memory inside a pdata struct */
2032 PMIX_EXPORT void PMIx_Pdata_destruct(pmix_pdata_t *p);
2033 
2034 /* create and initialize an array of pdata structs */
2035 PMIX_EXPORT pmix_pdata_t* PMIx_Pdata_create(size_t n);
2036 
2037 /* free memory stored inside an array of pdata structs (does
2038  * not free the struct memory itself */
2039 PMIX_EXPORT void PMIx_Pdata_free(pmix_pdata_t *p, size_t n);
2040 
2041 
2042 PMIX_EXPORT void PMIx_App_construct(pmix_app_t *p);
2043 PMIX_EXPORT void PMIx_App_destruct(pmix_app_t *p);
2044 PMIX_EXPORT pmix_app_t* PMIx_App_create(size_t n);
2045 PMIX_EXPORT void PMIx_App_info_create(pmix_app_t *p, size_t n);
2046 PMIX_EXPORT void PMIx_App_free(pmix_app_t *p, size_t n);
2047 PMIX_EXPORT void PMIx_App_release(pmix_app_t *p);
2048 
2049 /* Constructing arrays of pmix_info_t for passing to an API can
2050  * be tedious since the pmix_info_t itself is not a "list object".
2051  * Since this is a very frequent operation, a set of APIs has been
2052  * provided that opaquely manipulates internal PMIx list structures
2053  * for this purpose. The user only need provide a void* pointer to
2054  * act as the caddy for the internal list object.
2055  */
2056 
2057 /* Initialize a list of pmix_info_t structures */
2058 PMIX_EXPORT void* PMIx_Info_list_start(void);
2059 
2060 /* Add data to a list of pmix_info_t structs. The "ptr" passed
2061  * here is the pointer returned by PMIx_Info_list_start.
2062  */
2063 PMIX_EXPORT pmix_status_t PMIx_Info_list_add(void *ptr,
2064                                              const char *key,
2065                                              const void *value,
2066                                              pmix_data_type_t type);
2067 
2068 PMIX_EXPORT pmix_status_t PMIx_Info_list_prepend(void *ptr,
2069                                                  const char *key,
2070                                                  const void *value,
2071                                                  pmix_data_type_t type);
2072 
2073 PMIX_EXPORT pmix_status_t PMIx_Info_list_insert(void *ptr, pmix_info_t *info);
2074 
2075 /* Transfer the data in an existing pmix_info_t struct to a list. This
2076  * is executed as a COPY operation, so the original data is not altered.
2077  * The "ptr" passed here is the pointer returned by PMIx_Info_list_start
2078  */
2079 PMIX_EXPORT pmix_status_t PMIx_Info_list_xfer(void *ptr,
2080                                               const pmix_info_t *info);
2081 
2082 /* Convert the constructed list of pmix_info_t structs to a pmix_data_array_t
2083  * of pmix_info_t. Data on the list is COPIED to the array elements.
2084  */
2085 PMIX_EXPORT pmix_status_t PMIx_Info_list_convert(void *ptr, pmix_data_array_t *par);
2086 
2087 /* Release all data on the list and destruct all internal tracking */
2088 PMIX_EXPORT void PMIx_Info_list_release(void *ptr);
2089 
2090 /* retrieve the next info on the list - passing a NULL
2091  * to the "prev" parameter will return the first pmix_info_t
2092  * on the list. A return of NULL indicates the end of the list
2093  */
2094 PMIX_EXPORT pmix_info_t* PMIx_Info_list_get_info(void *ptr, void *prev, void **next);
2095 
2096 #endif
2097 
2098 #if defined(c_plusplus) || defined(__cplusplus)
2099 }
2100 #endif
2101 
2102 #endif