diff --git a/src/smap/Makefile.am b/src/smap/Makefile.am index 9bb86933a734c2e805533544d86d5882a43516c2..629963b7a7e1504b480c9cdc02fd0fe6c814dfeb 100644 --- a/src/smap/Makefile.am +++ b/src/smap/Makefile.am @@ -23,13 +23,7 @@ smap_LDADD = $(top_builddir)/src/api/libslurm.o -ldl if BLUEGENE_LOADED bg_dir = $(top_builddir)/src/plugins/select/bluegene -if BG_L_P_LOADED -ba_lib_dir = $(bg_dir)/ba -else -ba_lib_dir = $(bg_dir)/ba_bgq -endif - -smap_LDADD += $(bg_dir)/bg_read_config.o $(bg_dir)/libba_common.la $(ba_lib_dir)/libblock_allocator.la +smap_LDADD += $(bg_dir)/libconfigure_api.la smap_SOURCES += configure_functions.c diff --git a/src/smap/Makefile.in b/src/smap/Makefile.in index 539bd53b0646015c32296ec177ccf4aa2cbf2c5f..36ab94cd135c8a409a8ca92cac5f59212c133183 100644 --- a/src/smap/Makefile.in +++ b/src/smap/Makefile.in @@ -43,7 +43,7 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @HAVE_SOME_CURSES_TRUE@bin_PROGRAMS = smap$(EXEEXT) -@BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@am__append_1 = $(bg_dir)/bg_read_config.o $(bg_dir)/libba_common.la $(ba_lib_dir)/libblock_allocator.la +@BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@am__append_1 = $(bg_dir)/libconfigure_api.la @BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@am__append_2 = configure_functions.c subdir = src/smap DIST_COMMON = $(am__noinst_HEADERS_DIST) $(srcdir)/Makefile.am \ @@ -342,8 +342,6 @@ INCLUDES = -I$(top_srcdir) $(BG_INCLUDES) @HAVE_SOME_CURSES_TRUE@ $(top_builddir)/src/api/libslurm.o -ldl \ @HAVE_SOME_CURSES_TRUE@ $(am__append_1) @BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@bg_dir = $(top_builddir)/src/plugins/select/bluegene -@BG_L_P_LOADED_FALSE@@BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@ba_lib_dir = $(bg_dir)/ba_bgq -@BG_L_P_LOADED_TRUE@@BLUEGENE_LOADED_TRUE@@HAVE_SOME_CURSES_TRUE@ba_lib_dir = $(bg_dir)/ba @HAVE_SOME_CURSES_TRUE@smap_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) @HAVE_SOME_CURSES_FALSE@EXTRA_smap_SOURCES = smap.h smap.c \ @HAVE_SOME_CURSES_FALSE@ job_functions.c partition_functions.c \ diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c index 1837b8a9b3161369b40bf5a3a54c58c41c5e1b16..91ec002ecf6b58afbf2aa7bb60c44480325459f0 100644 --- a/src/smap/configure_functions.c +++ b/src/smap/configure_functions.c @@ -38,75 +38,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \*****************************************************************************/ -#include "src/common/node_select.h" #include "src/smap/smap.h" #include "src/common/uid.h" #include "src/common/xstring.h" -#include "src/plugins/select/bluegene/bg_read_config.h" - -/* These are here to avoid linking issues with the bridge for - * unresolved symbols. - */ -time_t last_job_update; -time_t last_bg_update; -bg_config_t *bg_conf; -bg_lists_t *bg_lists; -pthread_mutex_t block_state_mutex = PTHREAD_MUTEX_INITIALIZER; -int bg_recover = 1; -int blocks_are_created = 0; -bool have_db2 = false; -int num_unused_cpus; - -extern int bridge_init(char *properties_file) -{ - return SLURM_ERROR; -} - -extern int bridge_fini() -{ - return SLURM_ERROR; -} - -extern int bridge_get_size(int *size) -{ - return SLURM_ERROR; -} - -extern int bridge_setup_system() -{ - return SLURM_ERROR; -} - -extern int bridge_free_bg(my_bluegene_t *bg) -{ - return SLURM_ERROR; -} - -extern int bridge_get_bg(my_bluegene_t **bg) -{ - return SLURM_ERROR; -} - -#ifdef HAVE_BG_FILES -extern int bridge_get_data(rm_element_t* element, - enum rm_specification field, void *data) -{ - return SLURM_ERROR; -} -#else -extern int bridge_get_data(void* element, - int field, void *data) -{ - return SLURM_ERROR; -} -#endif - -extern int add_bg_record(List records, List *used_nodes, - select_ba_request_t *blockreq, - bool no_check, bitoff_t io_start) -{ - return SLURM_ERROR; -} /////////////////////////////////////////////////////////////////////// @@ -147,7 +81,7 @@ static void _set_nodes(List nodes, int color, char letter) smap_node_t *smap_node; ba_mp_t *ba_mp; - if (!nodes) + if (!nodes || !smap_system_ptr) return; itr = list_iterator_create(nodes); @@ -171,7 +105,8 @@ static void _destroy_allocated_block(void *object) SELECT_SMALL); if (allocated_block->nodes) { _set_nodes(allocated_block->nodes, 0, '.'); - remove_block(allocated_block->nodes, is_small); + bg_configure_remove_block( + allocated_block->nodes, is_small); list_destroy(allocated_block->nodes); } destroy_select_ba_request(allocated_block->request); @@ -185,13 +120,14 @@ static allocated_block_t *_make_request(select_ba_request_t *request) allocated_block_t *allocated_block = NULL; #ifdef HAVE_BGQ - results = list_create(destroy_ba_mp); + results = list_create(bg_configure_destroy_ba_mp); #else results = list_create(NULL); #endif - if (allocate_block(request, results)) { - char *pass = ba_passthroughs_string(request->deny_pass); + if (bg_configure_allocate_block(request, results)) { + char *pass = bg_configure_ba_passthroughs_string( + request->deny_pass); if (pass) { sprintf(error_string,"THERE ARE PASSTHROUGHS IN " "THIS ALLOCATION DIM %s!!!!!!!", pass); @@ -225,17 +161,17 @@ static int _full_request(select_ba_request_t *request, int rc = 1; if (!strcasecmp(layout_mode,"OVERLAP")) - reset_ba_system(true); + bg_configure_reset_ba_system(true); if (usable_mp_bitmap) - ba_set_removable_mps(usable_mp_bitmap, 1); + bg_configure_ba_set_removable_mps(usable_mp_bitmap, 1); /* * Here is where we do the allocating of the partition. * It will send a request back which we will throw into * a list just incase we change something later. */ - if (!new_ba_request(request)) { + if (!bg_configure_new_ba_request(request)) { memset(error_string, 0, 255); if (request->size != -1) { sprintf(error_string, @@ -247,8 +183,9 @@ static int _full_request(select_ba_request_t *request, request->size); rc = 0; } else { - tmp_char = give_geo(request->geometry, - params.cluster_dims, 1); + tmp_char = bg_configure_give_geo(request->geometry, + params.cluster_dims, + 1); sprintf(error_string, "Problems with request of size %s\n" "Either you put in something " @@ -264,10 +201,12 @@ static int _full_request(select_ba_request_t *request, list_append(allocated_blocks, allocated_block); else { if (request->geometry[0] != (uint16_t)NO_VAL) - tmp_char = give_geo(request->geometry, - params.cluster_dims, 1); - tmp_char2 = give_geo(request->start, - params.cluster_dims, 1); + tmp_char = bg_configure_give_geo( + request->geometry, + params.cluster_dims, 1); + tmp_char2 = bg_configure_give_geo(request->start, + params.cluster_dims, + 1); memset(error_string, 0, 255); sprintf(error_string, @@ -291,7 +230,7 @@ static int _full_request(select_ba_request_t *request, } if (usable_mp_bitmap) - ba_reset_all_removed_mps(); + bg_configure_ba_reset_all_removed_mps(); return rc; } @@ -740,13 +679,13 @@ static int _change_state_bps(char *com, int state) for (i = 0; i < params.cluster_dims; i++) pos[i] = select_char2coord(host[i]); - if (!(ba_mp = coord2ba_mp(pos))) { + if (!(ba_mp = bg_configure_coord2ba_mp(pos))) { memset(error_string, 0, 255); sprintf(error_string, "Bad host given '%s'", host); rc = 0; break; } - ba_update_mp_state(ba_mp, state); + bg_configure_ba_update_mp_state(ba_mp, state); smap_node = smap_system_ptr->grid[ba_mp->index]; smap_node->color = 0; smap_node->letter = letter; @@ -1109,7 +1048,7 @@ static int _add_bg_record(select_ba_request_t *blockreq, List allocated_blocks) for (i = 0; i < params.cluster_dims; i++) pos[i] = select_char2coord(host[i]); free(host); - if (!(ba_mp = coord2ba_mp(pos))) { + if (!(ba_mp = bg_configure_coord2ba_mp(pos))) { memset(error_string, 0, 255); sprintf(error_string, "Bad host given '%s'", host); rc = 0; @@ -1217,8 +1156,7 @@ static int _load_configuration(char *com, List allocated_blocks) sprintf(filename,"bluegene.conf"); } - tbl = s_p_hashtbl_create(bg_conf_file_options); - if (s_p_parse_file(tbl, NULL, filename, false) == SLURM_ERROR) { + if (!(tbl = bg_configure_config_make_tbl(filename))) { memset(error_string,0,255); sprintf(error_string, "ERROR: couldn't open/read %s", filename); @@ -1418,7 +1356,7 @@ void get_command(void) if (params.commandline && !params.command) { printf("Configure won't work with commandline mode.\n"); printf("Please remove the -c from the commandline.\n"); - ba_fini(); + bg_configure_ba_fini(); exit(0); } @@ -1431,7 +1369,7 @@ void get_command(void) "cluster the configure is for.\nCross cluster " "support doesn't exist today.\nSorry for the " "inconvenince.\n"); - ba_fini(); + bg_configure_ba_fini(); exit(0); } xfree(cluster_name); @@ -1445,6 +1383,9 @@ void get_command(void) snprintf(com, sizeof(com), "%s", params.command); goto run_command; } else { + /* make sure we don't get any noisy debug */ + ba_configure_set_ba_debug_flags(0); + text_width = text_win->_maxx; text_startx = text_win->_begx; command_win = newwin(3, text_width - 1, LINES - 4, @@ -1513,7 +1454,7 @@ void get_command(void) endwin(); if (allocated_blocks) list_destroy(allocated_blocks); - ba_fini(); + bg_configure_ba_fini(); exit(0); } run_command: @@ -1568,7 +1509,7 @@ void get_command(void) } if (params.commandline) { - ba_fini(); + bg_configure_ba_fini(); exit(1); } } diff --git a/src/smap/grid_functions.c b/src/smap/grid_functions.c index ef1018501e8beff5ddd6c253a1cbb918e6fae5e8..5e51f11d241a6eb9066925fe28ad7502e6b74478 100644 --- a/src/smap/grid_functions.c +++ b/src/smap/grid_functions.c @@ -102,7 +102,7 @@ static void _internal_setup_grid(int level, uint16_t *coords) } return; } - ba_mp = coord2ba_mp(coords); + ba_mp = bg_configure_coord2ba_mp(coords); if (!ba_mp || ba_mp->index > smap_system_ptr->node_cnt) return; diff --git a/src/smap/opts.c b/src/smap/opts.c index 4d71bbe08fd15ff78083f6af4cc94d02abc67974..6402a04695434714240366b15c4fafaa375a7e94 100644 --- a/src/smap/opts.c +++ b/src/smap/opts.c @@ -230,14 +230,14 @@ extern char *resolve_mp(char *desc) } if (desc[0] != 'R') { - ba_mp = str2ba_mp(desc+i); + ba_mp = bg_configure_str2ba_mp(desc+i); if (ba_mp) ret_str = xstrdup_printf("%s resolves to %s\n", ba_mp->coord_str, ba_mp->loc); else ret_str = xstrdup_printf("%s has no resolve\n", desc+i); } else { - ba_mp = loc2ba_mp(desc); + ba_mp = bg_configure_loc2ba_mp(desc); if (ba_mp) ret_str = xstrdup_printf("%s resolves to %s\n", desc, ba_mp->coord_str); diff --git a/src/smap/smap.c b/src/smap/smap.c index bffbd138cdbdf5e2587ca2ca1e84eb023b9a4054..3f78181b25518d021374406ccaf4561eb5a5f944 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -118,6 +118,9 @@ int main(int argc, char *argv[]) sleep(10); /* keep trying to reconnect */ } +#ifdef HAVE_BG + bg_configure_ba_init(new_node_ptr, 0); +#endif if (dim_size == NULL) { dim_size = get_cluster_dims(new_node_ptr); if ((dim_size == NULL) || (dim_size[0] < 1)) @@ -125,10 +128,6 @@ int main(int argc, char *argv[]) } _init_colors(); -#ifdef HAVE_BG - ba_init(new_node_ptr, 0); -#endif - if (params.resolve) { char *ret_str = resolve_mp(params.resolve); if (ret_str) { diff --git a/src/smap/smap.h b/src/smap/smap.h index ed9cc0db56fa2dce87e4be099a76e671e9bab30b..35debf01e0bd70b48dfb2c124c6493c816a8af9d 100644 --- a/src/smap/smap.h +++ b/src/smap/smap.h @@ -113,6 +113,7 @@ #include "src/plugins/select/bluegene/bg_enums.h" #include "src/plugins/select/bluegene/ba_common.h" +#include "src/plugins/select/bluegene/configure_api.h" /* getopt_long options, integers but not characters */ #define OPT_LONG_HELP 0x100