From a40fb4ca57ae82e8ae8934f0cb28b38d7201a355 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 3 Nov 2005 05:31:21 +0000 Subject: [PATCH] include integer ops in benchmark API svn path=/trunk/boinc/; revision=8796 --- api/boinc_api.C | 20 ++++++++++++++++---- api/boinc_api.h | 4 ++-- checkin_notes | 18 ++++++++++++++++++ client/app_control.C | 2 ++ client/client_types.C | 18 ++++++++++++------ client/client_types.h | 2 ++ db/boinc_db.h | 2 ++ doc/api.php | 8 ++++---- sched/handle_request.C | 17 +++++++++++------ sched/server_types.C | 2 ++ 10 files changed, 71 insertions(+), 22 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 416ab4b0a4..194f70f803 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -106,6 +106,8 @@ static volatile int interrupt_count = 0; // and that doesn't have big jumps around hibernation static double fpops_per_cpu_sec = 0; static double fpops_cumulative = 0; +static double intops_per_cpu_sec = 0; +static double intops_cumulative = 0; static int non_cpu_intensive = 0; static int want_network = 0; static int have_network = 1; @@ -224,6 +226,14 @@ static bool update_app_progress( sprintf(buf, "%f\n", fpops_cumulative); strcat(msg_buf, buf); } + if (intops_per_cpu_sec) { + sprintf(buf, "%f\n", intops_per_cpu_sec); + strcat(msg_buf, buf); + } + if (intops_cumulative) { + sprintf(buf, "%f\n", intops_cumulative); + strcat(msg_buf, buf); + } return app_client_shm->shm->app_status.send_msg(msg_buf); } @@ -813,12 +823,14 @@ int boinc_upload_status(std::string& name) { return ERR_NOT_FOUND; } -void boinc_fpops_per_cpu_sec(double x) { - fpops_per_cpu_sec = x; +void boinc_ops_per_cpu_sec(double fp, double i) { + fpops_per_cpu_sec = fp; + intops_per_cpu_sec = i; } -void boinc_fpops_cumulative(double x) { - fpops_cumulative = x; +void boinc_ops_cumulative(double fp, double i) { + fpops_cumulative = fp; + intops_cumulative = i; } void boinc_not_using_cpu() { diff --git a/api/boinc_api.h b/api/boinc_api.h index 33ed09b527..abf9a0e981 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -115,8 +115,8 @@ extern int boinc_get_init_data(APP_INIT_DATA&); extern int boinc_wu_cpu_time(double&); extern int boinc_upload_file(std::string& name); extern int boinc_upload_status(std::string& name); -extern void boinc_fpops_per_cpu_sec(double); -extern void boinc_fpops_cumulative(double); +extern void boinc_ops_per_cpu_sec(double fp, double integer); +extern void boinc_ops_cumulative(double fp, double integer); /////////// API ENDS HERE diff --git a/checkin_notes b/checkin_notes index 863b446b9c..a9e2ef7d9d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13559,3 +13559,21 @@ David 2 Nov 2005 clientgui/ ViewTransfers.cpp + +David 2 Nov 2005 + - API: replace boinc_fpops_per_cpu_sec(double fp) with + boinc_ops_per_cpu_sec(double fp, double integer), + and similarly for boinc_fpops_cumulative(). + Some apps (like PrimeGrid) do mostly integer. + - corresponding changes to core client and scheduler + + api/ + boinc_api.C,h + client/ + app_control.C + client_types.C,h + db/ + boinc_db.h + sched/ + handle_request.C + server_types.C diff --git a/client/app_control.C b/client/app_control.C index 686475c69c..15a64e4237 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -837,6 +837,8 @@ bool ACTIVE_TASK::get_app_status_msg() { parse_int(msg_buf, "", non_cpu_intensive); parse_double(msg_buf, "", result->fpops_per_cpu_sec); parse_double(msg_buf, "", result->fpops_cumulative); + parse_double(msg_buf, "", result->intops_per_cpu_sec); + parse_double(msg_buf, "", result->intops_cumulative); } else { return false; } diff --git a/client/client_types.C b/client/client_types.C index 73cd823d28..76f2cd4035 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -1214,6 +1214,8 @@ void RESULT::clear() { aborted_via_gui = false; fpops_per_cpu_sec = 0; fpops_cumulative = 0; + intops_per_cpu_sec = 0; + intops_cumulative = 0; app = NULL; wup = NULL; project = NULL; @@ -1292,6 +1294,8 @@ int RESULT::parse_state(MIOFILE& in) { } else if (parse_double(buf, "", fpops_per_cpu_sec)) continue; else if (parse_double(buf, "", fpops_cumulative)) continue; + else if (parse_double(buf, "", intops_per_cpu_sec)) continue; + else if (parse_double(buf, "", intops_cumulative)) continue; else scope_messages.printf("RESULT::parse(): unrecognized: %s\n", buf); } return ERR_XML_PARSE; @@ -1314,14 +1318,16 @@ int RESULT::write(MIOFILE& out, bool to_server) { state ); if (fpops_per_cpu_sec) { - out.printf( - " %f\n", fpops_per_cpu_sec - ); + out.printf(" %f\n", fpops_per_cpu_sec); } if (fpops_cumulative) { - out.printf( - " %f\n", fpops_cumulative - ); + out.printf(" %f\n", fpops_cumulative); + } + if (intops_per_cpu_sec) { + out.printf(" %f\n", intops_per_cpu_sec); + } + if (intops_cumulative) { + out.printf(" %f\n", intops_cumulative); } if (to_server) { out.printf( diff --git a/client/client_types.h b/client/client_types.h index 7b4b7a96a8..97fddc819d 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -407,6 +407,8 @@ struct RESULT { double final_cpu_time; double fpops_per_cpu_sec; // nonzero if reported by app double fpops_cumulative; // nonzero if reported by app + double intops_per_cpu_sec; // nonzero if reported by app + double intops_cumulative; // nonzero if reported by app int state; // state of this result: see lib/result_state.h int exit_status; // return value from the application std::string stderr_out; diff --git a/db/boinc_db.h b/db/boinc_db.h index ce1249d7a2..9f624a7c14 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -437,6 +437,8 @@ struct RESULT { char wu_name[256]; double fpops_per_cpu_sec; double fpops_cumulative; + double intops_per_cpu_sec; + double intops_cumulative; int parse_from_client(FILE*); void clear(); }; diff --git a/doc/api.php b/doc/api.php index bcf9216320..1bc7011967 100644 --- a/doc/api.php +++ b/doc/api.php @@ -149,14 +149,14 @@ is compiled with different compiler settings, or uses a GPU or other non-CPU computing resource. To handle such cases, the following functions can be used.
-void boinc_fpops_per_cpu_second(double);
+void boinc_ops_per_cpu_second(double floating_point_ops, double integer_ops);
 
