- feeder: fixed SQL query again

sched/
    feeder.C

svn path=/trunk/boinc/; revision=12707
This commit is contained in:
David Anderson 2007-05-22 02:58:01 +00:00
parent 833b52f71b
commit 17a83ada30
5 changed files with 32 additions and 17 deletions

View File

@ -5135,3 +5135,9 @@ David 21 May 2007
graphics_impl.C
texture.C
tgalib.C
David 21 May 2007
- feeder: fixed SQL query again
sched/
feeder.C

View File

@ -111,6 +111,9 @@ struct BENCHMARK_DESC {
static BENCHMARK_DESC* benchmark_descs=0;
static bool benchmarks_running=false; // at least 1 benchmark thread running
static double cpu_benchmarks_start;
static int bm_ncpus;
// user might change ncpus during benchmarks.
// store starting value here.
const char *file_names[2] = {"do_fp", "do_int"};
@ -204,10 +207,11 @@ void CLIENT_STATE::start_cpu_benchmarks() {
if (benchmark_descs) {
free(benchmark_descs);
}
benchmark_descs = (BENCHMARK_DESC*)calloc(ncpus, sizeof(BENCHMARK_DESC));
bm_ncpus = ncpus;
benchmark_descs = (BENCHMARK_DESC*)calloc(bm_ncpus, sizeof(BENCHMARK_DESC));
benchmarks_running = true;
for (i=0; i<ncpus; i++) {
for (i=0; i<bm_ncpus; i++) {
benchmark_descs[i].ordinal = i;
benchmark_descs[i].done = false;
benchmark_descs[i].error = false;
@ -305,7 +309,7 @@ void check_benchmark(BENCHMARK_DESC& desc) {
void CLIENT_STATE::abort_cpu_benchmarks() {
int i;
if (!benchmarks_running) return;
for (i=0; i<ncpus; i++) {
for (i=0; i<bm_ncpus; i++) {
abort_benchmark(benchmark_descs[i]);
}
}
@ -407,7 +411,7 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
int ndone = 0;
bool had_error = false;
for (i=0; i<ncpus; i++) {
for (i=0; i<bm_ncpus; i++) {
if (!benchmark_descs[i].done) {
check_benchmark(benchmark_descs[i]);
}
@ -423,10 +427,10 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
}
if (log_flags.benchmark_debug) {
msg_printf(0, MSG_INFO,
"[benchmark_debug] %d out of %d CPUs done", ndone, ncpus
"[benchmark_debug] %d out of %d CPUs done", ndone, bm_ncpus
);
}
if (ndone == ncpus) {
if (ndone == bm_ncpus) {
double old_p_fpops = host_info.p_fpops;
if (had_error) {
msg_printf(NULL, MSG_INTERNAL_ERROR, "CPU benchmarks error");
@ -436,7 +440,7 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
double p_iops = 0;
double p_membw = 0;
double m_cache = 0;
for (i=0; i<ncpus; i++) {
for (i=0; i<bm_ncpus; i++) {
if (log_flags.benchmark_debug) {
msg_printf(0, MSG_INFO,
"[benchmark_debug] CPU %d: fp %f int %f intloops %f inttime %f",
@ -451,10 +455,10 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
p_membw += benchmark_descs[i].host_info.p_membw;
m_cache += benchmark_descs[i].host_info.m_cache;
}
p_fpops /= ncpus;
p_iops /= ncpus;
p_membw /= ncpus;
m_cache /= ncpus;
p_fpops /= bm_ncpus;
p_iops /= bm_ncpus;
p_membw /= bm_ncpus;
m_cache /= bm_ncpus;
if (p_fpops > 0) {
host_info.p_fpops = p_fpops;
} else {
@ -484,7 +488,7 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
void CLIENT_STATE::print_benchmark_results() {
msg_printf(NULL, MSG_INFO, "Benchmark results:");
msg_printf(NULL, MSG_INFO, " Number of CPUs: %d", ncpus);
msg_printf(NULL, MSG_INFO, " Number of CPUs: %d", bm_ncpus);
msg_printf(
NULL, MSG_INFO, " %.0f floating point MIPS (Whetstone) per CPU",
host_info.p_fpops/1e6

View File

@ -70,7 +70,7 @@ void SIM_PROJECT::update_dcf_stats(RESULT* rp) {
completions_ratio_mean += delta / completed_task_count;
completions_ratio_s += delta * ( raw_ratio - completions_ratio_mean);
if (completed_task_count > 1) {
completions_ratio_stdev = completions_ratio_s / (completed_task_count - 1);
completions_ratio_stdev = sqrt(completions_ratio_s / (completed_task_count - 1));
double required_stdev = (raw_ratio - completions_ratio_mean) / completions_ratio_stdev;
if (required_stdev > completions_required_stdevs) {
completions_required_stdevs = std::min(required_stdev, 7.0);

View File

@ -528,15 +528,15 @@ int main(int argc, char** argv) {
} else if (!strcmp(argv[i], "-allapps")) {
all_apps = true;
} else if (!strcmp(argv[i], "-priority_order")) {
order_clause = "order by r1.result.priority desc ";
order_clause = "order by r1.priority desc ";
} else if (!strcmp(argv[i], "-priority_order_create_time")) {
order_clause = "order by r1.result.priority desc, workunit.create_time ";
order_clause = "order by r1.priority desc, workunit.create_time ";
} else if (!strcmp(argv[i], "-purge_stale")) {
purge_stale_time = atoi(argv[++i])*60;
} else if (!strcmp(argv[i], "-mod")) {
int n = atoi(argv[++i]);
int j = atoi(argv[++i]);
sprintf(select_clause, "and r1.result.id %% %d = %d ", n, j);
sprintf(select_clause, "and r1.id %% %d = %d ", n, j);
} else if (!strcmp(argv[i], "-sleep_interval")) {
sleep_interval = atof(argv[++i]);
} else {

View File

@ -408,15 +408,18 @@ def run_daemon(task):
exec_command_string(task.cmd)
def run_daemons():
found_any = False
if verbose: print "Starting daemons"
if is_main_host:
remove_stop_daemons()
for task in config.daemons:
if task.host != local_hostname:
continue
found_any = True
if task.disabled:
continue
run_daemon(task)
return found_any
def run_tasks():
if verbose: print "Running tasks"
@ -503,7 +506,9 @@ def command_enable_start():
print "Entering ENABLED mode"
# NOTE: must use '1', not '0' here
run_state.enabled = 1
run_daemons()
found_any = run_daemons()
if not found_any:
print "No daemons for this host found - check host name in config.xml"
time.sleep(10) # give feeder time to start up and create shmem
remove_stop_sched()
remove_cached_home_page()