summaryrefslogtreecommitdiff
path: root/sysutils/slurm-hpc/files/patch-src-plugins-select-cons_res-dist_tasks.c
blob: c2166f12123e1b7fbcdb8a7305cab861d7856b56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- src/plugins/select/cons_res/dist_tasks.c.orig	2013-09-10 16:44:33.000000000 -0500
+++ src/plugins/select/cons_res/dist_tasks.c	2013-11-14 10:23:02.000000000 -0600
@@ -271,6 +271,30 @@
 	return SLURM_SUCCESS;
 }
 
+// These were nested below, which is not legal in standard C
+
+	/* qsort compare function for ascending int list */
+	int _cmp_int_ascend (const void *a, const void *b)
+	{
+		return (*(int*)a - *(int*)b);
+	}
+
+	/* qsort compare function for descending int list */
+	int _cmp_int_descend (const void *a, const void *b)
+	{
+		return (*(int*)b - *(int*)a);
+	}
+
+	int* sockets_cpu_cnt;
+
+	/* qsort compare function for board combination socket
+	 * list */
+	int _cmp_sock (const void *a, const void *b)
+	{
+		 return (sockets_cpu_cnt[*(int*)b] -
+				 sockets_cpu_cnt[*(int*)a]);
+	}
+
 /* sync up core bitmap with new CPU count using a best-fit approach
  * on the available resources on each node
  *
@@ -298,7 +322,6 @@
 	int elig_idx, comb_brd_idx, sock_list_idx, comb_min, board_num;
 	int* boards_cpu_cnt;
 	int* sort_brds_cpu_cnt;
-	int* sockets_cpu_cnt;
 	int* board_combs;
 	int* socket_list;
 	int* elig_brd_combs;
@@ -316,26 +339,6 @@
 	uint64_t ncomb_brd;
 	bool sufficient,best_fit_sufficient;
 
-	/* qsort compare function for ascending int list */
-	int _cmp_int_ascend (const void *a, const void *b)
-	{
-		return (*(int*)a - *(int*)b);
-	}
-
-	/* qsort compare function for descending int list */
-	int _cmp_int_descend (const void *a, const void *b)
-	{
-		return (*(int*)b - *(int*)a);
-	}
-
-	/* qsort compare function for board combination socket
-	 * list */
-	int _cmp_sock (const void *a, const void *b)
-	{
-		 return (sockets_cpu_cnt[*(int*)b] -
-				 sockets_cpu_cnt[*(int*)a]);
-	}
-
 	if (!job_res)
 		return;