From f16e496a76d6a4088b0b941727fc0610baacb0e7 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Mon, 18 Oct 2010 22:59:03 +0000 Subject: [PATCH] fix for all types of systems --- .../block_allocator/block_allocator.c | 112 +++++++++--------- .../block_allocator/block_allocator.h | 2 - src/sview/defaults.c | 6 +- 3 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c index e360489bce3..3fbf3b8fcda 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.c +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c @@ -214,6 +214,8 @@ static int _set_one_dim(int *start, int *end, int *coord); /* */ static void _destroy_geo(void *object); +static int _coord(char coord); + extern char *ba_passthroughs_string(uint16_t passthrough) { char *pass = NULL; @@ -1894,71 +1896,57 @@ extern int set_all_bps_except(char *bps) */ extern void init_grid(node_info_msg_t * node_info_ptr) { - int i = 0, x, y, z; -// char *host; + int i, j, x, y, z; + ba_node_t *ba_node = NULL; + char *host; - for (x = 0; x < DIM_SIZE[X]; x++) { - for (y = 0; y < DIM_SIZE[Y]; y++) { - for (z = 0; z < DIM_SIZE[Z]; z++) { - ba_node_t *ba_node = - &ba_system_ptr->grid[x][y][z]; - if (!node_info_ptr) { + if (!node_info_ptr) { + for (x = 0; x < DIM_SIZE[X]; x++) { + for (y = 0; y < DIM_SIZE[Y]; y++) { + for (z = 0; z < DIM_SIZE[Z]; z++) { + ba_node = &ba_system_ptr->grid[x][y][z]; ba_node->color = 7; ba_node->letter = '.'; ba_node->state = NODE_STATE_IDLE; - } else { - node_info_t *node_ptr = - &node_info_ptr->node_array[i]; - ba_node->color = 7; - if (IS_NODE_DOWN(node_ptr) - || IS_NODE_DRAIN(node_ptr)) { - ba_node->color = 0; - ba_node->letter = '#'; - if (_initialized) { - ba_update_node_state( - ba_node, - node_ptr-> - node_state); - } - } else { - ba_node->color = 7; - ba_node->letter = '.'; - } - ba_node->state = node_ptr->node_state; } - ba_node->index = i++; } } + return; + } + + for (j = 0; j < node_info_ptr->record_count; j++) { + node_info_t *node_ptr = &node_info_ptr->node_array[j]; + host = node_ptr->name; + if (!host) + continue; + if (cluster_dims == 1) { + x = j; + y = 0; + z = 0; + } else { + if ((i = strlen(host)) < 3) + continue; + x = _coord(host[i-3]); + y = _coord(host[i-2]); + z = _coord(host[i-1]); + } + + if ((x < 0) || (y < 0) || (z < 0)) + continue; + ba_node = &ba_system_ptr->grid[x][y][z]; + ba_node->color = 7; + if (IS_NODE_DOWN(node_ptr) || IS_NODE_DRAIN(node_ptr)) { + ba_node->color = 0; + ba_node->letter = '#'; + if (_initialized) + ba_update_node_state( + ba_node, node_ptr->node_state); + } else { + ba_node->color = 7; + ba_node->letter = '.'; + } + ba_node->state = node_ptr->node_state; } - /* if (node_info_ptr == NULL) */ - /* return; */ - - /* for (j = 0; j < node_info_ptr->record_count; j++) { */ - /* node_ptr = &node_info_ptr->node_array[j]; */ - /* host = node_ptr->name; */ - /* if ((host == NULL) || ((i = strlen(host)) < 3)) */ - /* continue; */ - /* x = _coord(host[i-3]); */ - /* y = _coord(host[i-2]); */ - /* z = _coord(host[i-1]); */ - /* if ((x < 0) || (y < 0) || (z < 0)) */ - /* continue; */ - /* ba_system_ptr->grid[x][y][z].color = 7; */ - /* if (IS_NODE_DOWN(node_ptr) || IS_NODE_DRAIN(node_ptr)) { */ - /* /\* default values set above *\/ */ - /* /\* ba_system_ptr->grid[x][y][z].color = 0; *\/ */ - /* /\* ba_system_ptr->grid[x][y][z].letter = '#'; *\/ */ - /* if (_initialized) { */ - /* ba_update_node_state(&ba_system_ptr-> */ - /* grid[x][y][z], */ - /* node_ptr->node_state); */ - /* } */ - /* } else { */ - /* ba_system_ptr->grid[x][y][z].color = 7; */ - /* ba_system_ptr->grid[x][y][z].letter = '.'; */ - /* } */ - /* ba_system_ptr->grid[x][y][z].state = node_ptr->node_state; */ - /* } */ } /* @@ -5077,3 +5065,13 @@ static void _destroy_geo(void *object) int *geo_ptr = (int *)object; xfree(geo_ptr); } + +static int _coord(char coord) +{ + if ((coord >= '0') && (coord <= '9')) + return (coord - '0'); + if ((coord >= 'A') && (coord <= 'Z')) + return (coord - 'A'); + return -1; +} + diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.h b/src/plugins/select/bluegene/block_allocator/block_allocator.h index ae97ec540cf..421da7507e2 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.h +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.h @@ -225,8 +225,6 @@ typedef struct { int coord[HIGHEST_DIMENSIONS]; /* color of letter used in smap */ int color; - /* midplane index used for easy look up of the miplane */ - int index; /* letter used in smap */ char letter; // int phys_x; // no longer needed diff --git a/src/sview/defaults.c b/src/sview/defaults.c index a60203b556f..222e48e095d 100644 --- a/src/sview/defaults.c +++ b/src/sview/defaults.c @@ -868,8 +868,10 @@ extern int save_defaults(bool final_save) list_iterator_destroy(itr); } - list_destroy(page_opts->col_list); - page_opts->col_list = NULL; + if (page_opts->col_list) { + list_destroy(page_opts->col_list); + page_opts->col_list = NULL; + } if (tmp_str2) { replspace(tmp_str2); -- GitLab