aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2012-12-26 22:52:36 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-12-27 04:34:39 -0500
commit9a90777ac5b7741a7a1be2c0faff1717c841675f (patch)
tree99cfb99960e8d71f92752dd627607b8731b6d5f3 /native/src
parent0141356271ff20567841135453cfb2a670e23f8d (diff)
Use utilization cap instead of number of CPUs where applicable
Diffstat (limited to 'native/src')
-rw-r--r--native/src/edf/gel_pl.cpp47
1 files changed, 32 insertions, 15 deletions
diff --git a/native/src/edf/gel_pl.cpp b/native/src/edf/gel_pl.cpp
index f0f9303..89d0177 100644
--- a/native/src/edf/gel_pl.cpp
+++ b/native/src/edf/gel_pl.cpp
@@ -17,6 +17,14 @@ GELPl::GELPl(Scheduler sched, unsigned int num_processors, const TaskSet& ts,
17 unsigned int num_rounds) 17 unsigned int num_rounds)
18:no_cpus(num_processors), tasks(ts), rounds(num_rounds) 18:no_cpus(num_processors), tasks(ts), rounds(num_rounds)
19{ 19{
20 fractional_t sys_utilization;
21 tasks.get_utilization(sys_utilization);
22 // Compute ceiling
23 integral_t util_ceil_pre = sys_utilization.get_num();
24 mpz_cdiv_q(util_ceil_pre.get_mpz_t(),
25 sys_utilization.get_num().get_mpz_t(),
26 sys_utilization.get_den().get_mpz_t());
27 util_ceil = util_ceil_pre.get_ui();
20 std::vector<unsigned long> pps; 28 std::vector<unsigned long> pps;
21 fractional_t S = 0; 29 fractional_t S = 0;
22 std::vector<fractional_t> Y_ints; 30 std::vector<fractional_t> Y_ints;
@@ -155,16 +163,20 @@ void GELPl::compute_exact_s(const fractional_t& S,
155 init_pairs.push_back(new_pair); 163 init_pairs.push_back(new_pair);
156 } 164 }
157 165
158 // Allows us to efficiently compute sum of top m-1 elements. They may not 166 // Only if we have tasks contributing to G
159 // be in order but must be the correct choices. 167 if (util_ceil >= 2) {
160 std::nth_element(init_pairs.begin(), init_pairs.begin() + no_cpus - 2, 168 // Allows us to efficiently compute sum of top m-1 elements. They may
161 init_pairs.end()); 169 // not be in order but must be the correct choices.
162 170 std::nth_element(init_pairs.begin(),
163 for (int i = 0; i < no_cpus - 1; i++) { 171 init_pairs.begin() + util_ceil - 2,
164 unsigned int task_index = init_pairs[i].task; 172 init_pairs.end());
165 task_pres[task_index] = true; 173
166 current_value += init_pairs[i].value; 174 for (int i = 0; i < util_ceil - 1; i++) {
167 current_slope += utilizations[task_index]; 175 unsigned int task_index = init_pairs[i].task;
176 task_pres[task_index] = true;
177 current_value += init_pairs[i].value;
178 current_slope += utilizations[task_index];
179 }
168 } 180 }
169 181
170 unsigned int rindex = 0; 182 unsigned int rindex = 0;
@@ -237,16 +249,21 @@ bool GELPl::M_lt_0(const fractional_t& s, const fractional_t& S,
237 Gvals[i] += Y_ints[i]; 249 Gvals[i] += Y_ints[i];
238 } 250 }
239 251
240 // Again, more efficient computation by not totally sorting.
241 std::nth_element(Gvals.begin(), Gvals.begin() + no_cpus - 2, Gvals.end(),
242 reversed_order);
243 fractional_t final_val = no_cpus; 252 fractional_t final_val = no_cpus;
244 final_val *= -1; 253 final_val *= -1;
245 final_val *= s; 254 final_val *= s;
246 final_val += S; 255 final_val += S;
247 256
248 for (int i = 0; i < no_cpus - 1; i++) { 257 // Only if there will be tasks contributing to G
249 final_val += Gvals[i]; 258 if (util_ceil >= 2) {
259 // Again, more efficient computation by not totally sorting.
260 std::nth_element(Gvals.begin(),
261 Gvals.begin() + util_ceil - 2,
262 Gvals.end(),
263 reversed_order);
264 for (int i = 0; i < util_ceil - 1; i++) {
265 final_val += Gvals[i];
266 }
250 } 267 }
251 268
252 return (final_val < 0); 269 return (final_val < 0);