From 4ad5249bf2ab647e524fc24214e7a30aaf42714b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 17 Sep 2008 23:35:16 +0000 Subject: [PATCH] - scheduler: various bug fixes in score-based schedule; get rid of no_darwin_6 option svn path=/trunk/boinc/; revision=16015 --- checkin_notes | 11 ++++++++++ lib/cert_sig.C | 26 +++++++++------------- lib/cert_sig.h | 23 +++++++++----------- sched/sched_config.C | 8 ------- sched/sched_config.h | 2 -- sched/sched_send.C | 49 +++++++++++++++++++++++++++++++++++------- sched/validate_util2.C | 10 ++++++--- 7 files changed, 79 insertions(+), 50 deletions(-) diff --git a/checkin_notes b/checkin_notes index d1ca5942e7..99217f2e20 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7514,3 +7514,14 @@ Charlie 17 Sep 2008 mac_installer/ make_GridRepublic.sh + +David 17 Sept 2008 + - scheduler: various bug fixes in score-based schedule; + get rid of no_darwin_6 option + + lib/ + cert_sig.C,h + sched/ + sched_config.C,h + sched_send.C + validate_util2.C diff --git a/lib/cert_sig.C b/lib/cert_sig.C index ab5133ff3a..3401383a27 100644 --- a/lib/cert_sig.C +++ b/lib/cert_sig.C @@ -1,22 +1,19 @@ +// This file is part of BOINC. +// http://boinc.berkeley.edu +// Copyright (C) 2008 University of California // -// Copyright (C) 2006-2008 MTA SZTAKI +// BOINC is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. // -// Marosi Attila Csaba -// -// This is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// either version 2.1 of the License, or (at your option) any later version. -// -// This software is distributed in the hope that it will be useful, +// BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // -// To view the GNU Lesser General Public License visit -// http://www.gnu.org/copyleft/lesser.html -// or write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU Lesser General Public License +// along with BOINC. If not, see . #include "miofile.h" #include "error_numbers.h" @@ -61,9 +58,6 @@ int CERT_SIGS::parse(XML_PARSER &xp) { char tag[4096]; char buf[256]; - //printf("CERT_SIGS::parse() starts.\n"); - //fflush(stdout); - while (!xp.get(tag, sizeof(tag), (bool&)is_tag)) { if (!strcmp(tag, "/signatures")) { //printf("CERT_SIGS::parse() ends.\n"); diff --git a/lib/cert_sig.h b/lib/cert_sig.h index 90ac508aee..870c89321b 100644 --- a/lib/cert_sig.h +++ b/lib/cert_sig.h @@ -1,22 +1,19 @@ +// This file is part of BOINC. +// http://boinc.berkeley.edu +// Copyright (C) 2008 University of California // -// Copyright (C) 2006-2008 MTA SZTAKI +// BOINC is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. // -// Marosi Attila Csaba -// -// This is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// either version 2.1 of the License, or (at your option) any later version. -// -// This software is distributed in the hope that it will be useful, +// BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // -// To view the GNU Lesser General Public License visit -// http://www.gnu.org/copyleft/lesser.html -// or write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU Lesser General Public License +// along with BOINC. If not, see . #ifndef __CERT_SIG_H_ #define __CERT_SIG_H_ diff --git a/sched/sched_config.C b/sched/sched_config.C index 02c4fdac84..ec6a03f317 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -147,14 +147,6 @@ int SCHED_CONFIG::parse(FILE* f) { if (xp.parse_int(tag, "feeder_query_size", feeder_query_size)) continue; if (xp.parse_int(tag, "granted_credit_ramp_up", granted_credit_ramp_up)) continue; if (xp.parse_double(tag, "granted_credit_weight", granted_credit_weight)) continue; - - if (xp.parse_bool(tag, "no_darwin_6", no_darwin_6)) { - if (no_darwin_6) { - regcomp(&re, ".*Darwin.*\t.*(5\\.|6\\.).*", REG_EXTENDED|REG_NOSUB); - ban_os->push_back(re); - } - continue; - } if (xp.parse_bool(tag, "no_amd_k6", no_amd_k6)) { if (no_amd_k6) { regcomp(&re, ".*AMD.*\t.*Family 5 Model 8 Stepping 0.*", REG_EXTENDED|REG_NOSUB); diff --git a/sched/sched_config.h b/sched/sched_config.h index de291a84d0..7b1b6053ea 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -107,8 +107,6 @@ public: // number of work items in shared memory int feeder_query_size; // number of work items to request in each feeder query - bool no_darwin_6; - // don't allow Mac OS X 10.2 or earlier bool no_amd_k6; // don't allow AMD K6 CPUs char httpd_user[256]; diff --git a/sched/sched_send.C b/sched/sched_send.C index 1d1bd0f15f..6f4a172094 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -424,7 +424,7 @@ static int get_host_info(SCHEDULER_REPLY& reply) { } if (config.debug_send) { log_messages.printf(MSG_DEBUG, - "[HOST#%d] is%s reliable (OS = %s) error_rate = %.3f avg_turn_hrs = %.0f \n", + "[HOST#%d] is%s reliable (OS = %s) error_rate = %.6f avg_turn_hrs = %.3f \n", reply.host.id, reply.wreq.host_info.reliable?"":" not", reply.host.os_name, reply.host.error_rate, @@ -1341,9 +1341,23 @@ static void send_work_old(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { // void set_trust(SCHEDULER_REPLY& reply) { reply.wreq.trust = false; - if (reply.host.error_rate > ER_MAX) return; + if (reply.host.error_rate > ER_MAX) { + if (config.debug_send) { + log_messages.printf(MSG_DEBUG, + "set_trust: error rate %f > %f, don't trust\n", + reply.host.error_rate, ER_MAX + ); + } + return; + } double x = reply.host.error_rate/ER_MAX; if (drand() > x) reply.wreq.trust = true; + if (config.debug_send) { + log_messages.printf(MSG_DEBUG, + "set_trust: random choice for error rate %f: %s\n", + reply.host.error_rate, reply.wreq.trust?"yes":"no" + ); + } } void send_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { @@ -1421,7 +1435,7 @@ void send_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { // Matchmaker scheduling code follows -struct JOB{ +struct JOB { int index; double score; double est_time; @@ -1439,6 +1453,12 @@ struct JOB_SET { double disk_limit; std::list jobs; // sorted high to low + JOB_SET(double wr, double dl) { + work_req = wr; + est_time = 0; + disk_usage = 0; + disk_limit = dl; + } void add_job(JOB&); double higher_score_disk_usage(double); double lowest_score(); @@ -1472,7 +1492,8 @@ int read_sendable_result(DB_RESULT& result) { } // compute a "score" for sending this job to this host. -// return false if the WU is infeasible +// Return false if the WU is infeasible. +// Otherwise set est_time and disk_usage. // bool JOB::get_score(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { WORKUNIT wu; @@ -1505,7 +1526,7 @@ bool JOB::get_score(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { // check if user has selected apps, // and send beta work to beta users // - if(app->beta && !config.distinct_beta_apps) { + if (app->beta && !config.distinct_beta_apps) { if (reply.wreq.host_info.allow_beta_work) { score += 1; } else { @@ -1552,6 +1573,8 @@ bool JOB::get_score(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { // try to send them jobs from the selected apps // + est_time = estimate_wallclock_duration(wu, sreq, reply); + disk_usage = wu.rsc_disk_bound; return true; } @@ -1655,6 +1678,7 @@ void JOB_SET::add_job(JOB& job) { est_time -= worst_job.est_time; disk_usage -= worst_job.disk_usage; jobs.pop_back(); + ssp->wu_results[worst_job.index].state = WR_STATE_PRESENT; } else { break; } @@ -1665,6 +1689,7 @@ void JOB_SET::add_job(JOB& job) { est_time -= worst_job.est_time; disk_usage -= worst_job.disk_usage; jobs.pop_back(); + ssp->wu_results[worst_job.index].state = WR_STATE_PRESENT; } else { break; } @@ -1682,6 +1707,12 @@ void JOB_SET::add_job(JOB& job) { } est_time += job.est_time; disk_usage += job.disk_usage; + if (config.debug_send) { + log_messages.printf(MSG_DEBUG, + "added job to set. est_time %f disk_usage %f\n", + est_time, disk_usage + ); + } } // return the disk usage of jobs above the given score @@ -1718,7 +1749,7 @@ void JOB_SET::send(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { void send_work_matchmaker(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { int i, slots_locked=0; - JOB_SET jobs; + JOB_SET jobs (sreq.work_req_seconds, reply.wreq.disk_available); int min_slots = config.mm_min_slots; if (!min_slots) min_slots = ssp->max_wu_results/2; int max_slots = config.mm_max_slots; @@ -1736,7 +1767,7 @@ void send_work_matchmaker(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { case WR_STATE_PRESENT: break; default: - if (g_pid == wu_result.state) break; + if (wu_result.state == g_pid) break; slots_locked++; continue; } @@ -1755,8 +1786,10 @@ void send_work_matchmaker(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { ssp->wu_results[i].state = g_pid; unlock_sema(); if (wu_is_infeasible_slow(wu_result, sreq, reply)) { + // if we can't use this job, put it back in pool + // lock_sema(); - ssp->wu_results[i].state = WR_STATE_EMPTY; + ssp->wu_results[i].state = WR_STATE_PRESENT; continue; } lock_sema(); diff --git a/sched/validate_util2.C b/sched/validate_util2.C index c66304ec44..e26f34496c 100644 --- a/sched/validate_util2.C +++ b/sched/validate_util2.C @@ -16,8 +16,8 @@ // along with BOINC. If not, see . // Simple validator framework: -// Lets you create a custom validator by supplying three simple functions. -// See http://boinc.berkeley.edu/validate_simple.php +// Lets you create a custom validator by supplying three functions. +// See http://boinc.berkeley.edu/trac/wiki/ValidationSimple // #include "config.h" @@ -37,12 +37,16 @@ using std::vector; +// Given a set of results, check for a canonical result, +// i.e. a set of at least min_quorum/2+1 results for which +// that are equivalent according to check_pair(). +// // invariants: // results.size() >= wu.min_quorum // for each result: // result.outcome == SUCCESS // result.validate_state == INIT - +// int check_set( vector& results, WORKUNIT& wu, int& canonicalid, double& credit, bool& retry