|
Lines 223-228
static int _will_run_test(struct job_record *job_ptr, bitstr_t *bitmap,
Link Here
|
| 223 |
List preemptee_candidates, List *preemptee_job_list, |
223 |
List preemptee_candidates, List *preemptee_job_list, |
| 224 |
bitstr_t *exc_core_bitmap); |
224 |
bitstr_t *exc_core_bitmap); |
| 225 |
|
225 |
|
|
|
226 |
struct sort_support { |
| 227 |
int jstart; |
| 228 |
struct job_resources *tmpjobs; |
| 229 |
}; |
| 230 |
static int _compare_support(const void *, const void *); |
| 231 |
|
| 226 |
static void _dump_job_res(struct job_resources *job) { |
232 |
static void _dump_job_res(struct job_resources *job) { |
| 227 |
char str[64]; |
233 |
char str[64]; |
| 228 |
|
234 |
|
|
Lines 569-575
static void _build_row_bitmaps(struct part_res_record *p_ptr,
Link Here
|
| 569 |
uint32_t i, j, num_jobs, size; |
575 |
uint32_t i, j, num_jobs, size; |
| 570 |
int x, *jstart; |
576 |
int x, *jstart; |
| 571 |
struct part_row_data *this_row, *orig_row; |
577 |
struct part_row_data *this_row, *orig_row; |
| 572 |
struct job_resources **tmpjobs, *job; |
578 |
struct job_resources **tmpjobs; |
|
|
579 |
struct sort_support *ss; |
| 573 |
|
580 |
|
| 574 |
if (!p_ptr->row) |
581 |
if (!p_ptr->row) |
| 575 |
return; |
582 |
return; |
|
Lines 636-641
static void _build_row_bitmaps(struct part_res_record *p_ptr,
Link Here
|
| 636 |
/* create a master job list and clear out ALL row data */ |
643 |
/* create a master job list and clear out ALL row data */ |
| 637 |
tmpjobs = xmalloc(num_jobs * sizeof(struct job_resources *)); |
644 |
tmpjobs = xmalloc(num_jobs * sizeof(struct job_resources *)); |
| 638 |
jstart = xmalloc(num_jobs * sizeof(int)); |
645 |
jstart = xmalloc(num_jobs * sizeof(int)); |
|
|
646 |
ss = xmalloc(num_jobs * sizeof(struct sort_support)); |
| 639 |
x = 0; |
647 |
x = 0; |
| 640 |
for (i = 0; i < p_ptr->num_rows; i++) { |
648 |
for (i = 0; i < p_ptr->num_rows; i++) { |
| 641 |
for (j = 0; j < p_ptr->row[i].num_jobs; j++) { |
649 |
for (j = 0; j < p_ptr->row[i].num_jobs; j++) { |
|
Lines 644-649
static void _build_row_bitmaps(struct part_res_record *p_ptr,
Link Here
|
| 644 |
jstart[x] = bit_ffs(tmpjobs[x]->node_bitmap); |
652 |
jstart[x] = bit_ffs(tmpjobs[x]->node_bitmap); |
| 645 |
jstart[x] = cr_get_coremap_offset(jstart[x]); |
653 |
jstart[x] = cr_get_coremap_offset(jstart[x]); |
| 646 |
jstart[x] += bit_ffs(tmpjobs[x]->core_bitmap); |
654 |
jstart[x] += bit_ffs(tmpjobs[x]->core_bitmap); |
|
|
655 |
ss[x].jstart = jstart[x]; |
| 656 |
ss[x].tmpjobs = tmpjobs[x]; |
| 647 |
x++; |
657 |
x++; |
| 648 |
} |
658 |
} |
| 649 |
p_ptr->row[i].num_jobs = 0; |
659 |
p_ptr->row[i].num_jobs = 0; |
|
Lines 661-679
static void _build_row_bitmaps(struct part_res_record *p_ptr,
Link Here
|
| 661 |
* - may still get scenarios where jobs should switch rows |
671 |
* - may still get scenarios where jobs should switch rows |
| 662 |
* - fixme: JOB SHUFFLING BETWEEN ROWS NEEDS TESTING |
672 |
* - fixme: JOB SHUFFLING BETWEEN ROWS NEEDS TESTING |
| 663 |
*/ |
673 |
*/ |
|
|
674 |
qsort(ss, num_jobs, sizeof(struct sort_support), _compare_support); |
| 664 |
for (i = 0; i < num_jobs; i++) { |
675 |
for (i = 0; i < num_jobs; i++) { |
| 665 |
for (j = i+1; j < num_jobs; j++) { |
676 |
jstart[i] = ss[i].jstart; |
| 666 |
if (jstart[j] < jstart[i] |
677 |
tmpjobs[i] = ss[i].tmpjobs; |
| 667 |
|| (jstart[j] == jstart[i] && |
|
|
| 668 |
tmpjobs[j]->ncpus > tmpjobs[i]->ncpus)) { |
| 669 |
x = jstart[i]; |
| 670 |
jstart[i] = jstart[j]; |
| 671 |
jstart[j] = x; |
| 672 |
job = tmpjobs[i]; |
| 673 |
tmpjobs[i] = tmpjobs[j]; |
| 674 |
tmpjobs[j] = job; |
| 675 |
} |
| 676 |
} |
| 677 |
} |
678 |
} |
| 678 |
|
679 |
|
| 679 |
if (select_debug_flags & DEBUG_FLAG_CPU_BIND) { |
680 |
if (select_debug_flags & DEBUG_FLAG_CPU_BIND) { |
|
Lines 752-757
static void _build_row_bitmaps(struct part_res_record *p_ptr,
Link Here
|
| 752 |
_destroy_row_data(orig_row, p_ptr->num_rows); |
753 |
_destroy_row_data(orig_row, p_ptr->num_rows); |
| 753 |
xfree(tmpjobs); |
754 |
xfree(tmpjobs); |
| 754 |
xfree(jstart); |
755 |
xfree(jstart); |
|
|
756 |
xfree(ss); |
| 757 |
|
| 755 |
return; |
758 |
return; |
| 756 |
|
759 |
|
| 757 |
/* LEFTOVER DESIGN THOUGHTS, PRESERVED HERE */ |
760 |
/* LEFTOVER DESIGN THOUGHTS, PRESERVED HERE */ |
|
Lines 1815-1820
static int _will_run_test(struct job_record *job_ptr, bitstr_t *bitmap,
Link Here
|
| 1815 |
return rc; |
1818 |
return rc; |
| 1816 |
} |
1819 |
} |
| 1817 |
|
1820 |
|
|
|
1821 |
static int |
| 1822 |
_compare_support(const void *v, const void *v1) |
| 1823 |
{ |
| 1824 |
struct sort_support *s; |
| 1825 |
struct sort_support *s1; |
| 1826 |
|
| 1827 |
s = (struct sort_support *)v; |
| 1828 |
s1 = (struct sort_support *)v1; |
| 1829 |
|
| 1830 |
if (s->jstart > s1->jstart |
| 1831 |
|| (s->jstart == s1->jstart |
| 1832 |
&& s->tmpjobs->ncpus > s1->tmpjobs->ncpus)) |
| 1833 |
return 1; |
| 1834 |
|
| 1835 |
return 0; |
| 1836 |
} |
| 1818 |
/* |
1837 |
/* |
| 1819 |
* init() is called when the plugin is loaded, before any other functions |
1838 |
* init() is called when the plugin is loaded, before any other functions |
| 1820 |
* are called. Put global initialization here. |
1839 |
* are called. Put global initialization here. |
|
Lines 2662-2668
bitstr_t *sequential_pick(bitstr_t *avail_bitmap, uint32_t node_cnt,
Link Here
|
| 2662 |
|
2681 |
|
| 2663 |
cores_in_node = 0; |
2682 |
cores_in_node = 0; |
| 2664 |
|
2683 |
|
| 2665 |
/* First let's see in there are enough cores in |
2684 |
/* First let's see in there are enough cores in |
| 2666 |
* this node */ |
2685 |
* this node */ |
| 2667 |
for (i = 0; i < local_cores; i++) { |
2686 |
for (i = 0; i < local_cores; i++) { |
| 2668 |
if (bit_test(tmpcore, coff + i)) |
2687 |
if (bit_test(tmpcore, coff + i)) |
|
Lines 2671-2677
bitstr_t *sequential_pick(bitstr_t *avail_bitmap, uint32_t node_cnt,
Link Here
|
| 2671 |
if (cores_in_node < cores_per_node) |
2690 |
if (cores_in_node < cores_per_node) |
| 2672 |
continue; |
2691 |
continue; |
| 2673 |
|
2692 |
|
| 2674 |
debug2("Using node %d (avail: %d, needed: %d)", |
2693 |
debug2("Using node %d (avail: %d, needed: %d)", |
| 2675 |
inx, cores_in_node, cores_per_node); |
2694 |
inx, cores_in_node, cores_per_node); |
| 2676 |
|
2695 |
|
| 2677 |
cores_in_node = 0; |
2696 |
cores_in_node = 0; |
|
Lines 2803-2809
extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt,
Link Here
|
| 2803 |
|
2822 |
|
| 2804 |
if (core_cnt && (*core_bitmap == NULL)) |
2823 |
if (core_cnt && (*core_bitmap == NULL)) |
| 2805 |
*core_bitmap = _make_core_bitmap_filtered(avail_bitmap, 0); |
2824 |
*core_bitmap = _make_core_bitmap_filtered(avail_bitmap, 0); |
| 2806 |
|
2825 |
|
| 2807 |
rem_nodes = node_cnt; |
2826 |
rem_nodes = node_cnt; |
| 2808 |
|
2827 |
|
| 2809 |
/* Assuming symmetric cluster */ |
2828 |
/* Assuming symmetric cluster */ |
|
Lines 2917-2923
extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt,
Link Here
|
| 2917 |
if (switches_node_cnt[j] == 0) |
2936 |
if (switches_node_cnt[j] == 0) |
| 2918 |
continue; |
2937 |
continue; |
| 2919 |
if (core_cnt) { |
2938 |
if (core_cnt) { |
| 2920 |
sufficient = |
2939 |
sufficient = |
| 2921 |
(switches_node_cnt[j] >= rem_nodes) && |
2940 |
(switches_node_cnt[j] >= rem_nodes) && |
| 2922 |
(switches_cpu_cnt[j] >= core_cnt[0]); |
2941 |
(switches_cpu_cnt[j] >= core_cnt[0]); |
| 2923 |
} else |
2942 |
} else |
|
Lines 2968-2974
extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt,
Link Here
|
| 2968 |
} |
2987 |
} |
| 2969 |
if (avail_cores_in_node < cores_per_node) |
2988 |
if (avail_cores_in_node < cores_per_node) |
| 2970 |
continue; |
2989 |
continue; |
| 2971 |
|
2990 |
|
| 2972 |
debug2("Using node %d with %d cores available", |
2991 |
debug2("Using node %d with %d cores available", |
| 2973 |
i, avail_cores_in_node); |
2992 |
i, avail_cores_in_node); |
| 2974 |
} |
2993 |
} |
|
Lines 2995-3001
fini: for (i=0; i<switch_record_cnt; i++) {
Link Here
|
| 2995 |
xfree(switches_node_cnt); |
3014 |
xfree(switches_node_cnt); |
| 2996 |
xfree(switches_required); |
3015 |
xfree(switches_required); |
| 2997 |
|
3016 |
|
| 2998 |
if (avail_nodes_bitmap && core_cnt) { |
3017 |
if (avail_nodes_bitmap && core_cnt) { |
| 2999 |
/* Reservation is using partial nodes */ |
3018 |
/* Reservation is using partial nodes */ |
| 3000 |
//char str[100]; |
3019 |
//char str[100]; |
| 3001 |
bitstr_t *exc_core_bitmap = NULL; |
3020 |
bitstr_t *exc_core_bitmap = NULL; |