diff --git a/src/partition_allocator/Makefile.am b/src/partition_allocator/Makefile.am index 876048a63fed4bee4d0afb1552b8a9cf9b52c4bb..d0789fc6baff41c1ea13f0bcb85d834b01c651a5 100644 --- a/src/partition_allocator/Makefile.am +++ b/src/partition_allocator/Makefile.am @@ -15,6 +15,7 @@ INCLUDES = -I$(top_srcdir) # $(top_builddir)/src/api/libslurm.la # partition_allocator_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) +# CFLAGS = -DBUILD_EXE # making a .la noinst_LTLIBRARIES = libpartition_allocator.la diff --git a/src/partition_allocator/partition_allocator.c b/src/partition_allocator/partition_allocator.c index b3290ed4da11f767806653da9fbff8f53039bbbc..b989034c9e679564f08c3499d159505f992d8729 100644 --- a/src/partition_allocator/partition_allocator.c +++ b/src/partition_allocator/partition_allocator.c @@ -308,7 +308,7 @@ void pa_init(node_info_msg_t *node_info_ptr) if(DIM_SIZE[X]==0 && DIM_SIZE[X]==0 && DIM_SIZE[X]==0) { printf("You need to give me the dimensions\nto set up the system. using 2x4x4\n"); - DIM_SIZE[X] = 2; + DIM_SIZE[X] = 8; DIM_SIZE[Y] = 4; DIM_SIZE[Z] = 4; @@ -415,9 +415,9 @@ int _reset_the_path(pa_switch_t *curr_switch, int source, int target, int dim) /*set the switch to not be used */ curr_switch->int_wire[source].used = 0; port_tar = curr_switch->int_wire[source].port_tar; - curr_switch->int_wire[source].port_tar = -1; + curr_switch->int_wire[source].port_tar = source; curr_switch->int_wire[port_tar].used = 0; - curr_switch->int_wire[port_tar].port_tar = -1; + curr_switch->int_wire[port_tar].port_tar = port_tar; if(port_tar==target) return 1; /* follow the path */ @@ -615,7 +615,11 @@ static void _new_pa_node(pa_node_t *pa_node, int coord[PA_SYSTEM_DIMENSIONS]) for(j=0;j<NUM_PORTS_PER_NODE;j++) { pa_node->axis_switch[i].int_wire[j].used = 0; - pa_node->axis_switch[i].int_wire[j].port_tar = -1; + if(i!=X) { + if(j==3 || j==4) + pa_node->axis_switch[i].int_wire[j].used = 1; + } + pa_node->axis_switch[i].int_wire[j].port_tar = j; } } } @@ -907,39 +911,22 @@ static int _create_config_even(pa_node_t ***grid) target_1, target_2, target_first, target_second); - if(y<(DIM_SIZE[Y]-1)) + if(y<(DIM_SIZE[Y]-1)) target_1 = &grid[x][y+1][z]; - else - target_1 = NULL; - if(y<(DIM_SIZE[Y]-2)) - target_2 = &grid[x][y+2][z]; - else - target_2 = target_1; - target_first = &grid[x][0][z]; - if (DIM_SIZE[Y] > 1) - target_second = &grid[x][1][z]; - else - target_second = target_first; + else + target_1 = &grid[x][0][z]; + _set_external_wires(Y, y, source, - target_1, target_2, - target_first, target_second); - - if(z<(DIM_SIZE[Z]-1)) + target_1, NULL, + NULL, NULL); + if(z<(DIM_SIZE[Z]-1)) target_1 = &grid[x][y][z+1]; - else - target_1 = NULL; - if(z<(DIM_SIZE[Z]-2)) - target_2 = &grid[x][y][z+2]; - else - target_2 = target_1; - target_first = &grid[x][y][0]; - if (DIM_SIZE[Z] > 1) - target_second = &grid[x][y][1]; - else - target_second = target_first; + else + target_1 = &grid[x][y][0]; + _set_external_wires(Z, z, source, - target_1, target_2, - target_first, target_second); + target_1, NULL, + NULL, NULL); } } } @@ -978,7 +965,12 @@ static void _set_external_wires(int dim, int count, pa_node_t* source, { _switch_config(source, source, dim, 0, 0); _switch_config(source, source, dim, 1, 1); - + if(dim!=X) { + _switch_config(source, target_1, dim, 2, 5); + _switch_config(source, source, dim, 3, 3); + _switch_config(source, source, dim, 4, 4); + return; + } if(count==0) { /* First Node */ /* 4->3 of next */ @@ -1148,28 +1140,35 @@ static int _find_one_hop(pa_switch_t *curr_switch, int source_port, if(!source_port) { target_port=1; ports_to_try[0] = 2; - ports_to_try[1] = 4; + ports_to_try[1] = 4; + } - + for(i=0;i<2;i++) { - node_tar = curr_switch->ext_wire[ports_to_try[i]].node_tar; - if((node_tar[X]==target[X] && node_tar[Y]==target[Y] && node_tar[Z]==target[Z]) || - (node_tar[X]==target2[X] && node_tar[Y]==target2[Y] && node_tar[Z]==target2[Z])) { - curr_switch->int_wire[source_port].used = 1; - curr_switch->int_wire[source_port].port_tar = ports_to_try[i]; - curr_switch->int_wire[ports_to_try[i]].used = 1; - curr_switch->int_wire[ports_to_try[i]].port_tar = source_port; - - port_tar = curr_switch->ext_wire[ports_to_try[i]].port_tar; - next_switch = &pa_system_ptr-> - grid[node_tar[X]][node_tar[Y]][node_tar[Z]].axis_switch[dim]; - next_switch->int_wire[port_tar].used = 1; - next_switch->int_wire[port_tar].port_tar = target_port; - next_switch->int_wire[target_port].used = 1; - next_switch->int_wire[target_port].port_tar = port_tar; - - return 1; - } + /* check to make sure it isn't used */ + if(!curr_switch->int_wire[ports_to_try[i]].used) { + node_tar = curr_switch->ext_wire[ports_to_try[i]].node_tar; + /* if(dim==Z) */ +/* printf("I am at %d%d%d port %d looking at %d%d%d port %d, looking for %d%d%d port %d\n",curr_switch->int_wire[0].node_tar[X],curr_switch->int_wire[0].node_tar[Y],curr_switch->int_wire[0].node_tar[Z],source_port,node_tar[X],node_tar[Y],node_tar[Z],ports_to_try[i],target[X],target[Y],target[Z],target_port); */ + if((node_tar[X]==target[X] && node_tar[Y]==target[Y] && node_tar[Z]==target[Z]) || + (node_tar[X]==target2[X] && node_tar[Y]==target2[Y] && node_tar[Z]==target2[Z])) { + curr_switch->int_wire[source_port].used = 1; + curr_switch->int_wire[source_port].port_tar = ports_to_try[i]; + curr_switch->int_wire[ports_to_try[i]].used = 1; + curr_switch->int_wire[ports_to_try[i]].port_tar = source_port; + + port_tar = curr_switch->ext_wire[ports_to_try[i]].port_tar; + next_switch = &pa_system_ptr-> + grid[node_tar[X]][node_tar[Y]][node_tar[Z]].axis_switch[dim]; + next_switch->int_wire[port_tar].used = 1; + next_switch->int_wire[port_tar].port_tar = target_port; + next_switch->int_wire[target_port].used = 1; + next_switch->int_wire[target_port].port_tar = port_tar; + /* if(dim!=X) */ +/* printf("I choose this combo %d -> %d\n", source_port, ports_to_try[i]); */ + return 1; + } + } } printf("suck, I didn't find it in one hop dim = %d from port %d\n",dim,source_port); printf("targets from %d%d%d are %d%d%d and %d%d%d\n",node_tar[X],node_tar[Y],node_tar[Z],target[X],target[Y],target[Z],target2[X],target2[Y],target2[Z]); @@ -1217,6 +1216,7 @@ static int _find_best_path(pa_switch_t *start, int source_port, int *target, //printf("count = %d\n",count); itr = list_iterator_create(path); while((path_switch = (pa_path_switch_t*) list_next(itr))){ + //if(dim ==Y) //printf("%d%d%d %d - %d\n", path_switch->geometry[X], path_switch->geometry[Y], path_switch->geometry[Z], path_switch->in, path_switch->out); temp_switch = (pa_path_switch_t *) xmalloc(sizeof(pa_path_switch_t)); @@ -1286,6 +1286,7 @@ static int _set_best_path(void) itr = list_iterator_create(best_path); while((path_switch = (pa_path_switch_t*) list_next(itr))) { + //if(path_switch->dim==Z) //printf("final %d%d%d %d - %d\n", path_switch->geometry[X], path_switch->geometry[Y], path_switch->geometry[Z], path_switch->in, path_switch->out); curr_switch = &pa_system_ptr-> grid @@ -1311,7 +1312,6 @@ static int _configure_dims(int *coord, int *end) { pa_switch_t *curr_switch; int dim; - int target[PA_SYSTEM_DIMENSIONS] = {0,0,0}; int target2[PA_SYSTEM_DIMENSIONS] = {0,0,0}; @@ -1328,15 +1328,28 @@ static int _configure_dims(int *coord, int *end) target2[X]=coord[X]; } if(dim==Y) { - target[Y]=coord[Y]+1; - target2[Y]=coord[Y]+2; + if((coord[Y]+1)==DIM_SIZE[Y]) + target[Y]=0; + else + target[Y]=coord[Y]+1; + if((coord[Y]-1)==-1) + target2[Y]=DIM_SIZE[Y]-1; + else + target2[Y]=coord[Y]-1; + } else { target[Y]=coord[Y]; target2[Y]=coord[Y]; } if(dim==Z) { - target[Z]=coord[Z]+1; - target2[Z]=coord[Z]+2; + if((coord[Z]+1)==DIM_SIZE[Z]) + target[Z]=0; + else + target[Z]=coord[Z]+1; + if((coord[Z]-1)==-1) + target2[Z]=DIM_SIZE[Z]-1; + else + target2[Z]=coord[Z]-1; } else { target[Z]=coord[Z]; target2[Z]=coord[Z]; @@ -1408,16 +1421,15 @@ static int _set_one_dim(int *start, int *end, int *coord) } return 1; } +//#define BUILD_EXE #ifdef BUILD_EXE /** */ int main(int argc, char** argv) { pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); - int error_code; time_t start, end; - node_info_msg_t * node_info_ptr; List results; - List results2; +// List results2; // int i,j; DIM_SIZE[X]=2; DIM_SIZE[Y]=4; @@ -1442,9 +1454,9 @@ int main(int argc, char** argv) #endif pa_init(NULL); results = list_create(NULL); - request->geometry[0] = 2; - request->geometry[1] = 2; - request->geometry[2] = 2; + request->geometry[0] = 1; + request->geometry[1] = 4; + request->geometry[2] = 4; request->size = -1; //atoi(argv[1]); new_pa_request(request); time(&start); @@ -1508,14 +1520,14 @@ int main(int argc, char** argv) int startx=0; int starty=0; int startz=0; - int endx=1; + int endx=0; int endy=0; - int endz=0; + int endz=4; for(x=startx;x<=endx;x++) { for(y=starty;y<=endy;y++) { for(z=startz;z<=endz;z++) { printf("Node %d%d%d Used = %d Letter = %c\n",x,y,z,pa_system_ptr->grid[x][y][z].used,pa_system_ptr->grid[x][y][z].letter); - for(dim=0;dim<1;dim++) { + for(dim=2;dim<3;dim++) { printf("Dim %d\n",dim); pa_switch_t *wire = &pa_system_ptr->grid[x][y][z].axis_switch[dim]; for(j=0;j<6;j++) @@ -1525,7 +1537,7 @@ int main(int argc, char** argv) } } list_destroy(results); - list_destroy(results2); + //list_destroy(results2); /* pa_switch_t *wire = &pa_system_ptr->grid[7][3][3].axis_switch[0]; */ /* for(j=0;j<6;j++) */ diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index 6c4e1b2a663f3eca7ab8e3ff591182b90e6a1480..68cb4a3bf9629e1bdd3aa9b963e67695e52e83ba 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -232,6 +232,14 @@ int main(int argc, char *argv[]) fatal( "failed to initialize scheduling plugin" ); if ( slurm_select_init() != SLURM_SUCCESS ) fatal( "failed to initialize node selection plugin" ); +/********************************************/ +/* Don't check this in */ + + //printf("I am quiting\n"); + //exit(0); + + +/********************************************/ if ( checkpoint_init(slurmctld_conf.checkpoint_type) != SLURM_SUCCESS ) fatal( "failed to initialize checkpoint plugin" ); diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 489d5cbe23f77ed875acae3aae4d75b33eda31f5..abf21c58f7a805ac7ee490931e2f296e2113d2a5 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -37,6 +37,7 @@ #define _DEBUG 0 typedef struct { + char *bgl_user_name; char *bgl_block_name; char *nodes; enum connection_type bgl_conn_type; @@ -50,26 +51,22 @@ static List block_list = NULL; static char* _convert_conn_type(enum connection_type conn_type); static char* _convert_node_use(enum node_use_type node_use); static db2_block_info_t * - _find_part_db2(char *nodelist); +_find_part_db2(char *nodelist); static void _print_header_part(void); static int _print_text_part(partition_info_t * part_ptr, - db2_block_info_t *db2_info_ptr); + db2_block_info_t *db2_info_ptr); static void _read_part_db2(void); static int _print_rest(void *object, void *arg); -void get_part(void) +void get_slurm_part(void) { int error_code, i, j, recs, count = 0; static partition_info_msg_t *part_info_ptr = NULL, *new_part_ptr; partition_info_t part; - char node_entry[13]; - int start, startx, starty, startz, endx, endy, endz; - db2_block_info_t *block_ptr; - bool lower; if (part_info_ptr) { error_code = slurm_load_partitions(part_info_ptr->last_update, - &new_part_ptr, 0); + &new_part_ptr, 0); if (error_code == SLURM_SUCCESS) slurm_free_partition_info_msg(part_info_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { @@ -78,21 +75,18 @@ void get_part(void) } } else { error_code = slurm_load_partitions((time_t) NULL, - &new_part_ptr, 0); + &new_part_ptr, 0); } if (error_code) { if (quiet_flag != 1) { mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, 1, - "slurm_load_partitions: %s", - slurm_strerror(slurm_get_errno())); + pa_system_ptr->ycord, 1, + "slurm_load_partitions: %s", + slurm_strerror(slurm_get_errno())); pa_system_ptr->ycord++; } } - if (params.display == BGLPART) - _read_part_db2(); - if (!params.no_header) _print_header_part(); @@ -100,87 +94,137 @@ void get_part(void) recs = new_part_ptr->record_count; else recs = 0; + for (i = 0; i < recs; i++) { j = 0; part = new_part_ptr->partition_array[i]; if (!part.nodes || (part.nodes[0] == '\0')) continue; /* empty partition */ - if (params.display == BGLPART) { - memcpy(node_entry, part.nodes, 12); - node_entry[12] = '\0'; - part.allow_groups = node_entry; - while (part.nodes[j] != '\0') { - if ((part.nodes[j] == '[') - && (part.nodes[j+4] == 'x') - && (part.nodes[j+8] == ']')) { - j++; - start = atoi(part.nodes + j); - startx = start / 100; - starty = (start % 100) / 10; - startz = (start % 10); - j += 4; - start = atoi(part.nodes + j); - endx = start / 100; - endy = (start % 100) / 10; - endz = (start % 10); - j += 5; - - block_ptr = _find_part_db2(part.allow_groups); - lower = false; - if (block_ptr) { - block_ptr->printed = true; - if (block_ptr->bgl_conn_type == - SELECT_MESH) - lower = true; - } - part.total_nodes = set_grid_bgl(startx, - starty, startz, endx, - endy, endz, count, lower); - part.root_only = (int) pa_system_ptr-> - fill_in_value[count].letter; - if (lower) - part.root_only += 32; - wattron(pa_system_ptr->text_win, - COLOR_PAIR(pa_system_ptr-> - fill_in_value[count].color)); - _print_text_part(&part, block_ptr); - wattroff(pa_system_ptr->text_win, - COLOR_PAIR(pa_system_ptr-> - fill_in_value[count].color)); - count++; - memset(node_entry, 0, 13); - memcpy(node_entry, part.nodes + j, 12); - part.allow_groups = node_entry; - } - j++; - } - } else { - while (part.node_inx[j] >= 0) { + + while (part.node_inx[j] >= 0) { + + set_grid(part.node_inx[j], + part.node_inx[j + 1], count); + j += 2; + + part.root_only = + (int) pa_system_ptr-> + fill_in_value[count].letter; + wattron(pa_system_ptr->text_win, + COLOR_PAIR(pa_system_ptr-> + fill_in_value[count]. + color)); + _print_text_part(&part, NULL); + wattroff(pa_system_ptr->text_win, + COLOR_PAIR(pa_system_ptr-> + fill_in_value[count]. + color)); + count++; + } + + } + + part_info_ptr = new_part_ptr; + return; +} - set_grid(part.node_inx[j], - part.node_inx[j + 1], count); - j += 2; +void get_bgl_part(void) +{ + int error_code, i, j, recs=0, count = 0; + static partition_info_msg_t *part_info_ptr = NULL, *new_part_ptr; + partition_info_t part; + char node_entry[13]; + int start, startx, starty, startz, endx, endy, endz; + db2_block_info_t *block_ptr; + bool lower; + + if (part_info_ptr) { + error_code = slurm_load_partitions(part_info_ptr->last_update, + &new_part_ptr, 0); + if (error_code == SLURM_SUCCESS) + slurm_free_partition_info_msg(part_info_ptr); + else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { + error_code = SLURM_SUCCESS; + new_part_ptr = part_info_ptr; + } + } else { + error_code = slurm_load_partitions((time_t) NULL, + &new_part_ptr, 0); + } + _read_part_db2(); - part.root_only = - (int) pa_system_ptr-> - fill_in_value[count].letter; - wattron(pa_system_ptr->text_win, + if (!params.no_header) + _print_header_part(); + + if (new_part_ptr) + recs = new_part_ptr->record_count; + else + recs = 0; + for (i = 0; i < recs; i++) { + mvwprintw(pa_system_ptr->text_win, + pa_system_ptr->ycord, 1, + "here: %d", + recs); + pa_system_ptr->ycord++; + j = 0; + part = new_part_ptr->partition_array[i]; + + if (!part.nodes || (part.nodes[0] == '\0')) + continue; /* empty partition */ + memcpy(node_entry, part.nodes, 12); + node_entry[12] = '\0'; + part.allow_groups = node_entry; + while (part.nodes[j] != '\0') { + if ((part.nodes[j] == '[') + && (part.nodes[j+4] == 'x') + && (part.nodes[j+8] == ']')) { + j++; + start = atoi(part.nodes + j); + startx = start / 100; + starty = (start % 100) / 10; + startz = (start % 10); + j += 4; + start = atoi(part.nodes + j); + endx = start / 100; + endy = (start % 100) / 10; + endz = (start % 10); + j += 5; + + block_ptr = _find_part_db2(part.allow_groups); + lower = false; + if (block_ptr) { + block_ptr->printed = true; + if (block_ptr->bgl_conn_type == SELECT_MESH) + lower = true; + } + part.total_nodes = set_grid_bgl(startx, + starty, startz, endx, + endy, endz, count, lower); + part.root_only = (int) pa_system_ptr-> + fill_in_value[count].letter; + if (lower) + part.root_only += 32; + + wattron(pa_system_ptr->text_win, COLOR_PAIR(pa_system_ptr-> - fill_in_value[count]. - color)); - _print_text_part(&part, NULL); - wattroff(pa_system_ptr->text_win, + fill_in_value[count].color)); + _print_text_part(&part, block_ptr); + wattroff(pa_system_ptr->text_win, COLOR_PAIR(pa_system_ptr-> - fill_in_value[count]. - color)); + fill_in_value[count].color)); count++; + memset(node_entry, 0, 13); + memcpy(node_entry, part.nodes + j, 12); + part.allow_groups = node_entry; } + j++; } + } /* Report any BGL Blocks not in a SLURM partition */ - if (block_list && params.display == BGLPART) { + if (block_list) { list_for_each(block_list, _print_rest, &count); } @@ -199,24 +243,28 @@ static void _print_header_part(void) mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "AVAIL"); pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "TIMELIMIT"); - pa_system_ptr->xcord += 11; - - if (params.display == BGLPART) { + + if (params.display != BGLPART) { + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "TIMELIMIT"); + pa_system_ptr->xcord += 11; + } else { mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "BGL_BLOCK"); + pa_system_ptr->xcord, "USER"); pa_system_ptr->xcord += 12; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "CONN"); + pa_system_ptr->xcord, "BGL_BLOCK"); + pa_system_ptr->xcord += 12; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "CONN"); pa_system_ptr->xcord += 6; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODE_USE"); + pa_system_ptr->xcord, "NODE_USE"); pa_system_ptr->xcord += 10; } mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODES"); + pa_system_ptr->xcord, "NODES"); pa_system_ptr->xcord += 7; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "NODELIST"); @@ -225,7 +273,7 @@ static void _print_header_part(void) } static int _print_text_part(partition_info_t * part_ptr, - db2_block_info_t *db2_info_ptr) + db2_block_info_t *db2_info_ptr) { int printed = 0; int tempxcord; @@ -235,61 +283,71 @@ static int _print_text_part(partition_info_t * part_ptr, char *nodes, time_buf[20]; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c", part_ptr->root_only); + pa_system_ptr->xcord, "%c", part_ptr->root_only); pa_system_ptr->xcord += 4; if (part_ptr->name) { mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.9s", part_ptr->name); + pa_system_ptr->xcord, "%.9s", part_ptr->name); pa_system_ptr->xcord += 10; if (part_ptr->state_up) mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "UP"); + pa_system_ptr->xcord, "UP"); else mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "DOWN"); + pa_system_ptr->xcord, "DOWN"); pa_system_ptr->xcord += 7; if (part_ptr->max_time == INFINITE) snprintf(time_buf, sizeof(time_buf), "UNLIMITED"); else { snprint_time(time_buf, sizeof(time_buf), - (part_ptr->max_time * 60)); + (part_ptr->max_time * 60)); + } + + if (params.display != BGLPART) { + width = strlen(time_buf); + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord + (9 - width), "%s", + time_buf); + pa_system_ptr->xcord += 11; } - width = strlen(time_buf); - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord + (9 - width), "%s", - time_buf); - pa_system_ptr->xcord += 11; } else - pa_system_ptr->xcord += 28; + pa_system_ptr->xcord += 17; if (params.display == BGLPART) { if (db2_info_ptr) { mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.11s", - db2_info_ptr->bgl_block_name); + pa_system_ptr->xcord, "%.11s", + db2_info_ptr->bgl_user_name); + pa_system_ptr->xcord += 12; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "%.11s", + db2_info_ptr->bgl_block_name); pa_system_ptr->xcord += 12; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.5s", - _convert_conn_type( - db2_info_ptr->bgl_conn_type)); + pa_system_ptr->xcord, "%.5s", + _convert_conn_type( + db2_info_ptr->bgl_conn_type)); pa_system_ptr->xcord += 6; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.9s", - _convert_node_use( - db2_info_ptr->bgl_node_use)); + pa_system_ptr->xcord, "%.9s", + _convert_node_use( + db2_info_ptr->bgl_node_use)); pa_system_ptr->xcord += 10; } else { mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); + pa_system_ptr->xcord, "?"); + pa_system_ptr->xcord += 12; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "?"); pa_system_ptr->xcord += 12; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); + pa_system_ptr->xcord, "?"); pa_system_ptr->xcord += 6; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); + pa_system_ptr->xcord, "?"); pa_system_ptr->xcord += 10; } } @@ -322,8 +380,8 @@ static int _print_text_part(partition_info_t * part_ptr, if ((printed = mvwaddch(pa_system_ptr->text_win, - pa_system_ptr->ycord, pa_system_ptr->xcord, - nodes[i])) < 0) + pa_system_ptr->ycord, pa_system_ptr->xcord, + nodes[i])) < 0) return printed; pa_system_ptr->xcord++; @@ -343,6 +401,7 @@ static void _block_list_del(void *object) if (block_ptr) { xfree(block_ptr->bgl_block_name); + xfree(block_ptr->bgl_user_name); xfree(block_ptr->nodes); if (block_ptr->hostlist) hostlist_destroy(block_ptr->hostlist); @@ -358,28 +417,28 @@ static void _block_list_del(void *object) extern char *bgl_err_str(status_t inx) { switch (inx) { - case STATUS_OK: - return "Status OK"; - case PARTITION_NOT_FOUND: - return "Partition not found"; - case JOB_NOT_FOUND: - return "Job not found"; - case BP_NOT_FOUND: - return "Base partition not found"; - case SWITCH_NOT_FOUND: - return "Switch not found"; - case JOB_ALREADY_DEFINED: - return "Job already defined"; - case CONNECTION_ERROR: - return "Connection error"; - case INTERNAL_ERROR: - return "Internal error"; - case INVALID_INPUT: - return "Invalid input"; - case INCOMPATIBLE_STATE: - return "Incompatible state"; - case INCONSISTENT_DATA: - return "Inconsistent data"; + case STATUS_OK: + return "Status OK"; + case PARTITION_NOT_FOUND: + return "Partition not found"; + case JOB_NOT_FOUND: + return "Job not found"; + case BP_NOT_FOUND: + return "Base partition not found"; + case SWITCH_NOT_FOUND: + return "Switch not found"; + case JOB_ALREADY_DEFINED: + return "Job already defined"; + case CONNECTION_ERROR: + return "Connection error"; + case INTERNAL_ERROR: + return "Internal error"; + case INVALID_INPUT: + return "Invalid input"; + case INCOMPATIBLE_STATE: + return "Incompatible state"; + case INCONSISTENT_DATA: + return "Inconsistent data"; } return "?"; @@ -458,7 +517,7 @@ static int _print_rest(void *object, void *arg) endy = (start % 100) / 10; endz = (start % 10); set_grid_bgl(startx, starty, startz, - endx, endy, endz, *count, lower); + endx, endy, endz, *count, lower); } else { /* any other format */ hostlist_t hostlist; hostlist_iterator_t host_iter; @@ -474,7 +533,7 @@ static int _print_rest(void *object, void *arg) starty = endy = (start % 100) / 10; startz = endz = (start % 10); set_grid_bgl(startx, starty, startz, - endx, endy, endz, *count, lower); + endx, endy, endz, *count, lower); free(host_name); } hostlist_iterator_destroy(host_iter); @@ -490,7 +549,7 @@ static int _print_rest(void *object, void *arg) part.root_only += 32; _print_text_part(&part, block_ptr); wattroff(pa_system_ptr->text_win, - COLOR_PAIR(pa_system_ptr->fill_in_value[*count].color)); + COLOR_PAIR(pa_system_ptr->fill_in_value[*count].color)); (*count)++; return SLURM_SUCCESS; } @@ -503,16 +562,16 @@ static int _post_block_read(void *object, void *arg) block_ptr->nodes = xmalloc(len); while (hostlist_ranged_string(block_ptr->hostlist, len, - block_ptr->nodes) < 0) { + block_ptr->nodes) < 0) { len *= 2; xrealloc(block_ptr->nodes, len); } #if _DEBUG fprintf(stderr, "part=%s, nodes=%s conn=%s mode=%s\n", - block_ptr->bgl_block_name, block_ptr->nodes, - _convert_conn_type(block_ptr->bgl_conn_type), - _convert_node_use(block_ptr->bgl_node_use)); + block_ptr->bgl_block_name, block_ptr->nodes, + _convert_conn_type(block_ptr->bgl_conn_type), + _convert_node_use(block_ptr->bgl_node_use)); #endif return SLURM_SUCCESS; @@ -574,30 +633,30 @@ static void _read_part_db2(void) for (i=0; i<bp_num; i++) { if (i) { if ((rc = rm_get_data(bgl, RM_NextBP, &my_bp)) - != STATUS_OK) { + != STATUS_OK) { fprintf(stderr, "rm_get_data(RM_NextBP): %s\n", bgl_err_str(rc)); break; } } else { if ((rc = rm_get_data(bgl, RM_FirstBP, &my_bp)) - != STATUS_OK) { + != STATUS_OK) { fprintf(stderr, "rm_get_data(RM_FirstBP): %s\n", bgl_err_str(rc)); break; } } if ((rc = rm_get_data(my_bp, RM_BPLoc, &bp_loc)) - != STATUS_OK) { + != STATUS_OK) { fprintf(stderr, "rm_get_data(RM_BPLoc): %s\n", bgl_err_str(rc)); continue; } snprintf(bgl_node, sizeof(bgl_node), "bgl%d%d%d", - bp_loc.X, bp_loc.Y, bp_loc.Z); + bp_loc.X, bp_loc.Y, bp_loc.Z); if ((rc = rm_get_data(my_bp, RM_BPPartID, &part_id)) - != STATUS_OK) { + != STATUS_OK) { fprintf(stderr, "rm_get_data(RM_BPPartId): %s\n", bgl_err_str(rc)); continue; @@ -613,13 +672,13 @@ static void _read_part_db2(void) } block_ptr = list_find_first(block_list, - _part_list_find, part_id); + _part_list_find, part_id); if (!block_ptr) { /* New BGL partition record */ rm_connection_type_t conn_type; rm_partition_mode_t node_use; if ((rc = rm_get_partition(part_id, &part_ptr)) - != STATUS_OK) { + != STATUS_OK) { fprintf(stderr, "rm_get_partition(%s): %s\n", part_id, bgl_err_str(rc)); continue; @@ -627,10 +686,10 @@ static void _read_part_db2(void) block_ptr = xmalloc(sizeof(db2_block_info_t)); list_push(block_list, block_ptr); block_ptr->bgl_block_name = xstrdup(part_id); +// block_ptr->bgl_user_name = xstrdup(part_ptr->uid); if ((rc = rm_get_data(part_ptr, - RM_PartitionConnection, - &conn_type)) - != STATUS_OK) { + RM_PartitionConnection, + &conn_type)) != STATUS_OK) { fprintf(stderr, "rm_get_data(" "RM_PartitionConnection): %s\n", bgl_err_str(rc)); @@ -638,8 +697,8 @@ static void _read_part_db2(void) } else block_ptr->bgl_conn_type = conn_type; if ((rc = rm_get_data(part_ptr, RM_PartitionMode, - &node_use)) - != STATUS_OK) { + &node_use)) + != STATUS_OK) { fprintf(stderr, "rm_get_data(" "RM_PartitionMode): %s\n", bgl_err_str(rc)); @@ -694,7 +753,7 @@ static db2_block_info_t *_find_part_db2(char *nodelist) return rc; #else static db2_block_info_t dummy_block = {"UNKNOWN", "", SELECT_NAV, - SELECT_NAV_MODE, NULL}; + SELECT_NAV_MODE, NULL}; return &dummy_block; #endif @@ -703,12 +762,12 @@ static db2_block_info_t *_find_part_db2(char *nodelist) static char* _convert_conn_type(enum connection_type conn_type) { switch (conn_type) { - case (SELECT_MESH): - return "MESH"; - case (SELECT_TORUS): - return "TORUS"; - case (SELECT_NAV): - return "NAV"; + case (SELECT_MESH): + return "MESH"; + case (SELECT_TORUS): + return "TORUS"; + case (SELECT_NAV): + return "NAV"; } return "?"; } @@ -716,12 +775,12 @@ static char* _convert_conn_type(enum connection_type conn_type) static char* _convert_node_use(enum node_use_type node_use) { switch (node_use) { - case (SELECT_COPROCESSOR_MODE): - return "COPROCESSOR"; - case (SELECT_VIRTUAL_NODE_MODE): - return "VIRTUAL"; - case (SELECT_NAV_MODE): - return "NAV"; + case (SELECT_COPROCESSOR_MODE): + return "COPROCESSOR"; + case (SELECT_VIRTUAL_NODE_MODE): + return "VIRTUAL"; + case (SELECT_NAV_MODE): + return "NAV"; } return "?"; } diff --git a/src/smap/smap.c b/src/smap/smap.c index ac46834508f2e06063f5474dcf8cfa7bf96220d2..da935c04e4268dc6048035339047ccb68b8f1828 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -85,16 +85,19 @@ int main(int argc, char *argv[]) DIM_SIZE[Y]=bp_size.Y; DIM_SIZE[Z]=bp_size.Z; slurm_rm_free_BGL(bgl); -#endif - //slurm_perror("slurm_load_node"); +#else + slurm_perror("slurm_load_node"); + exit(0); +#endif pa_init(NULL); } else { pa_init(node_info_ptr); } #else - printf("This will only run on a BGL system right now.\n"); - exit(0); + printf("This will only run on a BGL system right now.\n"); + exit(0); #endif + height = DIM_SIZE[Y] * DIM_SIZE[Z] + DIM_SIZE[Y] + 3; width = DIM_SIZE[X] + DIM_SIZE[Z] + 3; @@ -145,8 +148,11 @@ int main(int argc, char *argv[]) case COMMANDS: get_command(); break; + case BGLPART: + get_bgl_part(); + break; default: - get_part(); + get_slurm_part(); break; } @@ -243,8 +249,11 @@ void *_resize_handler(int sig) case COMMANDS: get_command(); break; + case BGLPART: + get_bgl_part(); + break; default: - get_part(); + get_slurm_part(); break; } diff --git a/src/smap/smap.h b/src/smap/smap.h index 9677696f4169940c6686165605468160563f377b..9cb8ac40c95a902e4174caa1b5149f4e8cacfc08 100644 --- a/src/smap/smap.h +++ b/src/smap/smap.h @@ -132,7 +132,8 @@ void parse_command_line(int argc, char *argv[]); void snprint_time(char *buf, size_t buf_size, time_t time); void print_date(); -void get_part(); +void get_slurm_part(); +void get_bgl_part(); void get_job(); void get_command();