From 4f89adae0c735a93191bac7be2c398a45f85c98f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sun, 28 Sep 2008 16:44:09 +0000 Subject: [PATCH] Prettify the user level display of allocation and map to make it easier to see and understand This commit was SVN r19655. --- orte/mca/ras/base/ras_base_allocate.c | 10 ++++----- .../data_type_support/orte_dt_print_fns.c | 21 ++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/orte/mca/ras/base/ras_base_allocate.c b/orte/mca/ras/base/ras_base_allocate.c index f2a1d19111..9e4752d98c 100644 --- a/orte/mca/ras/base/ras_base_allocate.c +++ b/orte/mca/ras/base/ras_base_allocate.c @@ -316,6 +316,8 @@ DISPLAY: if (orte_xml_output) { asprintf(&tmp, "\n"); pfx = "\t"; + } else { + asprintf(&tmp, "\n====================== ALLOCATED NODES ======================\n"); } alloc = (orte_node_t**)orte_node_pool->addr; for (i=0; i < orte_node_pool->size; i++) { @@ -333,13 +335,11 @@ DISPLAY: } } if (orte_xml_output) { - asprintf(&tmp2, "%s\n", tmp); - free(tmp); + opal_output(orte_ras_base.alloc_output, "%s\n", tmp); } else { - tmp2 = tmp; + opal_output(orte_ras_base.alloc_output, "%s\n\n=================================================================\n", tmp); } - opal_output(orte_ras_base.alloc_output, "%s", tmp2); - free(tmp2); + free(tmp); } return rc; 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 6a785e1608..bd64f96447 100644 --- a/orte/runtime/data_type_support/orte_dt_print_fns.c +++ b/orte/runtime/data_type_support/orte_dt_print_fns.c @@ -299,6 +299,15 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_ if (!orte_devel_level_output) { /* just provide a simple output for users */ + if (0 == src->num_procs) { + /* no procs mapped yet, so just show allocation */ + asprintf(&tmp, "\n%sData for node: Name: %s\tNum slots: %ld\tMax slots: %ld", + pfx2, (NULL == src->name) ? "UNKNOWN" : src->name, + (long)src->slots, (long)src->slots_max); + free(pfx2); + *output = tmp; + return ORTE_SUCCESS; + } asprintf(&tmp, "\n%sData for node: Name: %s\tNum procs: %ld", pfx2, (NULL == src->name) ? "UNKNOWN" : src->name, (long)src->num_procs); @@ -593,12 +602,15 @@ int orte_dt_print_map(char **output, char *prefix, orte_job_map_t *src, opal_dat } free(tmp); tmp = tmp2; + } else { + /* this is being printed for a user, so let's make it easier to see */ + asprintf(&tmp, "\n%s======================== JOB MAP ========================", pfx2); } for (i=0; i < src->nodes->size; i++) { if (NULL != src->nodes->addr[i]) { - if (ORTE_SUCCESS != (rc = opal_dss.print(&tmp2, pfx, src->nodes->addr[i], ORTE_NODE))) { + if (ORTE_SUCCESS != (rc = opal_dss.print(&tmp2, pfx2, src->nodes->addr[i], ORTE_NODE))) { ORTE_ERROR_LOG(rc); free(pfx); free(tmp); @@ -615,6 +627,13 @@ int orte_dt_print_map(char **output, char *prefix, orte_job_map_t *src, opal_dat } } + if (!orte_devel_level_output) { + /* this is being printed for a user, so let's make it easier to see */ + asprintf(&tmp2, "%s\n\n%s=============================================================\n", tmp, pfx2); + free(tmp); + tmp = tmp2; + } + /* set the return */ *output = tmp;