View | Details | Raw Unified | Return to ticket 3824 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/plugins/select/cons_res/job_test.c (+53 lines)
Lines 2836-2841 extern int cr_job_test(struct job_record *job_ptr, bitstr_t *node_bitmap, Link Here
2836
	uint16_t *layout_ptr = NULL;
2836
	uint16_t *layout_ptr = NULL;
2837
	bitstr_t *orig_map, *avail_cores, *free_cores, *part_core_map = NULL;
2837
	bitstr_t *orig_map, *avail_cores, *free_cores, *part_core_map = NULL;
2838
	bitstr_t *tmpcore = NULL, *reqmap = NULL;
2838
	bitstr_t *tmpcore = NULL, *reqmap = NULL;
2839
	bitstr_t *free_cores_tmp = NULL,  *node_bitmap_tmp = NULL;
2840
	bitstr_t *free_cores_tmp2 = NULL, *node_bitmap_tmp2 = NULL;
2839
	bool test_only;
2841
	bool test_only;
2840
	uint32_t c, j, k, n, csize, total_cpus, save_mem = 0;
2842
	uint32_t c, j, k, n, csize, total_cpus, save_mem = 0;
2841
	int32_t build_cnt;
2843
	int32_t build_cnt;
Lines 2843-2848 extern int cr_job_test(struct job_record *job_ptr, bitstr_t *node_bitmap, Link Here
2843
	struct job_details *details_ptr;
2845
	struct job_details *details_ptr;
2844
	struct part_res_record *p_ptr, *jp_ptr;
2846
	struct part_res_record *p_ptr, *jp_ptr;
2845
	uint16_t *cpu_count;
2847
	uint16_t *cpu_count;
2848
	uint16_t *cpu_count_tmp;
2846
	int i, first, last;
2849
	int i, first, last;
2847
2850
2848
	if (gang_mode == -1) {
2851
	if (gang_mode == -1) {
Lines 3162-3167 extern int cr_job_test(struct job_record *job_ptr, bitstr_t *node_bitmap, Link Here
3162
			bit_and(free_cores, tmpcore);
3165
			bit_and(free_cores, tmpcore);
3163
		}
3166
		}
3164
	}
3167
	}
3168
	free_cores_tmp  = bit_copy(free_cores);
3169
	node_bitmap_tmp = bit_copy(node_bitmap);
3165
	cpu_count = _select_nodes(job_ptr, min_nodes, max_nodes, req_nodes,
3170
	cpu_count = _select_nodes(job_ptr, min_nodes, max_nodes, req_nodes,
3166
				  node_bitmap, cr_node_cnt, free_cores,
3171
				  node_bitmap, cr_node_cnt, free_cores,
3167
				  node_usage, cr_type, test_only,
3172
				  node_usage, cr_type, test_only,
Lines 3176-3181 extern int cr_job_test(struct job_record *job_ptr, bitstr_t *node_bitmap, Link Here
3176
			info("cons_res: cr_job_test: test 3 pass - "
3181
			info("cons_res: cr_job_test: test 3 pass - "
3177
			     "found resources");
3182
			     "found resources");
3178
		}
3183
		}
3184
		for (p_ptr = cr_part_ptr; p_ptr; p_ptr = p_ptr->next) {
3185
			if (p_ptr->part_ptr->priority >=
3186
			    jp_ptr->part_ptr->priority)
3187
				continue;
3188
			if (!p_ptr->row)
3189
				continue;
3190
			for (i = 0; i < p_ptr->num_rows; i++) {
3191
				if (!p_ptr->row[i].row_bitmap)
3192
					continue;
3193
				bit_copybits(tmpcore,
3194
					     p_ptr->row[i].row_bitmap);
3195
				bit_not(tmpcore); /* set bits now "free" resources */
3196
				bit_and(free_cores_tmp, tmpcore);
3197
			}
3198
			if (job_ptr->details->whole_node == 1) {
3199
				_block_whole_nodes(node_bitmap_tmp, avail_cores,
3200
						   free_cores_tmp);
3201
			}
3202
3203
			free_cores_tmp2  = bit_copy(free_cores_tmp);
3204
			node_bitmap_tmp2 = bit_copy(node_bitmap_tmp);
3205
			cpu_count_tmp = _select_nodes(job_ptr, min_nodes,
3206
						max_nodes, req_nodes,
3207
						node_bitmap_tmp, cr_node_cnt,
3208
						free_cores_tmp, node_usage,
3209
						cr_type, test_only,
3210
						part_core_map,
3211
						prefer_alloc_nodes);
3212
			if (!cpu_count_tmp) {
3213
				FREE_NULL_BITMAP(free_cores_tmp2);
3214
				FREE_NULL_BITMAP(node_bitmap_tmp2);
3215
				break;
3216
			}
3217
			if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
3218
				info("cons_res: cr_job_test: remove low-priority partition %s",
3219
				     p_ptr->part_ptr->name);
3220
			}
3221
			bit_copybits(free_cores, free_cores_tmp);
3222
			bit_copybits(node_bitmap, node_bitmap_tmp);
3223
			bit_copybits(free_cores_tmp, free_cores_tmp2);
3224
			bit_copybits(node_bitmap_tmp, node_bitmap_tmp2);
3225
			FREE_NULL_BITMAP(free_cores_tmp2);
3226
			FREE_NULL_BITMAP(node_bitmap_tmp2);
3227
			xfree(cpu_count);
3228
			cpu_count = cpu_count_tmp;
3229
		}
3179
		goto alloc_job;
3230
		goto alloc_job;
3180
	}
