diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c index b030ca60779fe4a3b1f865d5ae103fb9136c43a5..cb77cfeb1f722f86ce25194582553713d6a3f784 100644 --- a/src/plugins/select/bluegene/bluegene.c +++ b/src/plugins/select/bluegene/bluegene.c @@ -47,7 +47,7 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ /** */ int _parse_request(char* request_string, partition_t** request); /** */ -int _get_request_dimensions(int* bl, int* tr, int** dim); +int _get_request_dimensions(int* bl, int* tr, uint16_t** dim); /** */ int _extract_range(char* request, char** result); /** */ @@ -218,7 +218,6 @@ static int _copy_slurm_partition_list() bgl_record->nodes = strdup(cur_nodes); bgl_record->slurm_part_id = slurm_part->name; bgl_record->part_type = (rm_partition_t*) malloc(sizeof(rm_partition_t)); - bgl_record->used = 0; if (!bgl_record->part_type){ error("_copy_slurm_partition_list: not enough memory for bgl_record->part_type"); err = 1; @@ -526,7 +525,8 @@ int char2intptr(char* request, int** bl, int** tr) int _parse_request(char* request_string, partition_t** request) { char* range; - int *bl=NULL, *tr=NULL, *dim=NULL; + int *bl=NULL, *tr=NULL; + uint16_t *dim=NULL; int i; (*request) = (partition_t*) malloc(sizeof(partition_t)); if (!(*request)) { @@ -563,7 +563,7 @@ int _parse_request(char* request_string, partition_t** request) return SLURM_ERROR; } -int _get_request_dimensions(int* bl, int* tr, int** dim) +int _get_request_dimensions(int* bl, int* tr, uint16_t** dim) { int i; /* @@ -574,7 +574,7 @@ int _get_request_dimensions(int* bl, int* tr, int** dim) return SLURM_ERROR; } - *dim = (int*) malloc(sizeof(int)*SYSTEM_DIMENSIONS); + *dim = (uint16_t*) malloc(sizeof(uint16_t) * SYSTEM_DIMENSIONS); if (!(*dim)) { error("get_request_dimensions: not enough memory for dim"); return SLURM_ERROR; @@ -738,8 +738,7 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ ListIterator itr; bgl_record_t* record; int i, num_dim_best, cur_dim_match; - int* geometry = NULL; - bitstr_t* bitcpy; + uint16_t* geometry = NULL; sort_bgl_record_inc_size(bgl_list); /** this is where we should have the control flow depending on @@ -752,15 +751,16 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ * dims should be favored over the MESH and the dims, but * foremost is the correct num of dims. */ + debug("number of partitions to check: %d", list_count(bgl_list)); while ((record = (bgl_record_t*) list_next(itr))) { + debug("- - - - - - - - - - - - -"); + debug("check partition <%s>", record->slurm_part_id); + debug("- - - - - - - - - - - - -"); if (!record){ error("FIXME: well, bad bad bad..."); continue; } - if (record->used){ - debug("this record used"); - continue; - } + debug("A"); /** * first we check against the bitmap to see * if this partition can be used for this job. @@ -774,55 +774,39 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ */ debug("- - - - - - - - - - - - -"); debug("check partition bitmap"); - debug("- - - - - - - - - - - - -"); - bitcpy = bit_copy(record->bitmap); - debug("copy before"); - // 0000 0011 - _print_bitmap(bitcpy); - /* this fxn mutates first argument */ - // 0000 0011 & 0000 0000 => 0000 0000 - // 0000 0011 | 0000 0000 => 0000 0011 - bit_and(bitcpy, slurm_part_bitmap); - debug("slurm bit"); - _print_bitmap(slurm_part_bitmap); - debug("copy after"); - _print_bitmap(bitcpy); - debug("bgl"); _print_bitmap(record->bitmap); - debug("equals? %d", (bit_equal(bitcpy, record->bitmap))); - if (!bit_equal(bitcpy, record->bitmap)){ + debug("superset? %d", (bit_super_set(record->bitmap, slurm_part_bitmap))); + if (!bit_super_set(record->bitmap, slurm_part_bitmap)){ debug("bgl partition %s unusable", record->nodes); continue; } - /** ?? FIXME */ - bit_free(bitcpy); - debug("This partition matched!!!"); debug("- - - - - - - - - - - - -"); /*******************************************/ /** check that the number of nodes match */ /*******************************************/ - debug("nodes num match: max %d min %d record_num_nodes %d", - max_nodes, min_nodes, record->size); + // debug("nodes num match: max %d min %d record_num_nodes %d", + // max_nodes, min_nodes, record->size); if (record->size < min_nodes || (max_nodes != 0 && record->size > max_nodes)){ error("debug request num nodes doesn't fit"); continue; } - + debug("C"); /***********************************************/ /* check the connection type specified matches */ /***********************************************/ - debug("part type match %s ? %s", convert_part_type(&job_ptr->type), - convert_part_type(record->part_type)); + // debug("part type match %s ? %s", convert_part_type(&job_ptr->type), + // convert_part_type(record->part_type)); if (!record->part_type){ error("find_best_partition_match record->part_type is NULL"); continue; } + debug("job type %d", job_ptr->type); if (job_ptr->type != *(record->part_type) && job_ptr->type != RM_NAV){ continue; } - + debug("E"); /*****************************************/ /** match up geometry as "best" possible */ /*****************************************/ @@ -831,10 +815,12 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ found_bgl_record = record; break; } + debug("F"); if (job_ptr->rotate) rotate_part(job_ptr->geometry, &geometry); cur_dim_match = 0; + debug("G"); for (i=0; i<SYSTEM_DIMENSIONS; i++){ if (!record->alloc_part) { error("warning, bgl_record %s has not found a home...", @@ -857,30 +843,15 @@ int _find_best_partition_match(struct job_record* job_ptr, bitstr_t* slurm_part_ if (num_dim_best == SYSTEM_DIMENSIONS) break; } + debug("H"); } - + /** set the bitmap and do other allocation activities */ if (found_bgl_record){ - bitcpy = bit_copy(found_bgl_record->bitmap); debug("phung: SUCCESS! found partition %s <%s>", found_bgl_record->slurm_part_id, found_bgl_record->nodes); - found_bgl_record->used = 1; - debug("- - - - - - - - - - - - -"); - debug("setting return bitmap"); + bit_and(slurm_part_bitmap, found_bgl_record->bitmap); debug("- - - - - - - - - - - - -"); - // bit_not(bitcpy); - bit_not(slurm_part_bitmap); - debug("not copy: "); - _print_bitmap(bitcpy); - debug("slurm before: "); - _print_bitmap(slurm_part_bitmap); - bit_or(slurm_part_bitmap, bitcpy); - debug("slurm after: "); - _print_bitmap(slurm_part_bitmap); - - debug("- - - - - - - - - - - - -"); - /** ?? FIXME */ - bit_free(bitcpy); return SLURM_SUCCESS; } @@ -949,17 +920,17 @@ int submit_job(struct job_record *job_ptr, bitstr_t *slurm_part_bitmap, ListIterator itr; bgl_record_t* record; debug("bluegene::submit_job"); - + /* itr = list_iterator_create(bgl_list); while ((record = (bgl_record_t*) list_next(itr))) { print_bgl_record(record); } - - debug("job request"); + */ + debug("******** job request ********"); debug("geometry:\t%d %d %d", job_ptr->geometry[0], job_ptr->geometry[1], job_ptr->geometry[2]); debug("type:\t%s", convert_part_type(&job_ptr->type)); debug("rotate:\t%d", job_ptr->rotate); - debug("min_nodes:\t %d", min_nodes); + debug("min_nodes:\t%d", min_nodes); debug("max_nodes:\t%d", max_nodes); _print_bitmap(slurm_part_bitmap); @@ -1045,8 +1016,3 @@ char *convert_bp_state(rm_BP_state_t state){ } }; #endif - -int _bitmap_notequals(bitstr_t* A, bitstr_t* B) -{ - return !(bit_super_set(A, B) && bit_super_set(B, A)); -} diff --git a/src/plugins/select/bluegene/bluegene.h b/src/plugins/select/bluegene/bluegene.h index c7dab7272cb80e555019721b60a9d5f4e5c887a1..18d9500ac30ea57c11fb2bba8b213236526604ae 100644 --- a/src/plugins/select/bluegene/bluegene.h +++ b/src/plugins/select/bluegene/bluegene.h @@ -34,8 +34,8 @@ // #include "rm_api.h" #ifndef _RM_API_H__ -typedef int pm_partition_id_t; -typedef int rm_partition_t; +typedef uint16_t pm_partition_id_t; +typedef uint16_t rm_partition_t; #else rm_BGL_t *bgl; #endif @@ -47,7 +47,6 @@ typedef int lifecycle_type_t; enum part_lifecycle {DYNAMIC, STATIC}; typedef struct bgl_record { - int used; char* slurm_part_id; /* ID specified by admins */ pm_partition_id_t* bgl_part_id; /* ID returned from CMCS */ char* nodes; /* String of nodes in partition */ diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c index 670d6b55b2d40f12ab9dc7644349c24cfeccd46b..b3f941a5f5e4114b90a5a692c8f61616df703ea1 100755 --- a/src/plugins/select/bluegene/partition_sys.c +++ b/src/plugins/select/bluegene/partition_sys.c @@ -47,7 +47,7 @@ /****************************/ /* for testing purposes */ -int BGL_PARTITION_NUMBER = 0; +uint16_t BGL_PARTITION_NUMBER = 0; /****************************/ #ifdef _UNIT_TEST_ @@ -70,8 +70,8 @@ List bgl_sys_free = NULL; List bgl_sys_allocated = NULL; void _init_sys(partition_t*); -int _isNotEqualsAllCoord(int* A, int* B); -int _isNotEqualsSomeCoord(int* A, int* B); +int _isNotEqualsAllCoord(uint16_t* A, uint16_t* B); +int _isNotEqualsSomeCoord(uint16_t* A, uint16_t* B); #ifdef _RM_API_H__ /** @@ -98,11 +98,11 @@ int create_bgl_partitions(List requests); #endif int break_up_partition(List sys, partition_t* partition_to_break, int index); -int fit_request(List sys, List allocated, int* request); +int fit_request(List sys, List allocated, uint16_t* request); void int_array_destroy(void* object); -int intArray_CmpF(int* A, int* B); +int intArray_CmpF(uint16_t* A, uint16_t* B); int partition_CmpF_inc(struct partition* A, struct partition* B); int partition_CmpF_dec(struct partition* A, struct partition* B); @@ -169,9 +169,9 @@ int partition_sys(List requests) printList(requests); #endif - int* request; + uint16_t* request; int all_success = 0; // 0 = yes, 1 = no - while ((request = (int*) list_next(itr))) { + while ((request = (uint16_t*) list_next(itr))) { if (fit_request(bgl_sys_free, bgl_sys_allocated, request)){ #ifdef DEBUG_PART debug("failure in allocation!!!\n"); @@ -219,7 +219,7 @@ int create_bgl_partitions(List requests) * we assume that the partitioning done before hand * */ -int fit_request(List sys, List allocated, int* request) +int fit_request(List sys, List allocated, uint16_t* request) { if (sys == NULL || allocated == NULL || request == NULL) return 1; @@ -237,7 +237,7 @@ int fit_request(List sys, List allocated, int* request) #endif /* ??? FIXME wtf, if rotate_part doesn't have something printed before it....it segfaults */ debug(""); - int* new_request; + uint16_t* new_request; rotate_part(request, &new_request); free(request); request = new_request; @@ -415,7 +415,7 @@ int isPartitionNotEquals(partition_t* A, partition_t* B) /** * return - the int array's size */ -int intArray_size(int* part_geometry){ +int intArray_size(uint16_t* part_geometry){ if (part_geometry == NULL) return 0; @@ -514,7 +514,7 @@ void sortIntArrayByDecSize(List configs){ * Note: return values are "reversed" so that we can have the list * sorted in decreasing order (largest to smallest) */ -int intArray_CmpF(int* A, int* B) +int intArray_CmpF(uint16_t* A, uint16_t* B) { if (A == NULL || B == NULL) return -9; @@ -700,7 +700,7 @@ int configure_switches(rm_partition_t* partition, partition_t* partition) * find if the cur_part fits the same dimensions as the given request * return 0 for affirmative (correct dimension), and 1 for negative (not correct dimension) */ -int isNotCorrectDimension(int* cur_part, int* request) +int isNotCorrectDimension(uint16_t* cur_part, uint16_t* request) { if (cur_part == NULL || request == NULL) return 1; @@ -776,7 +776,7 @@ int max_dim_index(int* array) * * note: this is for 3d only! */ -void rotate_part(const int* config, int** new_config) +void rotate_part(const uint16_t* config, uint16_t** new_config) { if (config == NULL) return; @@ -785,7 +785,7 @@ void rotate_part(const int* config, int** new_config) free(*new_config); } - (*new_config) = (int*) calloc(SYSTEM_DIMENSIONS, sizeof(int)); + (*new_config) = (uint16_t*) calloc(SYSTEM_DIMENSIONS, sizeof(uint16_t)); if (!(*new_config)){ // printf("error: rotate_part: not enough memory for new array\n"); return; @@ -1017,7 +1017,7 @@ int get_BP_by_location(int* cur_coord, rm_BP_t* BP) * * returns 0 if equals, 1 if not equals */ -int _isNotEqualsSomeCoord(int* A, int* B) +int _isNotEqualsSomeCoord(uint16_t* A, uint16_t* B) { int i; for (i=0; i<SYSTEM_DIMENSIONS; i++){ @@ -1032,7 +1032,7 @@ int _isNotEqualsSomeCoord(int* A, int* B) * * returns 0 if equals, 1 if not equals */ -int _isNotEqualsAllCoord(int* A, int* B) +int _isNotEqualsAllCoord(uint16_t* A, uint16_t* B) { int i; for (i=0; i<SYSTEM_DIMENSIONS; i++){ diff --git a/src/plugins/select/bluegene/partition_sys.h b/src/plugins/select/bluegene/partition_sys.h index 1b86321bb8cd8f2792576aafbdc74cf1ed764653..cdc7f51243517b7a767950171d1d823bfb393298 100644 --- a/src/plugins/select/bluegene/partition_sys.h +++ b/src/plugins/select/bluegene/partition_sys.h @@ -40,15 +40,15 @@ typedef struct partition{ int bl_coord[SYSTEM_DIMENSIONS]; /* bottom left coordinates */ int tr_coord[SYSTEM_DIMENSIONS]; /* top right coordinates */ - int dimensions[SYSTEM_DIMENSIONS]; /* X,Y,Z dimensions */ + ushort dimensions[SYSTEM_DIMENSIONS]; /* X,Y,Z dimensions */ void* bgl_record_ptr; /* pointer to referring bgl_record */ int size; #ifdef _RM_API_H__ pm_partition_id_t* bgl_part_id; /* ID returned from CMCS */ - rm_partition_t* part_type; /* Type=Mesh/Torus/ */ + #else - int* bgl_part_id; /* ID returned from CMCS */ - int* part_type; /* Type=Mesh/Torus/ */ + ushort* bgl_part_id; /* ID returned from CMCS */ + ushort* part_type; /* Type=Mesh/Torus/ */ #endif } partition_t; @@ -60,11 +60,11 @@ void printPartition(partition_t* part); void printList(List list); void printSysList(List list); -int isNotCorrectDimension(int* cur_part, int* req); +int isNotCorrectDimension(ushort* cur_part, ushort* req); int isPartitionNotEquals(partition_t* A, partition_t* B); -void rotate_part(const int* config, int** new_config); +void rotate_part(const ushort* config, ushort** new_config); -int intArray_size(int* part_geometry); +int intArray_size(ushort* part_geometry); void sortIntArrayByDecSize(List configs); void sortPartitionsByIncSize(List partitions); void sortPartitionsByDecSize(List partitions); diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/select_bluegene.c index 5d562c3152ab59a205e1b0211607900e1520e458..5a6920c6a6585500a1cb98a5d383729e6f8d0aac 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/select_bluegene.c @@ -39,12 +39,15 @@ #include <slurm/slurm.h> #include <slurm/slurm_errno.h> +#include "src/common/slurm_xlator.h" + +/* #include "src/common/list.h" #include "src/common/plugin.h" -#include "src/common/slurm_xlator.h" #include "src/common/log.h" #include "src/common/macros.h" +*/ #include "src/slurmctld/slurmctld.h" #ifdef WITH_PTHREADS