diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 76d9b6e253e120d571cf2bfa4cf7c0f1f4f6fae6..0dd3c06f1e2765520fcac3fad38e50fd32881d58 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -35,20 +35,6 @@ #define _DEBUG 0 -#ifdef HAVE_BGL_FILES -# include "rm_api.h" -#else - typedef char * pm_partition_id_t; - typedef int rm_connection_type_t; - typedef int rm_partition_mode_t; - typedef uint16_t rm_partition_t; - typedef char * rm_BGL_t; - typedef char * rm_component_id_t; - typedef rm_component_id_t rm_bp_id_t; - typedef int rm_BP_state_t; - typedef int status_t; -#endif - typedef struct { char *bgl_block_name; char *nodes; diff --git a/src/smap/smap.c b/src/smap/smap.c index 776ecf3b1aded89f6fd8c24e2ff41cf9e190c319..2f04035ddb0211e845a348ae3822ecc620ed7c2d 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -45,14 +45,14 @@ void *_resize_handler(int sig); int main(int argc, char *argv[]) { log_options_t opts = LOG_OPTS_STDERR_ONLY; - node_info_msg_t *node_info_ptr; + node_info_msg_t *node_info_ptr=NULL; int error_code; int height = 40; int width = 100; int startx = 0; int starty = 0; int end = 0; - int i; + int i, rc; //char *name; @@ -61,8 +61,30 @@ int main(int argc, char *argv[]) #ifdef HAVE_BGL error_code = slurm_load_node((time_t) NULL, &node_info_ptr, 0); if (error_code) { - node_info_ptr = NULL; - slurm_perror("slurm_load_node"); +#ifdef HAVE_BGL_FILES + rm_size3D_t bp_size; + if ((rc = rm_set_serial("BGL")) != STATUS_OK) { + fatal("init_bgl: rm_set_serial(): %s", bgl_err_str(rc)); + return SLURM_ERROR; + } + + if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { + fatal("init_bgl: rm_get_BGL(): %s", bgl_err_str(rc)); + return SLURM_ERROR; + } + + if ((rc = rm_get_data(bgl, RM_Msize, &bp_size)) != STATUS_OK) { + fatal("init_bgl: rm_get_data(): %s", bgl_err_str(rc)); + return SLURM_ERROR; + } + verbose("BlueGene configured with %d x %d x %d base partitions", + bp_size.X, bp_size.Y, bp_size.Z); + DIM_SIZE[X]=bp_size.X; + DIM_SIZE[Y]=bp_size.Y; + DIM_SIZE[Z]=bp_size.Z; + slurm_rm_free_BGL(bgl); +#endif + //slurm_perror("slurm_load_node"); pa_init(NULL); } else { pa_init(node_info_ptr); diff --git a/src/smap/smap.h b/src/smap/smap.h index 710bde7041cd856c0cd3eaf3c608ceb22aa2744f..9677696f4169940c6686165605468160563f377b 100644 --- a/src/smap/smap.h +++ b/src/smap/smap.h @@ -56,6 +56,21 @@ # include "src/common/getopt.h" #endif +#ifdef HAVE_BGL_FILES +# include "rm_api.h" +#else + typedef char * pm_partition_id_t; + typedef int rm_connection_type_t; + typedef int rm_partition_mode_t; + typedef uint16_t rm_partition_t; + typedef char * rm_BGL_t; + typedef char * rm_component_id_t; + typedef rm_component_id_t rm_bp_id_t; + typedef int rm_BP_state_t; + typedef int status_t; +#endif + + #include "src/common/macros.h" #include <slurm/slurm.h> @@ -96,6 +111,11 @@ typedef struct { extern smap_parameters_t params; extern int DIM_SIZE[PA_SYSTEM_DIMENSIONS]; + +#ifdef HAVE_BGL_FILES +rm_BGL_t *bgl; +#endif + void parse_command_line(int argc, char *argv[]); extern pa_system_t *pa_system_ptr;