- client: small initial checkin for new scheduling system.

Keep track of per-project recent estimated credit

svn path=/trunk/boinc/; revision=22608
This commit is contained in:
David Anderson 2010-10-29 23:41:34 +00:00
parent a7c51c6340
commit 4edfe2ec28
10 changed files with 80 additions and 8 deletions

View File

@ -835,9 +835,9 @@ struct GRAPHICS_APP {
#else
strcpy(abspath, path);
#endif
argv[0] = GRAPHICS_APP_FILENAME;
argv[0] = (char*)GRAPHICS_APP_FILENAME;
if (fullscreen) {
argv[1] = "--fullscreen";
argv[1] = (char*)"--fullscreen";
argv[2] = 0;
argc = 2;
} else {

View File

@ -7660,3 +7660,20 @@ David 29 Oct 2010
client_msgs.cpp
clientgui/
NoticeListCtrl.cpp
David 29 Oct 2010
- client: small initial checkin for new scheduling system.
Keep track of per-project recent estimated credit
api/
boinc_api.cpp
client/
client_types.cpp
cpu_sched.cpp
net_stats.cpp
work_fetch.h
lib/
util.cpp,h
sched/
credit.cpp
update_stats.cpp

View File

@ -202,6 +202,8 @@ int PROJECT::parse_state(MIOFILE& in) {
if (parse_bool(buf, "dont_request_more_work", dont_request_more_work)) continue;
if (parse_bool(buf, "detach_when_done", detach_when_done)) continue;
if (parse_bool(buf, "ended", ended)) continue;
if (parse_double(buf, "<rec>", pwf.rec)) continue;
if (parse_double(buf, "<rec_time>", pwf.rec_time)) continue;
if (parse_double(buf, "<short_term_debt>", cpu_pwf.short_term_debt)) continue;
if (parse_double(buf, "<long_term_debt>", cpu_pwf.long_term_debt)) continue;
if (parse_double(buf, "<cpu_backoff_interval>", cpu_pwf.backoff_interval)) continue;
@ -275,6 +277,8 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
" <master_fetch_failures>%d</master_fetch_failures>\n"
" <min_rpc_time>%f</min_rpc_time>\n"
" <next_rpc_time>%f</next_rpc_time>\n"
" <rec>%f</rec>\n"
" <rec_time>%f</rec_time>\n"
" <short_term_debt>%f</short_term_debt>\n"
" <long_term_debt>%f</long_term_debt>\n"
" <cpu_backoff_interval>%f</cpu_backoff_interval>\n"
@ -314,6 +318,8 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
master_fetch_failures,
min_rpc_time,
next_rpc_time,
pwf.rec,
pwf.rec_time,
cpu_pwf.short_term_debt,
cpu_pwf.long_term_debt, cpu_pwf.backoff_interval, cpu_pwf.backoff_time,
cuda_pwf.short_term_debt, cuda_pwf.long_term_debt,

View File

@ -514,6 +514,33 @@ void CLIENT_STATE::reset_debt_accounting() {
debt_interval_start = now;
}
#define REC_HALF_LIFE (30*86400)
// update REC (recent estimated credit)
//
static void update_rec() {
double f = gstate.host_info.p_fpops;
for (unsigned int i=0; i<gstate.projects.size(); i++) {
PROJECT* p = gstate.projects[i];
double x = p->cpu_pwf.secs_this_debt_interval * f;
if (gstate.host_info.have_cuda()) {
x += p->cuda_pwf.secs_this_debt_interval * f * cuda_work_fetch.relative_speed;
}
if (gstate.host_info.have_ati()) {
x += p->ati_pwf.secs_this_debt_interval * f * ati_work_fetch.relative_speed;
}
update_average(
gstate.now,
gstate.debt_interval_start,
x,
REC_HALF_LIFE,
p->pwf.rec,
p->pwf.rec_time
);
}
}
// adjust project debts (short, long-term)
//
void CLIENT_STATE::adjust_debts() {
@ -551,6 +578,8 @@ void CLIENT_STATE::adjust_debts() {
work_fetch.accumulate_inst_sec(atp, elapsed_time);
}
update_rec();
cpu_work_fetch.update_long_term_debts();
cpu_work_fetch.update_short_term_debts();
if (host_info.have_cuda()) {

View File

@ -71,6 +71,7 @@ void NET_INFO::update(double nbytes, double dt) {
}
double start_time = gstate.now - dt;
update_average(
gstate.now,
start_time,
nbytes,
NET_RATE_HALF_LIFE,

View File

@ -237,6 +237,10 @@ struct PROJECT_WORK_FETCH {
bool can_fetch_work;
bool compute_can_fetch_work(PROJECT*);
bool has_runnable_jobs;
double rec;
// recent estimated credit
double rec_time;
// when it was last updated
PROJECT_WORK_FETCH() {
memset(this, 0, sizeof(*this));
}

View File

@ -234,6 +234,7 @@ int boinc_calling_thread_cpu_time(double &cpu_t) {
// html/inc/credit.inc
//
void update_average(
double now,
double work_start_time, // when new work was started
// (or zero if no new work)
double work, // amount of new work
@ -241,8 +242,6 @@ void update_average(
double& avg, // average work per day (in and out)
double& avg_time // when average was last computed
) {
double now = dtime();
if (avg_time) {
// If an average R already exists, imagine that the new work was done
// entirely between avg_time and now.

View File

@ -61,7 +61,7 @@ static const int PROCESS_MEDIUM_PRIORITY = 10;
extern double linux_cpu_time(int pid);
#endif
extern void update_average(double, double, double, double&, double&);
extern void update_average(double, double, double, double, double&, double&);
extern int boinc_calling_thread_cpu_time(double&);

View File

@ -55,10 +55,12 @@ int grant_credit(
DB_TEAM team;
int retval;
char buf[256];
double now = dtime();
// first, process the host
update_average(
now,
start_time, credit, CREDIT_HALF_LIFE,
host.expavg_credit, host.expavg_time
);
@ -76,6 +78,7 @@ int grant_credit(
}
update_average(
now,
start_time, credit, CREDIT_HALF_LIFE,
user.expavg_credit, user.expavg_time
);
@ -103,6 +106,7 @@ int grant_credit(
return retval;
}
update_average(
now,
start_time, credit, CREDIT_HALF_LIFE,
team.expavg_credit, team.expavg_time
);
@ -799,6 +803,7 @@ void got_error(DB_HOST_APP_VERSION& hav) {
int write_modified_app_versions(vector<DB_APP_VERSION>& app_versions) {
unsigned int i, j;
int retval = 0;
double now = dtime();
if (config.debug_credit && app_versions.size()) {
log_messages.printf(MSG_NORMAL,
@ -827,6 +832,7 @@ int write_modified_app_versions(vector<DB_APP_VERSION>& app_versions) {
}
for (j=0; j<av.credit_samples.size(); j++) {
update_average(
now,
av.credit_times[j], av.credit_samples[j], CREDIT_HALF_LIFE,
av.expavg_credit, av.expavg_time
);

View File

@ -54,6 +54,7 @@ int update_users() {
DB_USER user;
int retval;
char buf[256];
double now = dtime();
while (1) {
retval = user.enumerate("where expavg_credit>0.1");
@ -66,7 +67,9 @@ int update_users() {
}
if (user.expavg_time > update_time_cutoff) continue;
update_average(0, 0, CREDIT_HALF_LIFE, user.expavg_credit, user.expavg_time);
update_average(
now, 0, 0, CREDIT_HALF_LIFE, user.expavg_credit, user.expavg_time
);
sprintf( buf, "expavg_credit=%f, expavg_time=%f",
user.expavg_credit, user.expavg_time
);
@ -84,6 +87,7 @@ int update_hosts() {
DB_HOST host;
int retval;
char buf[256];
double now = dtime();
while (1) {
retval = host.enumerate("where expavg_credit>0.1");
@ -96,7 +100,9 @@ int update_hosts() {
}
if (host.expavg_time > update_time_cutoff) continue;
update_average(0, 0, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time);
update_average(
now, 0, 0, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time
);
sprintf(
buf,"expavg_credit=%f, expavg_time=%f",
host.expavg_credit, host.expavg_time
@ -142,6 +148,7 @@ int update_teams() {
DB_TEAM team;
int retval;
char buf[256];
double now = dtime();
while (1) {
retval = team.enumerate("where expavg_credit>0.1");
@ -163,7 +170,10 @@ int update_teams() {
continue;
}
if (team.expavg_time < update_time_cutoff) {
update_average(0, 0, CREDIT_HALF_LIFE, team.expavg_credit, team.expavg_time);
update_average(
now, 0, 0, CREDIT_HALF_LIFE, team.expavg_credit,
team.expavg_time
);
}
sprintf(
buf, "expavg_credit=%f, expavg_time=%f, nusers=%d",