From 382e00bf7055df799fc8c51791f09ab3256fd932 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Wed, 22 Sep 2010 22:51:43 +0000 Subject: [PATCH] Modify smap to function with more generic 3-D cluster per Mark Seager's description of TLCC2 procurement. --- src/smap/grid_functions.c | 32 ++++++++++++++++++++++++++++++++ src/smap/job_functions.c | 26 ++++++++++++++++---------- src/smap/partition_functions.c | 20 +++++++++++++------- src/smap/reservation_functions.c | 26 ++++++++++++++++---------- src/smap/smap.h | 1 + 5 files changed, 78 insertions(+), 27 deletions(-) diff --git a/src/smap/grid_functions.c b/src/smap/grid_functions.c index 365a58ffd0b..ea0d687916e 100644 --- a/src/smap/grid_functions.c +++ b/src/smap/grid_functions.c @@ -40,9 +40,19 @@ #include "src/smap/smap.h" +static int _coord(char coord) +{ + if ((coord >= '0') && (coord <= '9')) + return (coord - '0'); + if ((coord >= 'A') && (coord <= 'Z')) + return (coord - 'A'); + return -1; +} + extern int set_grid_inx(int start, int end, int count) { int x, y, z; + for (y = DIM_SIZE[Y] - 1; y >= 0; y--) { for (z = 0; z < DIM_SIZE[Z]; z++) { for (x = 0; x < DIM_SIZE[X]; x++) { @@ -67,6 +77,28 @@ extern int set_grid_inx(int start, int end, int count) return 1; } +extern int set_grid_inx2(char *node_names, int count) +{ + hostlist_t hl; + hostlist_iterator_t hl_iter; + char *host; + int i, x, y, z; + + hl = hostlist_create(node_names); + hl_iter = hostlist_iterator_create(hl); + while ((host = hostlist_next(hl_iter))) { + i = strlen(host); + x = _coord(host[i-3]); + y = _coord(host[i-2]); + z = _coord(host[i-1]); + ba_system_ptr->grid[x][y][z].letter = letters[count%62]; + ba_system_ptr->grid[x][y][z].color = colors[count%6]; + free(host); + } + hostlist_iterator_destroy(hl_iter); + return 1; +} + /* This function is only called when HAVE_BG is set */ extern int set_grid_bg(int *start, int *end, int count, int set) { diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index c2518027bb0..9f4c2a438aa 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -2,7 +2,7 @@ * job_functions.c - Functions related to job display mode of smap. ***************************************************************************** * Copyright (C) 2002-2007 The Regents of the University of California. - * Copyright (C) 2008-2009 Lawrence Livermore National Security. + * Copyright (C) 2008-2010 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Danny Auble <da@llnl.gov> * @@ -126,15 +126,21 @@ extern void get_job(void) } if (job_ptr->node_inx[0] != -1) { - int j = 0; - job_ptr->num_nodes = 0; - while (job_ptr->node_inx[j] >= 0) { - job_ptr->num_nodes += - (job_ptr->node_inx[j + 1] + 1) - - job_ptr->node_inx[j]; - set_grid_inx(job_ptr->node_inx[j], - job_ptr->node_inx[j + 1], count); - j += 2; + if (((params.cluster_flags & CLUSTER_FLAG_BG) == 0) && + (params.cluster_dims == 3)) { + set_grid_inx2(job_ptr->nodes, count); + } else { + int j = 0; + job_ptr->num_nodes = 0; + while (job_ptr->node_inx[j] >= 0) { + job_ptr->num_nodes += + (job_ptr->node_inx[j + 1] + 1) - + job_ptr->node_inx[j]; + set_grid_inx(job_ptr->node_inx[j], + job_ptr->node_inx[j + 1], + count); + j += 2; + } } if(!params.commandline) { diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 18b9355f1a4..d8e40f265ba 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -3,7 +3,7 @@ * mode of smap. ***************************************************************************** * Copyright (C) 2004-2007 The Regents of the University of California. - * Copyright (C) 2008 Lawrence Livermore National Security. + * Copyright (C) 2008-2010 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Danny Auble <da@llnl.gov> * @@ -78,7 +78,7 @@ static int _make_nodelist(char *nodes, List nodelist); extern void get_slurm_part() { - int error_code, i, j, recs, count = 0; + int error_code, i, recs, count = 0; static partition_info_msg_t *part_info_ptr = NULL; static partition_info_msg_t *new_part_ptr = NULL; partition_info_t part; @@ -135,7 +135,6 @@ extern void get_slurm_part() if(params.hl) nodes_req = get_requested_node_bitmap(); for (i = 0; i < recs; i++) { - j = 0; part = new_part_ptr->partition_array[i]; if(nodes_req) { @@ -147,11 +146,18 @@ extern void get_slurm_part() if(!overlap) continue; } - while (part.node_inx[j] >= 0) { - set_grid_inx(part.node_inx[j], - part.node_inx[j + 1], count); - j += 2; + if (((params.cluster_flags & CLUSTER_FLAG_BG) == 0) && + (params.cluster_dims == 3)) { + set_grid_inx2(part.nodes, count); + } else { + int j = 0; + while (part.node_inx[j] >= 0) { + set_grid_inx(part.node_inx[j], + part.node_inx[j + 1], count); + j += 2; + } } + if(!params.commandline) { if(i>=text_line_cnt) { part.flags = (int) letters[count%62]; diff --git a/src/smap/reservation_functions.c b/src/smap/reservation_functions.c index c3c9ddc5860..2b9bf17250d 100644 --- a/src/smap/reservation_functions.c +++ b/src/smap/reservation_functions.c @@ -3,7 +3,7 @@ * of smap. ***************************************************************************** * Copyright (C) 2002-2007 The Regents of the University of California. - * Copyright (C) 2008-2009 Lawrence Livermore National Security. + * Copyright (C) 2008-2010 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Morris Jette <jette1@llnl.gov> * CODE-OCEC-09-009. All rights reserved. @@ -116,15 +116,21 @@ extern void get_reservation(void) active = 0; if (active && (resv.node_inx[0] != -1)) { - int j = 0; - resv.node_cnt = 0; - while (resv.node_inx[j] >= 0) { - resv.node_cnt += - (resv.node_inx[j + 1] + 1) - - resv.node_inx[j]; - set_grid_inx(resv.node_inx[j], - resv.node_inx[j + 1], count); - j += 2; + if (((params.cluster_flags & CLUSTER_FLAG_BG) == 0) && + (params.cluster_dims == 3)) { + set_grid_inx2(resv.node_list, count); + } else { + int j = 0; + resv.node_cnt = 0; + while (resv.node_inx[j] >= 0) { + resv.node_cnt += + (resv.node_inx[j + 1] + 1) - + resv.node_inx[j]; + set_grid_inx(resv.node_inx[j], + resv.node_inx[j + 1], + count); + j += 2; + } } } diff --git a/src/smap/smap.h b/src/smap/smap.h index ead9f0c0eb0..1cfd60425af 100644 --- a/src/smap/smap.h +++ b/src/smap/smap.h @@ -144,6 +144,7 @@ extern int quiet_flag; extern void init_grid(node_info_msg_t *node_info_ptr); extern int set_grid_inx(int start, int end, int count); +extern int set_grid_inx2(char *node_names, int count); extern int set_grid_bg(int *start, int *end, int count, int set); extern void print_grid(int dir); bitstr_t *get_requested_node_bitmap(); -- GitLab