diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c index 1cf8213a40fbf620f908c0848ef5576013edc608..b2da2ff3ea683f89139066d20b55bf319aa45faf 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.c +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c @@ -1212,7 +1212,7 @@ extern int *find_bp_loc(char* bp_id) } itr = list_iterator_create(bp_map_list); while ((bp_map = list_next(itr)) != NULL) - if (!strcmp(bp_map->bp_id, bp_id)) + if (!strcasecmp(bp_map->bp_id, bp_id)) break; /* we found it */ list_iterator_destroy(itr); @@ -1264,6 +1264,155 @@ extern char *find_bp_rack_mid(char* xyz) #endif } +extern int load_block_wiring(char *bg_block_id) +{ +#ifdef HAVE_BG_FILES + int rc, i, j, k; + rm_partition_t *block_ptr = NULL; + int cnt = 0; + int switch_cnt = 0; + rm_switch_t *curr_switch = NULL; + char *switchid = NULL; + rm_BP_t *curr_bp = NULL; + rm_connection_t curr_conn; + int dim; + ba_switch_t *ba_switch = NULL; + int *geo = NULL; + + debug("getting info for block %s\n", bg_block_id); + + slurm_mutex_lock(&api_file_mutex); + if ((rc = rm_get_partition(bg_block_id, &block_ptr)) != STATUS_OK) { + slurm_mutex_unlock(&api_file_mutex); + if(rc == INCONSISTENT_DATA) + return REMOVE_USER_FOUND; + + error("rm_get_partition(%s): %s", + bg_block_id, + bg_err_str(rc)); + return REMOVE_USER_ERR; + } + slurm_mutex_unlock(&api_file_mutex); + + if ((rc = rm_get_data(block_ptr, RM_PartitionSwitchNum, + &switch_cnt)) != STATUS_OK) { + error("rm_get_data(RM_PartitionSwitchNum): %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + for (i=0; i<switch_cnt; i++) { + if(i) { + if ((rc = rm_get_data(block_ptr, + RM_PartitionNextSwitch, + &curr_switch)) + != STATUS_OK) { + error("rm_get_data: " + "RM_PartitionNextSwitch: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + } else { + if ((rc = rm_get_data(block_ptr, + RM_PartitionFirstSwitch, + &curr_switch)) + != STATUS_OK) { + error("rm_get_data: " + "RM_PartitionFirstSwitch: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + } + if ((rc = rm_get_data(curr_switch, RM_SwitchDim, &dim)) + != STATUS_OK) { + error("rm_get_data: RM_SwitchDim: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + if ((rc = rm_get_data(curr_switch, RM_SwitchBPID, &switchid)) + != STATUS_OK) { + error("rm_get_data: RM_SwitchBPID: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + + geo = find_bp_loc(switchid); + + if ((rc = rm_get_data(curr_switch, RM_SwitchConnNum, &cnt)) + != STATUS_OK) { + error("rm_get_data: RM_SwitchBPID: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + debug("switch id = %s dim %d conns = %d", + switchid, dim, cnt); + ba_switch = &ba_system_ptr-> + grid[geo[X]][geo[Y]][geo[Z]].axis_switch[dim]; + for (j=0; j<cnt; j++) { + if(j) { + if ((rc = rm_get_data(curr_switch, + RM_SwitchNextConnection, + &curr_conn)) + != STATUS_OK) { + error("rm_get_data: " + "RM_SwitchNextConnection: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + } else { + if ((rc = rm_get_data(curr_switch, + RM_SwitchFirstConnection, + &curr_conn)) + != STATUS_OK) { + error("rm_get_data: " + "RM_SwitchFirstConnection: %s", + bg_err_str(rc)); + return SLURM_ERROR; + } + } + switch(curr_conn.p1) { + case RM_PORT_S1: + curr_conn.p1 = 1; + break; + case RM_PORT_S2: + curr_conn.p1 = 2; + break; + case RM_PORT_S4: + curr_conn.p1 = 4; + break; + } + + switch(curr_conn.p2) { + case RM_PORT_S0: + curr_conn.p2 = 0; + break; + case RM_PORT_S3: + curr_conn.p2 = 3; + break; + case RM_PORT_S5: + curr_conn.p2 = 5; + break; + } + debug("connection going from %d -> %d", + curr_conn.p1, curr_conn.p2); + if(curr_conn.p1 == 1) + ba_system_ptr-> + grid[geo[X]][geo[Y]][geo[Z]].used = 1; + ba_switch->int_wire[curr_conn.p1].used = 1; + ba_switch->int_wire[curr_conn.p1].port_tar + = curr_conn.p2; + ba_switch->int_wire[curr_conn.p2].used = 1; + ba_switch->int_wire[curr_conn.p2].port_tar + = curr_conn.p1; + } + } + return SLURM_SUCCESS; + +#else + return SLURM_ERROR; +#endif + +} + /********************* Local Functions *********************/ #ifdef HAVE_BG @@ -2375,56 +2524,17 @@ static int _set_external_wires(int dim, int count, ba_node_t* source, #ifdef HAVE_BG -#if 0 - /* this is here for the second half of bg system. - if used it should be changed to #if 1 - */ - if(count == 0) { - /* 3->4 of next */ - _switch_config(source, target, dim, 3, 4); - /* 4->3 of next */ - _switch_config(source, target, dim, 4, 3); - /* 2 not in use */ - _switch_config(source, source, dim, 2, 2); - target = &ba_system_ptr->grid[DIM_SIZE[X]-1] - [source->coord[Y]] - [source->coord[Z]]; - - /* 5->2 of last */ - _switch_config(source, target, dim, 5, 2); - - } else if (count == 1) { - /* 2->5 of next */ - _switch_config(source, target, dim, 2, 5); - /* 5 not in use */ - _switch_config(source, source, dim, 5, 5); - } else if (count == 2) { - /* 2->5 of next */ - _switch_config(source, target, dim, 2, 5); - /* 3->4 of next */ - _switch_config(source, target, dim, 3, 4); - /* 4 not in use */ - _switch_config(source, source, dim, 4, 4); - } else if(count == 3) { - /* 2->5 of first */ - _switch_config(source, target, dim, 2, 5); - /* 3 not in use */ - _switch_config(source, source, dim, 3, 3); - } - - return 1; -#endif _switch_config(source, target, dim, 2, 5); if(count == 0 || count==4) { /* 0 and 4th Node */ /* 3->4 of next */ _switch_config(source, target, dim, 3, 4); /* 4 is not in use */ - _switch_config(source, source, dim, 4, 4); + //_switch_config(source, source, dim, 4, 4); } else if( count == 1 || count == 5) { /* 1st and 5th Node */ /* 3 is not in use */ - _switch_config(source, source, dim, 3, 3); + //_switch_config(source, source, dim, 3, 3); } else if(count == 2) { /* 2nd Node */ /* make sure target is the last node */ diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.h b/src/plugins/select/bluegene/block_allocator/block_allocator.h index d8b1cdc7ad5f333eb35de52b60701ba6310cfe60..f70e1ee42fa6dc3a27b45d38859d6fe6e7c1a688 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.h +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.h @@ -343,4 +343,9 @@ extern int *find_bp_loc(char* bp_id); */ extern char *find_bp_rack_mid(char* xyz); +/** + * set the used wires for a block out of the database + */ +extern int load_block_wiring(char *bg_block_id); + #endif /* _BLOCK_ALLOCATOR_H_ */ diff --git a/src/plugins/select/bluegene/plugin/bg_switch_connections.c b/src/plugins/select/bluegene/plugin/bg_switch_connections.c index f518c0666ec611a363211f8d9184d3dbe5757dfc..3643fba28492ddc9bf4d2d2bf84d21d4d8633687 100644 --- a/src/plugins/select/bluegene/plugin/bg_switch_connections.c +++ b/src/plugins/select/bluegene/plugin/bg_switch_connections.c @@ -142,7 +142,8 @@ static int _add_switch_conns(rm_switch_t* curr_switch, slurm_mutex_lock(&api_file_mutex); if(firstconnect) { if ((rc = rm_set_data(curr_switch, - RM_SwitchFirstConnection, &conn)) + RM_SwitchFirstConnection, + &conn)) != STATUS_OK) { list_iterator_destroy(itr); slurm_mutex_unlock(&api_file_mutex); @@ -153,7 +154,8 @@ static int _add_switch_conns(rm_switch_t* curr_switch, firstconnect=0; } else { if ((rc = rm_set_data(curr_switch, - RM_SwitchNextConnection, &conn)) + RM_SwitchNextConnection, + &conn)) != STATUS_OK) { list_iterator_destroy(itr); slurm_mutex_unlock(&api_file_mutex); @@ -486,16 +488,16 @@ extern int configure_block_switches(bg_record_t * bg_record) { int i, rc = SLURM_SUCCESS; ListIterator itr, switch_itr, bg_itr; - ba_node_t* ba_node; - rm_BP_t *curr_bp; + ba_node_t* ba_node = NULL; + rm_BP_t *curr_bp = NULL; rm_switch_t *coord_switch[BA_SYSTEM_DIMENSIONS]; - rm_switch_t *curr_switch; - ba_switch_t *ba_switch; - char *bpid, *curr_bpid; + rm_switch_t *curr_switch = NULL; + ba_switch_t *ba_switch = NULL; + char *bpid = NULL, *curr_bpid = NULL; int found_bpid = 0; int switch_count; - bg_bp_t *bg_bp; - bg_switch_t *bg_switch; + bg_bp_t *bg_bp = NULL; + bg_switch_t *bg_switch = NULL; int first_bp=1; int first_switch=1; @@ -749,5 +751,4 @@ cleanup: return rc; } - #endif diff --git a/src/plugins/select/bluegene/plugin/block_sys.c b/src/plugins/select/bluegene/plugin/block_sys.c index a9ec0c46c58f70ae31cf8511b97698fcde63c87b..93479e6a47f22163fbe2b489ec18054c89e94725 100755 --- a/src/plugins/select/bluegene/plugin/block_sys.c +++ b/src/plugins/select/bluegene/plugin/block_sys.c @@ -460,12 +460,8 @@ int read_bg_blocks() if(bp_cnt==0) goto clean_up; - - if ((rc = rm_get_data(block_ptr, RM_PartitionBPNum, - &bg_record->bp_count)) != STATUS_OK) { - error("rm_get_data(RM_PartitionBPNum): %s", - bg_err_str(rc)); - } + bg_record->bp_count = bp_cnt; + debug3("has %d BPs", bg_record->bp_count); diff --git a/src/plugins/select/bluegene/plugin/bluegene.c b/src/plugins/select/bluegene/plugin/bluegene.c index e6a4b9d9dd2ca25452345a65e1b16785d6f30a89..068f9d3820ae3933994032b83e4e29def1cbbc37 100644 --- a/src/plugins/select/bluegene/plugin/bluegene.c +++ b/src/plugins/select/bluegene/plugin/bluegene.c @@ -925,18 +925,27 @@ extern int create_defined_blocks(bg_layout_t overlapped) bg_record->start[Z], geo[X], geo[Y], - geo[Z]); - name = set_bg_block(NULL, - bg_record->start, - geo, - bg_record->conn_type); - if(!name) { - debug("I was unable to make the " - "requested block."); - slurm_mutex_unlock(&block_state_mutex); - return SLURM_ERROR; + geo[Z]); + if(bg_record->bg_block_id) { + rc = SLURM_ERROR; + rc = load_block_wiring( + bg_record->bg_block_id); + } + if(rc != SLURM_SUCCESS) { + name = set_bg_block(NULL, + bg_record->start, + geo, + bg_record-> + conn_type); + if(!name) { + debug("I was unable to make " + "the requested block."); + slurm_mutex_unlock( + &block_state_mutex); + return SLURM_ERROR; + } + xfree(name); } - xfree(name); } if(found_record == NULL) { if((rc = configure_block(bg_record)) @@ -1055,19 +1064,29 @@ extern int create_dynamic_block(ba_request_t *request, List my_block_list) geo[X], geo[Y], geo[Z]); - name = set_bg_block(NULL, - bg_record->start, - geo, - bg_record->conn_type); - if(!name) { - debug("I was unable to make the " - "requested block."); - bit_free(my_bitmap); - slurm_mutex_unlock(&block_state_mutex); - return SLURM_ERROR; + + if(bg_record->bg_block_id) { + rc = SLURM_ERROR; + rc = load_block_wiring( + bg_record->bg_block_id); } - xfree(name); - } + if(rc != SLURM_SUCCESS) { + name = set_bg_block(NULL, + bg_record->start, + geo, + bg_record-> + conn_type); + if(!name) { + debug("I was unable to make " + "the requested block."); + bit_free(my_bitmap); + slurm_mutex_unlock( + &block_state_mutex); + return SLURM_ERROR; + } + xfree(name); + } + } } list_iterator_destroy(itr); if(my_bitmap) diff --git a/src/plugins/select/bluegene/plugin/bluegene.h b/src/plugins/select/bluegene/plugin/bluegene.h index 9768817b81839a8404f8721f11b09b27571a8612..6362a34dbaa5f58cab9b72587325ca4a19bf6de4 100644 --- a/src/plugins/select/bluegene/plugin/bluegene.h +++ b/src/plugins/select/bluegene/plugin/bluegene.h @@ -228,6 +228,7 @@ extern int read_bg_blocks(); /*****************************************************/ extern int configure_small_block(bg_record_t *bg_record); extern int configure_block_switches(bg_record_t * bg_conf_record); +extern int load_current_system(); #endif /* _BLUEGENE_H_ */ diff --git a/src/smap/smap.c b/src/smap/smap.c index d828252e770c040cf18454c5242cb530ff4e0ec9..a0bedfa19ce14731c0273ec4d65b92f258ccb9df 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -100,8 +100,6 @@ int main(int argc, char *argv[]) if(!mapset) mapset = set_bp_map(); - if(params.partition[0] == 'r') - params.partition[0] = 'R'; if(params.partition[0] != 'R') { i = strlen(params.partition); i -= 3;