From 593fc388a9be48b54bc1c444ce8ee248ce1cb53a Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 15 Nov 2011 11:10:39 +0000 Subject: [PATCH] Make it a little more obvious as to which nodes are from each topology by labeling them with a letter. This commit was SVN r25477. --- orte/mca/ras/simulator/ras_sim_module.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/orte/mca/ras/simulator/ras_sim_module.c b/orte/mca/ras/simulator/ras_sim_module.c index 60d06bcb22..2409277021 100644 --- a/orte/mca/ras/simulator/ras_sim_module.c +++ b/orte/mca/ras/simulator/ras_sim_module.c @@ -51,6 +51,7 @@ static int allocate(opal_list_t *nodes) bool use_local_topology = false; #endif char **node_cnt=NULL; + char prefix[6]; node_cnt = opal_argv_split(mca_ras_simulator_component.num_nodes, ','); @@ -72,21 +73,22 @@ static int allocate(opal_list_t *nodes) #endif - /* count the total number of nodes */ - val = 0; - for (n=0; NULL != node_cnt[n]; n++) { - val += strtol(node_cnt[n], NULL, 10); - } - /* get number of digits */ - for (dig=0; 0 != val; dig++) { - val /= 10; - } + /* setup the prefix to the node names */ + snprintf(prefix, 6, "nodeA"); /* process the request */ - val = 0; for (n=0; NULL != node_cnt[n]; n++) { num_nodes = strtol(node_cnt[n], NULL, 10); + /* get number of digits */ + val = num_nodes; + for (dig=0; 0 != val; dig++) { + val /= 10; + } + + /* set the prefix for this group of nodes */ + prefix[4] += n; + /* check for topology */ #if OPAL_HAVE_HWLOC if (use_local_topology) { @@ -148,7 +150,7 @@ static int allocate(opal_list_t *nodes) for (i=0; i < num_nodes; i++) { node = OBJ_NEW(orte_node_t); - asprintf(&node->name, "node%0*d", dig, val++); + asprintf(&node->name, "%s%0*d", prefix, dig, val++); node->state = ORTE_NODE_STATE_UP; node->slots_inuse = 0; node->slots_max = mca_ras_simulator_component.slots_max;