diff --git a/src/plugins/select/bluegene/bgl_job_run.c b/src/plugins/select/bluegene/bgl_job_run.c index 4f6c4d4eb6fbb5785f0a679010ba1a9250dadb1a..2780eb318bf7a7baf1146949d47d0e09bd6b947d 100644 --- a/src/plugins/select/bluegene/bgl_job_run.c +++ b/src/plugins/select/bluegene/bgl_job_run.c @@ -413,7 +413,7 @@ static List _get_all_blocks(void) if (!ret_list) fatal("malloc error"); - + itr = list_iterator_create(bgl_init_part_list); while ((block_ptr = (bgl_record_t *) list_next(itr))) { if ((block_ptr->owner_name == NULL) diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c index 4520b0f31975cabc53fedafac32457a36216881c..67398f68419828b53f5900c446b29f49a96c2e1b 100644 --- a/src/plugins/select/bluegene/bluegene.c +++ b/src/plugins/select/bluegene/bluegene.c @@ -74,8 +74,9 @@ int create_static_partitions(List part_list) int start[PA_SYSTEM_DIMENSIONS]; int end[PA_SYSTEM_DIMENSIONS]; bgl_conf_record_t *bgl_conf_record; - - pm_partition_id_t part_id; + rm_partition_state_t state; + + pm_partition_id_t part_id[10]; rm_partition_t *my_part; int i; rm_BP_t * bp; @@ -113,32 +114,57 @@ int create_static_partitions(List part_list) /* If not, delete all existing partitions and jobs then * configure from scratch */ - part_id="RMP101"; - bp_num=1; + part_id[0]="RMP101"; + part_id[1]="RMP102"; + part_id[2]="RMP103"; + part_id[3]="RMP104"; + part_id[4]="RMP105"; + part_id[5]="RMP106"; + bp_num=6; //rm_get_data(bgl, RM_BPNum, &bp_num); //rm_get_data(bgl, RM_FirstBP, &bp); - for (i=0; i<bp_num; i++){ - // rm_get_data(bp, RM_BPPartID, &part_id); - if ((rc = rm_get_partition(part_id, &my_part)) - != STATUS_OK) { - error("rm_get_partition(%s): %s", - part_id, bgl_err_str(rc)); - rc = SLURM_ERROR; - continue; - } + for (i=0; i<bp_num; i++){ + // rm_get_data(bp, RM_BPPartID, &part_id); + if ((rc = rm_get_partition(part_id[i], &my_part)) + != STATUS_OK) { + + } else { - rm_get_data(my_part, RM_PartitionUserName, &name); - printf("user name for %s is %s\n",part_id,name); - if(!strcmp(name,"")) { - printf("destroying %s\n",(char *)part_id); - pm_destroy_partition(part_id); - rm_remove_partition(part_id); - printf("done\n"); + rm_get_data(my_part, RM_PartitionUserName, &name); + //printf("user name for %s is %s\n",part_id[i],name); + //if(!strcmp(name,"")) { + printf("destroying %s\n",(char *)part_id[i]); + rm_get_data(my_part, RM_PartitionState, &state); + if(state != RM_PARTITION_FREE) + pm_destroy_partition(part_id[i]); + + rm_get_data(my_part, RM_PartitionState, &state); + while ((state != RM_PARTITION_FREE) && (state != RM_PARTITION_ERROR)){ + printf("."); + rc=rm_free_partition(my_part); + if(rc!=STATUS_OK){ + printf("Error freeing partition\n"); + return(-1); + } + sleep(3); + rc=rm_get_partition(part_id[i],&my_part); + if(rc!=STATUS_OK){ + printf("Error in GetPartition\n"); + return(-1); } - //rm_get_data(bgl, RM_NextBP, &bp); + rm_get_data(my_part, RM_PartitionState, &state); + //Free memory allocated to mypart + } + rm_remove_partition(part_id[i]); + sleep(3); + printf("done\n"); + //} + //rm_get_data(bgl, RM_NextBP, &bp); + } + } - itr = list_iterator_create(bgl_conf_list); + itr = list_iterator_create(bgl_conf_list); while ((bgl_conf_record = (bgl_conf_record_t *) list_next(itr)) != NULL) { j=0; while (bgl_conf_record->nodes[j] != '\0') { diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c index e5467e3cb2b2d583a9234034ea9dbad5663bbcb1..1a182b70f42784748cefed9c65b2a464bda5886a 100755 --- a/src/plugins/select/bluegene/partition_sys.c +++ b/src/plugins/select/bluegene/partition_sys.c @@ -34,6 +34,7 @@ extern void * lsd_nomem_error(char *file, int line, char *mesg){} #endif +#define USER_NAME "nobody" /** these are used in the dynamic partitioning algorithm */ /* global system = list of free partitions */ List bgl_sys_free = NULL; @@ -179,7 +180,7 @@ static void _pre_allocate(bgl_conf_record_t *bgl_conf_record) rm_set_data(bgl_conf_record->bgl_part, RM_PartitionRamdiskImg, bluegene_ramdisk); rm_set_data(bgl_conf_record->bgl_part, RM_PartitionConnection, &bgl_conf_record->conn_type); rm_set_data(bgl_conf_record->bgl_part, RM_PartitionMode, &bgl_conf_record->node_use); - rm_set_data(bgl_conf_record->bgl_part, RM_PartitionUserName, ""); + rm_set_data(bgl_conf_record->bgl_part, RM_PartitionUserName, USER_NAME); } /** @@ -188,8 +189,9 @@ static void _pre_allocate(bgl_conf_record_t *bgl_conf_record) static int _post_allocate(rm_partition_t *my_part) { int rc; - rm_partition_state_t state; +// rm_partition_state_t state=RM_PARTITION_READY; pm_partition_id_t part_id; + char command[100]; /* Add partition record to the DB */ printf("adding partition\n"); //my_part->description = "Stand-alone mpirun"; @@ -206,12 +208,12 @@ static int _post_allocate(rm_partition_t *my_part) rm_free_partition(my_part); //exit(0); /* Initiate boot of the partition */ - debug("Booting Partition %s", part_id); + /*debug("Booting Partition %s", part_id); rc = pm_create_partition(part_id); if (rc != STATUS_OK) { error("Error booting_partition partition"); return(-1); - } + }*/ /* Wait for Partition to be booted */ rc = rm_get_partition(part_id, &my_part); @@ -219,8 +221,11 @@ static int _post_allocate(rm_partition_t *my_part) error("Error in GetPartition"); return(-1); } - - rm_get_data(my_part, RM_PartitionState, &state); + memset(command,0,100); + sprintf(command,"/home/da/allocate_block %s %s", part_id, USER_NAME); + system(command); + + //rm_set_data(my_part, RM_PartitionState, state); fflush(stdout); return 0; diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/select_bluegene.c index 1b3184a8acf0f59d5893943f1095220b052f1b87..8f244611fa0569831acaeb9971b1e8d894a6b398 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/select_bluegene.c @@ -214,7 +214,9 @@ extern int select_p_state_restore(char *dir_name) /* Sync BGL blocks to currently active jobs */ extern int select_p_job_init(List job_list) { - return sync_jobs(job_list); + /* change back when done testing */ + //return sync_jobs(job_list); + return SLURM_SUCCESS; } /* All initialization is performed by select_p_part_init() */ diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 244183b038fe8ec600033b91ac83df175d151268..777b0fa6400d7ebc33b9fd5a71952626ff9949b8 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -598,13 +598,6 @@ static int _post_block_read(void *object, void *arg) 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)); - -#endif return SLURM_SUCCESS; } #endif @@ -658,29 +651,29 @@ static void _read_part_db2(void) } if ((rc = rm_get_data(bgl, RM_BPNum, &bp_num)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(RM_BPNum): %s\n", bgl_err_str(rc)); + //fprintf(stderr, "rm_get_data(RM_BPNum): %s\n", bgl_err_str(rc)); bp_num = 0; } for (i=0; i<bp_num; i++) { if (i) { if ((rc = rm_get_data(bgl, RM_NextBP, &my_bp)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(RM_NextBP): %s\n", - bgl_err_str(rc)); + /* 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) { - fprintf(stderr, "rm_get_data(RM_FirstBP): %s\n", - bgl_err_str(rc)); + /* 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) { - fprintf(stderr, "rm_get_data(RM_BPLoc): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(RM_BPLoc): %s\n", */ +/* bgl_err_str(rc)); */ continue; } snprintf(bgl_node, sizeof(bgl_node), "bgl%d%d%d", @@ -688,8 +681,8 @@ static void _read_part_db2(void) if ((rc = rm_get_data(my_bp, RM_BPPartID, &part_id)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(RM_BPPartId): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(RM_BPPartId): %s\n", */ +/* bgl_err_str(rc)); */ continue; } if (!part_id || (part_id[0] == '\0')) { @@ -711,8 +704,8 @@ static void _read_part_db2(void) if ((rc = rm_get_partition(part_id, &part_ptr)) != STATUS_OK) { - fprintf(stderr, "rm_get_partition(%s): %s\n", - part_id, bgl_err_str(rc)); + /*fprintf(stderr, "rm_get_partition(%s): %s\n", + part_id, bgl_err_str(rc));*/ continue; } block_ptr = xmalloc(sizeof(db2_block_info_t)); @@ -722,52 +715,46 @@ static void _read_part_db2(void) if ((rc = rm_get_data(part_ptr, RM_PartitionState, &block_ptr->state)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(" - "RM_PartitionState): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(" */ +/* "RM_PartitionState): %s\n", */ +/* bgl_err_str(rc)); */ } if ((rc = rm_get_data(part_ptr, RM_PartitionUserName, &block_ptr->bgl_user_name)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(" - "RM_PartitionUserName): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(" */ +/* "RM_PartitionUserName): %s\n", */ +/* bgl_err_str(rc)); */ } if ((rc = rm_get_data(part_ptr, RM_PartitionConnection, &conn_type)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(" - "RM_PartitionConnection): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(" */ +/* "RM_PartitionConnection): %s\n", */ +/* bgl_err_str(rc)); */ block_ptr->bgl_conn_type = SELECT_NAV; } else block_ptr->bgl_conn_type = conn_type; if ((rc = rm_get_data(part_ptr, RM_PartitionMode, &node_use)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(" - "RM_PartitionMode): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_get_data(" */ +/* "RM_PartitionMode): %s\n", */ +/* bgl_err_str(rc)); */ block_ptr->bgl_node_use = SELECT_NAV_MODE; } else block_ptr->bgl_node_use = node_use; if ((rc = rm_free_partition(part_ptr)) != STATUS_OK) { - fprintf(stderr, "rm_free_partition(): %s\n", - bgl_err_str(rc)); + /* fprintf(stderr, "rm_free_partition(): %s\n", */ +/* bgl_err_str(rc)); */ } block_ptr->hostlist = hostlist_create(bgl_node); } else { /* Add node name to existing BGL partition record */ hostlist_push(block_ptr->hostlist, bgl_node); } -#if _DEBUG - fprintf(stderr, "part=%s, node=%s conn=%s mode=%s\n", - part_id, bgl_node, - _convert_conn_type(block_ptr->bgl_conn_type), - _convert_node_use(block_ptr->bgl_node_use)); -#endif } /* perform post-processing for each bluegene partition */