3231
	}
3181
	if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
3232
	if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
Lines 3291-3296 alloc_job: Link Here
3291
	FREE_NULL_BITMAP(avail_cores);
3342
	FREE_NULL_BITMAP(avail_cores);
3292
	FREE_NULL_BITMAP(tmpcore);
3343
	FREE_NULL_BITMAP(tmpcore);
3293
	FREE_NULL_BITMAP(part_core_map);
3344
	FREE_NULL_BITMAP(part_core_map);
3345
	FREE_NULL_BITMAP(free_cores_tmp);
3346
	FREE_NULL_BITMAP(node_bitmap_tmp);
3294
	if ((!cpu_count) || (!job_ptr->best_switch)) {
3347
	if ((!cpu_count) || (!job_ptr->best_switch)) {
3295
		/* we were sent here to cleanup and exit */
3348
		/* we were sent here to cleanup and exit */
3296
		FREE_NULL_BITMAP(free_cores);
3349
		FREE_NULL_BITMAP(free_cores);
(-)a/src/plugins/select/cons_res/select_cons_res.c (-11 / +28 lines)
Lines 405-417 static void _destroy_part_data(struct part_res_record *this_ptr) Link Here
405
	}
405
	}
406
}
406
}
407
407
408
static int _sort_part_prio(void *x, void *y)
409
{
410
	struct part_res_record *part1 = *(struct part_res_record **) x;
411
	struct part_res_record *part2 = *(struct part_res_record **) y;
412
413
	if (part1->part_ptr->priority > part2->part_ptr->priority)
414
		return -1;
415
	if (part1->part_ptr->priority < part2->part_ptr->priority)
416
		return 1;
417
	return 0;
418
}
408
419
409
/* (re)create the global select_part_record array */
420
/* (re)create the global select_part_record array */
410
static void _create_part_data(void)
421
static void _create_part_data(void)
411
{
422
{
423
	List part_rec_list = NULL;
412
	ListIterator part_iterator;
424
	ListIterator part_iterator;
413
	struct part_record *p_ptr;
425
	struct part_record *p_ptr;
414
	struct part_res_record *this_ptr;
426
	struct part_res_record *this_ptr, *last_ptr = NULL;
415
	int num_parts;
427
	int num_parts;
416
428
417
	_destroy_part_data(select_part_record);
429
	_destroy_part_data(select_part_record);
Lines 422-432 static void _create_part_data(void) Link Here
422
		return;
434
		return;
423
	info("cons_res: preparing for %d partitions", num_parts);
435
	info("cons_res: preparing for %d partitions", num_parts);
424
436
425
	select_part_record = xmalloc(sizeof(struct part_res_record));
437
	part_rec_list = list_create(NULL);
426
	this_ptr = select_part_record;
427
428
	part_iterator = list_iterator_create(part_list);
438
	part_iterator = list_iterator_create(part_list);
429
	while ((p_ptr = (struct part_record *) list_next(part_iterator))) {
439
	while ((p_ptr = (struct part_record *) list_next(part_iterator))) {
440
		this_ptr = xmalloc(sizeof(struct part_res_record));
430
		this_ptr->part_ptr = p_ptr;
441
		this_ptr->part_ptr = p_ptr;
431
		this_ptr->num_rows = p_ptr->max_share;
442
		this_ptr->num_rows = p_ptr->max_share;
432
		if (this_ptr->num_rows & SHARED_FORCE)
443
		if (this_ptr->num_rows & SHARED_FORCE)
Lines 438-452 static void _create_part_data(void) Link Here
438
			this_ptr->num_rows = 1;
449
			this_ptr->num_rows = 1;
439
		/* we'll leave the 'row' array blank for now */
450
		/* we'll leave the 'row' array blank for now */
440
		this_ptr->row = NULL;
451
		this_ptr->row = NULL;
441
		num_parts--;
452
		list_append(part_rec_list, this_ptr);
442
		if (num_parts) {
443
			this_ptr->next =xmalloc(sizeof(struct part_res_record));
444
			this_ptr = this_ptr->next;
445
		}
446
	}
453
	}
447
	list_iterator_destroy(part_iterator);
454
	list_iterator_destroy(part_iterator);
448
455
	/* Sort the select_part_records by priority */
449
	/* should we sort the select_part_record list by priority here? */
456
	list_sort(part_rec_list, _sort_part_prio);
457
	part_iterator = list_iterator_create(part_rec_list);
458
	while ((this_ptr = (struct part_res_record *)list_next(part_iterator))){
459
		if (last_ptr)
460
			last_ptr->next = this_ptr;
461
		else
462
			select_part_record = this_ptr;
463
		last_ptr = this_ptr;
464
	}
465
	list_iterator_destroy(part_iterator);
466
	list_destroy(part_rec_list);
450
}
467
}
451
468
452
469

Return to ticket 3824