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 (+42 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, *node_bitmap_tmp;
2839
	bool test_only;
2840
	bool test_only;
2840
	uint32_t c, j, k, n, csize, total_cpus, save_mem = 0;
2841
	uint32_t c, j, k, n, csize, total_cpus, save_mem = 0;
2841
	int32_t build_cnt;
2842
	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;
2844
	struct job_details *details_ptr;
2844
	struct part_res_record *p_ptr, *jp_ptr;
2845
	struct part_res_record *p_ptr, *jp_ptr;
2845
	uint16_t *cpu_count;
2846
	uint16_t *cpu_count;
2847
	uint16_t *cpu_count_tmp;
2846
	int i, first, last;
2848
	int i, first, last;
2847
2849
2848
	if (gang_mode == -1) {
2850
	if (gang_mode == -1) {
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 - "
3178
			info("cons_res: cr_job_test: test 3 pass - "
3177
			     "found resources");
3179
			     "found resources");
3178
		}
3180
		}
3181
		free_cores_tmp = bit_copy(free_cores);
3182
		node_bitmap_tmp = bit_copy(node_bitmap);
3183
		for (p_ptr = cr_part_ptr; p_ptr; p_ptr = p_ptr->next) {
3184
			if (p_ptr->part_ptr->priority >=
3185
			    jp_ptr->part_ptr->priority)
3186
				continue;
3187
			if (!p_ptr->row)
3188
				continue;
3189
			for (i = 0; i < p_ptr->num_rows; i++) {
3190
				if (!p_ptr->row[i].row_bitmap)
3191
					continue;
3192
				bit_copybits(tmpcore,
3193
					     p_ptr->row[i].row_bitmap);
3194
				bit_not(tmpcore); /* set bits now "free" resources */
3195
				bit_and(free_cores_tmp, tmpcore);
3196
			}
3197
			if (job_ptr->details->whole_node == 1) {
3198
				_block_whole_nodes(node_bitmap_tmp, avail_cores,
3199
						   free_cores_tmp);
3200
			}
3201
			cpu_count_tmp = _select_nodes(job_ptr, min_nodes,
3202
						max_nodes, req_nodes,
3203
						node_bitmap_tmp, cr_node_cnt,
3204
						free_cores_tmp, node_usage,
3205
						cr_type, test_only,
3206
						part_core_map,
3207
						prefer_alloc_nodes);
3208
			if (!cpu_count_tmp)
3209
				break;
3210
			if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
3211
				info("cons_res: cr_job_test: remove low-priority partition %s",
3212
				     p_ptr->part_ptr->name);
3213
			}
3214
			bit_copybits(free_cores, free_cores_tmp);
3215
			bit_copybits(node_bitmap, node_bitmap_tmp);
3216
			xfree(cpu_count);
3217
			cpu_count = cpu_count_tmp;
3218
		}
3219
		FREE_NULL_BITMAP(free_cores_tmp);
3220
		FREE_NULL_BITMAP(node_bitmap_tmp);
3179
		goto alloc_job;
3221
		goto alloc_job;
3180
	}
3222
	}
3181
	if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
3223
	if (select_debug_flags & DEBUG_FLAG_SELECT_TYPE) {
(-)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