Skip to content

Commit

Permalink
Correctly pass job-info for launch
Browse files Browse the repository at this point in the history
Need to pass the actual pointer to the info array
and its size as we don't have a pointer array in
all circumstances. When we do, then just separate
out the info and size so it can be passed.

Protect the node allocation function from the case
where no nodes are on the list

Signed-off-by: Ralph Castain <[email protected]>
  • Loading branch information
rhc54 committed Feb 16, 2024
1 parent a386514 commit 0991910
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
8 changes: 6 additions & 2 deletions src/mca/rmaps/base/rmaps_base_support_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ int prte_rmaps_base_get_target_nodes(pmix_list_t *allocated_nodes,
* this point either has the HNP node or nothing, and the HNP
* node obviously has a daemon on it (us!)
*/
nd = (prte_node_t *) pmix_list_get_last(allocated_nodes);
if (0 == pmix_list_get_size(allocated_nodes)) {
nd = NULL;
} else {
nd = (prte_node_t *) pmix_list_get_last(allocated_nodes);
}
for (i = 0; i < jdata->session->nodes->size; i++) {
if (NULL != (node = (prte_node_t *) pmix_pointer_array_get_item(jdata->session->nodes, i))) {

Expand Down Expand Up @@ -741,7 +745,7 @@ void prte_rmaps_base_get_cpuset(prte_job_t *jdata,
prte_rmaps_options_t *options)
{
PRTE_HIDE_UNUSED_PARAMS(jdata);

if (NULL != options->cpuset) {
options->job_cpuset = prte_hwloc_base_generate_cpuset(node->topology->topo,
options->use_hwthreads,
Expand Down
23 changes: 16 additions & 7 deletions src/prted/pmix/pmix_server_dyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ static void spawn(int sd, short args, void *cbdata)
PMIX_RELEASE(req);
}

int prte_pmix_xfer_job_info(prte_job_t *jdata, pmix_info_t *inarray)
int prte_pmix_xfer_job_info(prte_job_t *jdata,
pmix_info_t *iptr,
size_t ninfo)
{
pmix_info_t *iptr, *info;
size_t ninfo, n;
pmix_info_t *info;
size_t n;
int i, rc;
bool flag;
uint32_t u32;
Expand All @@ -206,9 +208,6 @@ int prte_pmix_xfer_job_info(prte_job_t *jdata, pmix_info_t *inarray)
prte_app_context_t *app;
pmix_envar_t envar;

iptr = (pmix_info_t*)inarray->value.data.darray->array;
ninfo = inarray->value.data.darray->size;

for (n = 0; n < ninfo; n++) {
info = &iptr[n];

Expand Down Expand Up @@ -693,21 +692,27 @@ int prte_pmix_xfer_app(prte_job_t *jdata, pmix_app_t *papp)
if (NULL != papp->info) {
for (m = 0; m < papp->ninfo; m++) {
info = &papp->info[m];

if (PMIX_CHECK_KEY(info, PMIX_HOST)) {
prte_set_attribute(&app->attributes, PRTE_APP_DASH_HOST, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_HOSTFILE)) {
prte_set_attribute(&app->attributes, PRTE_APP_HOSTFILE, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_ADD_HOSTFILE)) {
prte_set_attribute(&app->attributes, PRTE_APP_ADD_HOSTFILE, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_ADD_HOST)) {
prte_set_attribute(&app->attributes, PRTE_APP_ADD_HOST, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_PREFIX)) {
prte_set_attribute(&app->attributes, PRTE_APP_PREFIX_DIR, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_WDIR)) {
/* if this is a relative path, convert it to an absolute path */
if (pmix_path_is_absolute(info->value.data.string)) {
Expand All @@ -722,21 +727,25 @@ int prte_pmix_xfer_app(prte_job_t *jdata, pmix_app_t *papp)
/* construct the absolute path */
app->cwd = pmix_os_path(false, cwd, info->value.data.string, NULL);
}

} else if (PMIX_CHECK_KEY(info, PMIX_WDIR_USER_SPECIFIED)) {
flag = PMIX_INFO_TRUE(info);
prte_set_attribute(&app->attributes, PRTE_APP_USER_CWD, PRTE_ATTR_GLOBAL,
&flag, PMIX_BOOL);

} else if (PMIX_CHECK_KEY(info, PMIX_SET_SESSION_CWD)) {
flag = PMIX_INFO_TRUE(info);
prte_set_attribute(&app->attributes, PRTE_APP_SSNDIR_CWD, PRTE_ATTR_GLOBAL,
&flag, PMIX_BOOL);

} else if (PMIX_CHECK_KEY(info, PMIX_PRELOAD_FILES)) {
prte_set_attribute(&app->attributes, PRTE_APP_PRELOAD_FILES, PRTE_ATTR_GLOBAL,
info->value.data.string, PMIX_STRING);

} else if (PMIX_CHECK_KEY(info, PMIX_PRELOAD_BIN)) {
prte_set_attribute(&app->attributes, PRTE_APP_PRELOAD_BIN, PRTE_ATTR_GLOBAL,
NULL, PMIX_BOOL);

/*** ENVIRONMENTAL VARIABLE DIRECTIVES ***/
/* there can be multiple of these, so we add them to the attribute list */
} else if (PMIX_CHECK_KEY(info, PMIX_SET_ENVAR)) {
Expand Down Expand Up @@ -853,7 +862,7 @@ static void interim(int sd, short args, void *cbdata)
}

/* transfer the job info across */
rc = prte_pmix_xfer_job_info(jdata, cd->info);
rc = prte_pmix_xfer_job_info(jdata, cd->info, cd->ninfo);
if (PRTE_SUCCESS != rc) {
goto complete;
}
Expand Down
4 changes: 3 additions & 1 deletion src/prted/pmix/pmix_server_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ PRTE_EXPORT extern int prte_pmix_server_register_tool(pmix_nspace_t nspace);

PRTE_EXPORT extern int pmix_server_cache_job_info(prte_job_t *jdata, pmix_info_t *info);

PRTE_EXPORT extern int prte_pmix_xfer_job_info(prte_job_t *jdata, pmix_info_t *info);
PRTE_EXPORT extern int prte_pmix_xfer_job_info(prte_job_t *jdata,
pmix_info_t *iptr,
size_t ninfo);

PRTE_EXPORT extern int prte_pmix_xfer_app(prte_job_t *jdata, pmix_app_t *app);

Expand Down
6 changes: 4 additions & 2 deletions src/prted/pmix/pmix_server_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void localrelease(void *cbdata)
static int process_directive(pmix_server_req_t *req)
{
char *user_refid = NULL, *alloc_refid = NULL;
pmix_info_t *personality = NULL;
pmix_info_t *personality = NULL, *iptr;
pmix_proc_t *requestor = NULL;
char *hosts = NULL;
prte_session_t *session = NULL;
Expand Down Expand Up @@ -98,7 +98,9 @@ static int process_directive(pmix_server_req_t *req)
}
}
// transfer the job description across
rc = prte_pmix_xfer_job_info(jdata, &req->info[n]);
iptr = (pmix_info_t*)req->info[n].value.data.darray->array;
i = req->info[n].value.data.darray->size;
rc = prte_pmix_xfer_job_info(jdata, iptr, i);
if (PRTE_SUCCESS != rc) {
PRTE_ERROR_LOG(rc);
rc = prte_pmix_convert_rc(rc);
Expand Down

0 comments on commit 0991910

Please sign in to comment.