This reports the results of an application-specific benchmark, -expressed as number of floating-point operations per CPU second. +expressed as number of floating-point and integer operations per CPU second.
-void boinc_fpops_cumulative(double);
+void boinc_ops_cumulative(double floating_point_ops, double integer_ops);
 
-This reports the total number of floating-point operations +This reports the total number of floating-point and integer operations since the start of the result. It must be called just before boinc_finish(), and optionally at intermediate points. diff --git a/sched/handle_request.C b/sched/handle_request.C index 9c30bec390..6233e4b47a 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -325,8 +325,10 @@ static void compute_credit_rating(HOST& host) { host.credit_per_cpu_sec = x; } -static double fpops_to_credit(double fpops) { - return (fpops/1e9)*COBBLESTONE_FACTOR/SECONDS_PER_DAY; +static double fpops_to_credit(double fpops, double intops) { + double fpc = (fpops/1e9)*COBBLESTONE_FACTOR/SECONDS_PER_DAY; + double intc = (intops/1e9)*COBBLESTONE_FACTOR/SECONDS_PER_DAY; + return std::max(fpc, intc); } // modify host struct based on request. @@ -611,10 +613,13 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { srip->exit_status = rp->exit_status; srip->app_version_num = rp->app_version_num; - if (rp->fpops_cumulative) { - srip->claimed_credit = fpops_to_credit(rp->fpops_cumulative); - } else if (rp->fpops_per_cpu_sec) { - srip->claimed_credit = fpops_to_credit(rp->fpops_per_cpu_sec*srip->cpu_time); + if (rp->fpops_cumulative || rp->intops_cumulative) { + srip->claimed_credit = fpops_to_credit(rp->fpops_cumulative, rp->intops_cumulative); + } else if (rp->fpops_per_cpu_sec || rp->intops_per_cpu_sec) { + srip->claimed_credit = fpops_to_credit( + rp->fpops_per_cpu_sec*srip->cpu_time, + rp->intops_per_cpu_sec*srip->cpu_time + ); } else { srip->claimed_credit = srip->cpu_time * reply.host.credit_per_cpu_sec; } diff --git a/sched/server_types.C b/sched/server_types.C index 1b69c560d4..4f720196c2 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -712,6 +712,8 @@ int RESULT::parse_from_client(FILE* fin) { else if (parse_int(buf, "", app_version_num)) continue; else if (parse_double(buf, "", fpops_per_cpu_sec)) continue; else if (parse_double(buf, "", fpops_cumulative)) continue; + else if (parse_double(buf, "", intops_per_cpu_sec)) continue; + else if (parse_double(buf, "", intops_cumulative)) continue; else if (match_tag(buf, "")) { safe_strcat(xml_doc_out, buf); while (fgets(buf, 256, fin)) {