I changed it to
static inline bool arrived_first(RESULT* r0, RESULT* r1) {
if (r0->received_time < r1->received_time) {
return true;
}
if (r0->received_time > r1->received_time) {
return false;
}
return (r0 < r1); // arbitrary but deterministic
}
The reason for the tie-breaker is that some sort routines crash
if the < relation isn't consistent (i.e. it says both x < y and y < x).
The old qsort() had this property;
std::sort() probably doesn't, but I'm being superstitious.
-- David
On 04-Oct-2011 8:29 PM, Josef W. Segur wrote:
> With the move to work fetch hysteresis, hosts will be requesting work less
> often
> and getting more for each request.
>
> At SETI@home that will exacerbate the inefficiency caused by the way the BOINC
> core client sorts assigned tasks. Briefly, several tasks which are extremely
> similar tend to run more slowly on a multicore CPU than they would if mixed
> with
> less similar tasks. The slowdown can amount to 50% or more in some cases. The
> project has done what it can to deliver a mix of work, but having groups of
> tasks sorted by name removes some of the randomness. I'll attach a short file
> showing how a set of 26 tasks I received were ordered in the sched_reply and
> how
> they were sorted for processing. That's actually from SETI Beta, but serves to
> illustrate the point.
>
> Changing the arrived_first() function in cs_statefile.cpp to simply return
> false
> when arrival time is equal should be enough, though if there's some need to be
> "deterministic" which I don't see then also changing
> CLIENT_STATE::sort_results() to use std::stable_sort() would meet the need.
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.