Dynamic Process Support - openpmix/openpmix GitHub Wiki

PMIx_Spawn

The PMIx_Spawn API provides a mechanism by which clients and tools can request that a job be executed on their behalf. This can consist of examples such as:
  • dynamically start a child job of the requestor, providing each job with information about the other
  • request a new allocation and start the provided job in it, notifying the requestor when the allocation is made and the job terminates
  • instantiate a set of debugger daemons colocated with processes of the specified target job, creating either one daemon/node or one daemon per target process (as indicated in the call)
The call to PMIx_Spawn accepts a range of attributes that can either be passed to processes of the child job, or can be used to direct the host environment to provide specific support. A review of the API's behavior might best begin by considering the API itself:

pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
                         const pmix_app_t apps[], size_t napps,
                         char nspace[]);
Note that the non-blocking form of the API

typedef void (*pmix_spawn_cbfunc_t)(pmix_status_t status,
                                    char nspace[], void *cbdata);

pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t ninfo, const pmix_app_t apps[], size_t napps, pmix_spawn_cbfunc_t cbfunc, void *cbdata);

provides the identical functionality in an asynchronous form. In either case, there are two input arrays that the user can provide: an optional job_info array consisting of some number of pmix_info_t structures, each providing a key-value pair; and a required array of pmix_app_t structures defining the application to be executed. The pmix_app_t structure is defined in pmix_common.h:

typedef struct pmix_app {
    char *cmd;
    char **argv;
    char **env;
    char *cwd;
    int maxprocs;
    pmix_info_t *info;
    size_t ninfo;
} pmix_app_t;

along with a set of convenience macros for creating, releasing, and populating its elements, which consist of:

  • cmd - the executable to be run (e.g., "hostname"). Note that the full path to the executable needs to be specified if it isn't in the users PATH
  • argv - a NULL-terminated array of strings, starting with the basename of the cmd and containing the arguments to be passed to that cmd upon execution
  • env - a NULL-terminated array of strings containing environmental parameters to be set in the environment of each process in the executed job. Note that values here will overwrite any existing value of the same name in the process' environment.
  • maxprocs - the maximum number of procs to be executed. The name of this parameter may seem odd at first glance, however it reflects the possibility that the caller provided some flexibility in the number of procs to execute in the accompanying job_info or app-specific info arrays. Minus a corresponding input indicating such flexibility, this parameter indicates the required number of procs to run
  • info - an optional array of pmix_info_t containing either directives related to that specific pmix_app_t, or to be passed to the processes of that app. Key-value pairs passed this way will default to being added to the job-info

    PMIx_Connect: Asynchronous Process Groupings

⚠️ **GitHub.com Fallback** ⚠️