diff --git a/orte/mca/rmaps/base/rmaps_base_support_fns.c b/orte/mca/rmaps/base/rmaps_base_support_fns.c index 2cbd39b8f6..2aa857ebb1 100644 --- a/orte/mca/rmaps/base/rmaps_base_support_fns.c +++ b/orte/mca/rmaps/base/rmaps_base_support_fns.c @@ -614,7 +614,8 @@ int orte_rmaps_base_compute_local_ranks(orte_job_t *jdata) orte_vpid_t minv, minv2; orte_local_rank_t local_rank; orte_job_map_t *map; - + orte_app_context_t *app; + OPAL_OUTPUT_VERBOSE((5, orte_rmaps_base.rmaps_output, "%s rmaps:base:compute_usage", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -684,6 +685,24 @@ int orte_rmaps_base_compute_local_ranks(orte_job_t *jdata) } } + /* compute app_rank */ + for (i=0; i < jdata->apps->size; i++) { + if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) { + continue; + } + k=0; + /* loop thru all procs in job to find those from this app_context */ + for (j=0; j < jdata->procs->size; j++) { + if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, j))) { + continue; + } + if (proc->app_idx != app->idx) { + continue; + } + proc->app_rank = k++; + } + } + return ORTE_SUCCESS; } diff --git a/orte/runtime/data_type_support/orte_dt_print_fns.c b/orte/runtime/data_type_support/orte_dt_print_fns.c index 1320339458..56f7086309 100644 --- a/orte/runtime/data_type_support/orte_dt_print_fns.c +++ b/orte/runtime/data_type_support/orte_dt_print_fns.c @@ -497,8 +497,8 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_ asprintf(&tmp, "\n%sData for proc: %s", pfx2, ORTE_NAME_PRINT(&src->name)); - asprintf(&tmp2, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu", tmp, pfx2, - (long)src->pid, (unsigned long)src->local_rank, (unsigned long)src->node_rank); + asprintf(&tmp2, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu\tApp rank: %d", tmp, pfx2, + (long)src->pid, (unsigned long)src->local_rank, (unsigned long)src->node_rank, src->app_rank); free(tmp); tmp = tmp2; diff --git a/orte/runtime/orte_globals.c b/orte/runtime/orte_globals.c index 8dabdc0236..073605d204 100644 --- a/orte/runtime/orte_globals.c +++ b/orte/runtime/orte_globals.c @@ -887,6 +887,7 @@ static void orte_proc_construct(orte_proc_t* proc) proc->pid = 0; proc->local_rank = ORTE_LOCAL_RANK_INVALID; proc->node_rank = ORTE_NODE_RANK_INVALID; + proc->app_rank = -1; proc->last_errmgr_state = ORTE_PROC_STATE_UNDEF; proc->state = ORTE_PROC_STATE_UNDEF; proc->app_idx = 0; diff --git a/orte/runtime/orte_globals.h b/orte/runtime/orte_globals.h index 38476353be..ff51640888 100644 --- a/orte/runtime/orte_globals.h +++ b/orte/runtime/orte_globals.h @@ -460,6 +460,11 @@ struct orte_proc_t { * know which static IP port to use */ orte_node_rank_t node_rank; + /* rank of this proc within its app context - this + * will just equal its vpid for single app_context + * applications + */ + int32_t app_rank; /* Last state used to trigger the errmgr for this proc */ orte_proc_state_t last_errmgr_state; /* process state */