Skip to content

Commit

Permalink
Update mapping system
Browse files Browse the repository at this point in the history
Correctly transfer job-level mapping directives for dynamically spawned
jobs to the mapping system.

Signed-off-by: Ralph Castain <rhc@open-mpi.org>
  • Loading branch information
Ralph Castain committed Sep 26, 2018
1 parent 23271c9 commit 45f23ca
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
3 changes: 2 additions & 1 deletion orte/mca/rmaps/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ ORTE_DECLSPEC int orte_rmaps_base_filter_nodes(orte_app_context_t *app,
opal_list_t *nodes,
bool remove);

ORTE_DECLSPEC int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
ORTE_DECLSPEC int orte_rmaps_base_set_mapping_policy(orte_job_t *jdata,
orte_mapping_policy_t *policy,
char **device, char *spec);
ORTE_DECLSPEC int orte_rmaps_base_set_ranking_policy(orte_ranking_policy_t *policy,
orte_mapping_policy_t mapping,
Expand Down
17 changes: 13 additions & 4 deletions orte/mca/rmaps/base/rmaps_base_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static int orte_rmaps_base_open(mca_base_open_flag_t flags)
"rmaps_base_cpus_per_proc", "rmaps_base_mapping_policy=<obj>:PE=N, default <obj>=NUMA");
}

if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(&orte_rmaps_base.mapping,
if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(NULL, &orte_rmaps_base.mapping,
&orte_rmaps_base.device,
rmaps_base_mapping_policy))) {
return rc;
Expand Down Expand Up @@ -593,7 +593,8 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp)
return ORTE_ERR_TAKE_NEXT_OPTION;
}

int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
int orte_rmaps_base_set_mapping_policy(orte_job_t *jdata,
orte_mapping_policy_t *policy,
char **device, char *inspec)
{
char *ck;
Expand Down Expand Up @@ -681,7 +682,11 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
}
}
/* now save the pattern */
orte_rmaps_base.ppr = strdup(ck);
if (NULL == jdata || NULL == jdata->map) {
orte_rmaps_base.ppr = strdup(ck);
} else {
jdata->map->ppr = strdup(ck);
}
ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR);
ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN);
free(spec);
Expand Down Expand Up @@ -747,7 +752,11 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
}

setpolicy:
*policy = tmp;
if (NULL == jdata || NULL == jdata->map) {
*policy = tmp;
} else {
jdata->map->mapping = tmp;
}

return ORTE_SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion orte/orted/orted_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ int orte_submit_job(char *argv[], int *index,
jdata->map = OBJ_NEW(orte_job_map_t);

if (NULL != orte_cmd_options.mapping_policy) {
if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(&jdata->map->mapping, NULL, orte_cmd_options.mapping_policy))) {
if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping, NULL, orte_cmd_options.mapping_policy))) {
ORTE_ERROR_LOG(rc);
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion orte/orted/pmix/pmix_server_dyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
orte_rmaps_base_print_mapping(orte_rmaps_base.mapping));
return ORTE_ERR_BAD_PARAM;
}
rc = orte_rmaps_base_set_mapping_policy(&jdata->map->mapping,
rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping,
NULL, info->data.string);
if (ORTE_SUCCESS != rc) {
return rc;
Expand Down
16 changes: 8 additions & 8 deletions orte/orted/pmix/pmix_server_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static void _query(int sd, short args, void *cbdata)
orte_job_t *jdata;
orte_proc_t *proct;
orte_app_context_t *app;
int rc, i, k, num_replies;
int rc = ORTE_SUCCESS, i, k, num_replies;
opal_list_t *results, targets, *array;
size_t n;
uint32_t key;
Expand Down Expand Up @@ -716,7 +716,7 @@ static void _query(int sd, short args, void *cbdata)
}
}
if (ORTE_JOBID_INVALID == jobid) {
rc = ORTE_ERR_BAD_PARAM;
rc = ORTE_ERR_NOT_FOUND;
goto done;
}
/* construct a list of values with opal_proc_info_t
Expand Down Expand Up @@ -810,12 +810,12 @@ static void _query(int sd, short args, void *cbdata)
}

done:
if (0 == opal_list_get_size(results)) {
rc = ORTE_ERR_NOT_FOUND;
} else if (opal_list_get_size(results) < opal_list_get_size(cd->info)) {
rc = ORTE_ERR_PARTIAL_SUCCESS;
} else {
rc = ORTE_SUCCESS;
if (ORTE_SUCCESS == rc) {
if (0 == opal_list_get_size(results)) {
rc = ORTE_ERR_NOT_FOUND;
} else if (opal_list_get_size(results) < opal_list_get_size(cd->info)) {
rc = ORTE_ERR_PARTIAL_SUCCESS;
}
}
cd->infocbfunc(rc, results, cd->cbdata, qrel, results);
}
Expand Down

0 comments on commit 45f23ca

Please sign in to comment.