include integer ops in benchmark API

svn path=/trunk/boinc/; revision=8796
This commit is contained in:
David Anderson 2005-11-03 05:31:21 +00:00
parent fd9df47481
commit a40fb4ca57
10 changed files with 71 additions and 22 deletions

View File

@ -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, "<fpops_cumulative>%f</fpops_cumulative>\n", fpops_cumulative);
strcat(msg_buf, buf);
}
if (intops_per_cpu_sec) {
sprintf(buf, "<intops_per_cpu_sec>%f</intops_per_cpu_sec>\n", intops_per_cpu_sec);
strcat(msg_buf, buf);
}
if (intops_cumulative) {
sprintf(buf, "<intops_cumulative>%f</intops_cumulative>\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() {

View File

@ -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

View File

@ -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

View File

@ -837,6 +837,8 @@ bool ACTIVE_TASK::get_app_status_msg() {
parse_int(msg_buf, "<non_cpu_intensive>", non_cpu_intensive);
parse_double(msg_buf, "<fpops_per_cpu_sec>", result->fpops_per_cpu_sec);
parse_double(msg_buf, "<fpops_cumulative>", result->fpops_cumulative);
parse_double(msg_buf, "<intops_per_cpu_sec>", result->intops_per_cpu_sec);
parse_double(msg_buf, "<intops_cumulative>", result->intops_cumulative);
} else {
return false;
}

View File

@ -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>", fpops_per_cpu_sec)) continue;
else if (parse_double(buf, "<fpops_cumulative>", fpops_cumulative)) continue;
else if (parse_double(buf, "<intops_per_cpu_sec>", intops_per_cpu_sec)) continue;
else if (parse_double(buf, "<intops_cumulative>", 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(
" <fpops_per_cpu_sec>%f</fpops_per_cpu_sec>\n", fpops_per_cpu_sec
);
out.printf(" <fpops_per_cpu_sec>%f</fpops_per_cpu_sec>\n", fpops_per_cpu_sec);
}
if (fpops_cumulative) {
out.printf(
" <fpops_cumulative>%f</fpops_cumulative>\n", fpops_cumulative
);
out.printf(" <fpops_cumulative>%f</fpops_cumulative>\n", fpops_cumulative);
}
if (intops_per_cpu_sec) {
out.printf(" <intops_per_cpu_sec>%f</intops_per_cpu_sec>\n", intops_per_cpu_sec);
}
if (intops_cumulative) {
out.printf(" <intops_cumulative>%f</intops_cumulative>\n", intops_cumulative);
}
if (to_server) {
out.printf(

View File

@ -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;

View File

@ -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();
};

View File

@ -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.
<pre>
void boinc_fpops_per_cpu_second(double);
void boinc_ops_per_cpu_second(double floating_point_ops, double integer_ops);
</pre>
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.
<pre>
void boinc_fpops_cumulative(double);
void boinc_ops_cumulative(double floating_point_ops, double integer_ops);
</pre>
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.

View File

@ -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;
}

View File

@ -712,6 +712,8 @@ int RESULT::parse_from_client(FILE* fin) {
else if (parse_int(buf, "<app_version_num>", app_version_num)) continue;
else if (parse_double(buf, "<fpops_per_cpu_sec>", fpops_per_cpu_sec)) continue;
else if (parse_double(buf, "<fpops_cumulative>", fpops_cumulative)) continue;
else if (parse_double(buf, "<intops_per_cpu_sec>", intops_per_cpu_sec)) continue;
else if (parse_double(buf, "<intops_cumulative>", intops_cumulative)) continue;
else if (match_tag(buf, "<file_info>")) {
safe_strcat(xml_doc_out, buf);
while (fgets(buf, 256, fin)) {