Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opal/mca/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ OPAL_DECLSPEC int mca_base_is_component_required(opal_list_t *components_availab
/* mca_base_cmd_line.c */

OPAL_DECLSPEC int mca_base_cmd_line_setup(opal_cmd_line_t *cmd);
OPAL_DECLSPEC int mca_base_cmd_line_process_args(char **argv,
OPAL_DECLSPEC int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd,
char ***app_env,
char ***global_env);
OPAL_DECLSPEC void mca_base_cmd_line_wrap_args(char **args);
Expand Down
49 changes: 25 additions & 24 deletions opal/mca/base/mca_base_cmd_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,29 @@ int mca_base_cmd_line_setup(opal_cmd_line_t *cmd)
/*
* Look for and handle any -mca options on the command line
*/
int mca_base_cmd_line_process_args(char **argv,
int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd,
char ***context_env, char ***global_env)
{
int i, rc;
int i, num_insts, rc;
char **params;
char **values;

/* If no relevant parameters were given, just return */

if (!opal_cmd_line_is_taken(cmd, OPAL_MCA_CMD_LINE_ID) &&
!opal_cmd_line_is_taken(cmd, "g"OPAL_MCA_CMD_LINE_ID)) {
return OPAL_SUCCESS;
}

/* Handle app context-specific parameters */

num_insts = opal_cmd_line_get_ninsts(cmd, OPAL_MCA_CMD_LINE_ID);
params = values = NULL;
for (i = 0; NULL != argv[i]; ++i) {
if (0 == strcmp("-"OPAL_MCA_CMD_LINE_ID, argv[i]) ||
0 == strcmp("--"OPAL_MCA_CMD_LINE_ID, argv[i])) {
if (NULL == argv[i+1] || NULL == argv[i+2]) {
return OPAL_ERR_BAD_PARAM;
}
if (OPAL_SUCCESS != (rc = process_arg(argv[i+1], argv[i+2],
&params, &values))) {
return rc;
}
i += 2;
for (i = 0; i < num_insts; ++i) {
if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, OPAL_MCA_CMD_LINE_ID, i, 0),
opal_cmd_line_get_param(cmd, OPAL_MCA_CMD_LINE_ID, i, 1),
&params, &values))) {
return rc;
}
}
if (NULL != params) {
Expand All @@ -121,19 +125,15 @@ int mca_base_cmd_line_process_args(char **argv,
opal_argv_free(values);
}

/* Handle global parameters */

num_insts = opal_cmd_line_get_ninsts(cmd, "g"OPAL_MCA_CMD_LINE_ID);
params = values = NULL;
for (i = 0; NULL != argv[i]; ++i) {
if (0 == strcmp("-g"OPAL_MCA_CMD_LINE_ID, argv[i]) ||
0 == strcmp("--g"OPAL_MCA_CMD_LINE_ID, argv[i])) {
if (NULL == argv[i+1] || NULL == argv[i+2]) {
return OPAL_ERR_BAD_PARAM;
}
if (OPAL_SUCCESS != (rc = process_arg(argv[i+1], argv[i+2],
&params, &values))) {
return rc;
}
i += 2;
for (i = 0; i < num_insts; ++i) {
if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, "g"OPAL_MCA_CMD_LINE_ID, i, 0),
opal_cmd_line_get_param(cmd, "g"OPAL_MCA_CMD_LINE_ID, i, 1),
&params, &values))) {
return rc;
}
}
if (NULL != params) {
Expand All @@ -148,6 +148,7 @@ int mca_base_cmd_line_process_args(char **argv,
}



/*
* Process a single MCA argument.
*/
Expand Down
2 changes: 1 addition & 1 deletion opal/runtime/opal_info_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ int opal_info_init(int argc, char **argv,
exit(cmd_error ? 1 : 0);
}

mca_base_cmd_line_process_args(argv, &app_env, &global_env);
mca_base_cmd_line_process_args(opal_info_cmd_line, &app_env, &global_env);


/* set the flags */
Expand Down
137 changes: 35 additions & 102 deletions orte/mca/rmaps/base/rmaps_base_map_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
{
orte_job_t *jdata;
orte_job_map_t *map;
orte_node_t *node;
int rc, i;
bool did_map, given;
Expand Down Expand Up @@ -113,94 +112,21 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
}
}

/* NOTE: CHECK FOR JDATA->MAP == NULL. IF IT IS, THEN USE
* THE VALUES THAT WERE READ BY THE LOCAL MCA PARAMS. THE
* PLM PROXY WILL SEND A JOB-OBJECT THAT WILL INCLUDE ANY
* MAPPING DIRECTIVES - OTHERWISE, THAT OBJECT WILL HAVE A
* NULL MAP FIELD
* LONE EXCEPTION - WE COPY DISPLAY MAP ACROSS IF THEY
* DIDN'T SET IT
*/
if (NULL == jdata->map) {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps: creating new map for job %s",
ORTE_JOBID_PRINT(jdata->jobid));
/* create a map object where we will store the results */
map = OBJ_NEW(orte_job_map_t);
if (NULL == map) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
OBJ_RELEASE(caddy);
return;
}
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps: nprocs %s",
ORTE_VPID_PRINT(nprocs));

opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps: setting mapping policies for job %s",
ORTE_JOBID_PRINT(jdata->jobid));

if (!jdata->map->display_map) {
jdata->map->display_map = orte_rmaps_base.display_map;
}
/* set the default mapping policy IFF it wasn't provided */
if (!ORTE_MAPPING_POLICY_IS_SET(jdata->map->mapping)) {
if (ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps mapping given - using default");
map->mapping = orte_rmaps_base.mapping;
"mca:rmaps mapping given by MCA param");
jdata->map->mapping = orte_rmaps_base.mapping;
} else {
/* default based on number of procs */
if (nprocs <= 2) {
if (1 < orte_rmaps_base.cpus_per_rank) {
/* assigning multiple cpus to a rank requires that we map to
* objects that have multiple cpus in them, so default
* to byslot if nothing else was specified by the user.
*/
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps[%d] mapping not given - using byslot", __LINE__);
ORTE_SET_MAPPING_POLICY(map->mapping, ORTE_MAPPING_BYSLOT);
} else if (opal_hwloc_use_hwthreads_as_cpus) {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps[%d] mapping not given - using byhwthread", __LINE__);
ORTE_SET_MAPPING_POLICY(map->mapping, ORTE_MAPPING_BYHWTHREAD);
} else {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps[%d] mapping not given - using bycore", __LINE__);
ORTE_SET_MAPPING_POLICY(map->mapping, ORTE_MAPPING_BYCORE);
}
} else {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps[%d] mapping not given - using bysocket", __LINE__);
ORTE_SET_MAPPING_POLICY(map->mapping, ORTE_MAPPING_BYSOCKET);
}
/* check for oversubscribe directives */
if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) {
ORTE_SET_MAPPING_DIRECTIVE(map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
} else {
/* pass along the directive */
if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
} else {
ORTE_UNSET_MAPPING_DIRECTIVE(map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
}
}
/* check for no-use-local directive */
if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(map->mapping, ORTE_MAPPING_NO_USE_LOCAL);
}
}
/* ranking was already handled, so just use it here */
map->ranking = orte_rmaps_base.ranking;

if (NULL != orte_rmaps_base.ppr) {
map->ppr = strdup(orte_rmaps_base.ppr);
}
map->cpus_per_rank = orte_rmaps_base.cpus_per_rank;
map->display_map = orte_rmaps_base.display_map;
/* assign the map object to this job */
jdata->map = map;
} else {
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
"mca:rmaps: setting mapping policies for job %s",
ORTE_JOBID_PRINT(jdata->jobid));

if (!jdata->map->display_map) {
jdata->map->display_map = orte_rmaps_base.display_map;
}
/* set the default mapping policy IFF it wasn't provided */
if (!ORTE_MAPPING_POLICY_IS_SET(jdata->map->mapping)) {
/* default based on number of procs */
if (nprocs <= 2) {
if (1 < orte_rmaps_base.cpus_per_rank) {
Expand All @@ -226,26 +152,33 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
ORTE_SET_MAPPING_POLICY(jdata->map->mapping, ORTE_MAPPING_BYSOCKET);
}
}
/* check for oversubscribe directives */
if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) {
}
/* check for oversubscribe directives */
if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) {
ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
} else {
/* pass along the directive */
if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
} else {
/* pass along the directive */
if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
} else {
ORTE_UNSET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
}
}
/* check for no-use-local directive */
if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_USE_LOCAL);
}
/* ditto for rank and bind policies */
if (!ORTE_RANKING_POLICY_IS_SET(jdata->map->ranking)) {
jdata->map->ranking = orte_rmaps_base.ranking;
ORTE_UNSET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
}
}
/* check for no-use-local directive */
if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_USE_LOCAL);
}
/* ditto for rank policy */
if (!ORTE_RANKING_POLICY_IS_SET(jdata->map->ranking)) {
jdata->map->ranking = orte_rmaps_base.ranking;
}

if (NULL == jdata->map->ppr && NULL != orte_rmaps_base.ppr) {
jdata->map->ppr = strdup(orte_rmaps_base.ppr);
}
if (0 == jdata->map->cpus_per_rank) {
jdata->map->cpus_per_rank = orte_rmaps_base.cpus_per_rank;
}

/* define the binding policy for this job - if the user specified one
* already (e.g., during the call to comm_spawn), then we don't
Expand Down
Loading