mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=12311
This commit is contained in:
parent
4945ae44be
commit
82816b451e
|
@ -3126,3 +3126,15 @@ Rom 4 Apr 2007
|
|||
Rom 4 Apr 2007 (HEAD)
|
||||
- Tag for 5.9.3 release, all platforms
|
||||
boinc_core_release_5_9_3
|
||||
|
||||
David 5 Apr 2007
|
||||
- core client: round fractional work request up to 1 sec
|
||||
- simulator now working
|
||||
|
||||
client/
|
||||
scheduler_op.C
|
||||
sim.C,h
|
||||
sim_host/prefs/projects.xml (new)
|
||||
lib/
|
||||
browser.C
|
||||
prefs.C
|
||||
|
|
|
@ -217,37 +217,36 @@ int SCHEDULER_OP::start_rpc(PROJECT* p) {
|
|||
int retval;
|
||||
char request_file[1024], reply_file[1024];
|
||||
|
||||
// if requesting work, round up to 1 sec
|
||||
//
|
||||
if (p->work_request>0 && p->work_request<1) {
|
||||
p->work_request = 1;
|
||||
}
|
||||
|
||||
safe_strcpy(scheduler_url, p->get_scheduler_url(url_index, url_random));
|
||||
if (log_flags.sched_ops) {
|
||||
msg_printf(p, MSG_INFO,
|
||||
"Sending scheduler request: %s",
|
||||
rpc_reason_string(reason)
|
||||
);
|
||||
if (p->work_request != 0.0 && p->nresults_returned != 0) {
|
||||
if (p->work_request>0 && p->nresults_returned != 0) {
|
||||
msg_printf(
|
||||
p, MSG_INFO,
|
||||
(p->work_request >= 1.0) ?
|
||||
"Requesting %.0f seconds of new work, and reporting %d completed tasks":
|
||||
"Requesting %g seconds of new work, and reporting %d completed tasks",
|
||||
"Requesting %.0f seconds of new work, and reporting %d completed tasks",
|
||||
p->work_request, p->nresults_returned
|
||||
);
|
||||
} else if (p->work_request != 0) {
|
||||
msg_printf(
|
||||
p, MSG_INFO,
|
||||
(p->work_request >= 1.0) ?
|
||||
"Requesting %.0f seconds of new work":
|
||||
"Requesting %g seconds of new work",
|
||||
"Requesting %.0f seconds of new work",
|
||||
p->work_request
|
||||
);
|
||||
} else if (p->nresults_returned != 0) {
|
||||
msg_printf(
|
||||
p, MSG_INFO,
|
||||
"Reporting %d tasks\n",
|
||||
p->nresults_returned
|
||||
msg_printf(p, MSG_INFO,
|
||||
"Reporting %d tasks\n", p->nresults_returned
|
||||
);
|
||||
} else {
|
||||
msg_printf(
|
||||
p, MSG_INFO,
|
||||
msg_printf( p, MSG_INFO,
|
||||
"(not requesting new work or reporting completed tasks)"
|
||||
);
|
||||
}
|
||||
|
|
109
client/sim.C
109
client/sim.C
|
@ -237,10 +237,10 @@ RESULT* CLIENT_STATE::lookup_result(PROJECT* p, const char* name) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
||||
static int result_num=0;
|
||||
void CLIENT_STATE::simulate_rpc(PROJECT* _p) {
|
||||
double net_fpops = host_info.p_fpops;
|
||||
char buf[256];
|
||||
SIM_PROJECT* p = (SIM_PROJECT*) _p;
|
||||
|
||||
// remove ready-to-report results
|
||||
//
|
||||
|
@ -255,7 +255,7 @@ void CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
|||
result_iter++;
|
||||
}
|
||||
}
|
||||
sprintf(buf, "<br>RPC to %s; asking for %f", p->project_name, p->work_request);
|
||||
sprintf(buf, "RPC to %s; asking for %f<br>", p->project_name, p->work_request);
|
||||
html_msg += buf;
|
||||
|
||||
while (p->work_request > 0) {
|
||||
|
@ -273,14 +273,14 @@ void CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
|||
rp->clear();
|
||||
rp->project = p;
|
||||
rp->wup = wup;
|
||||
sprintf(rp->name, "%s_%d", p->project_name, result_num++);
|
||||
sprintf(rp->name, "%s_%d", p->project_name, p->result_index++);
|
||||
rp->set_state(RESULT_FILES_DOWNLOADED, "simulate_rpc");
|
||||
wup->project = p;
|
||||
wup->rsc_fpops_est = ap->fpops_est;
|
||||
results.push_back(rp);
|
||||
double ops = ap->fpops.sample();
|
||||
rp->final_cpu_time = ops/net_fpops;
|
||||
sprintf(buf, "<br>got job %s: %f", rp->name, rp->final_cpu_time);
|
||||
sprintf(buf, "got job %s: %f<br>", rp->name, rp->final_cpu_time);
|
||||
html_msg += buf;
|
||||
p->work_request -= ap->fpops_est/net_fpops;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ bool ACTIVE_TASK_SET::poll() {
|
|||
atp->result->exit_status = 0;
|
||||
gstate.request_schedule_cpus("ATP poll");
|
||||
gstate.request_work_fetch("ATP poll");
|
||||
sprintf(buf, "<br>result %s finished\n", atp->result->name);
|
||||
sprintf(buf, "result %s finished<br>", atp->result->name);
|
||||
gstate.html_msg += buf;
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ int ACTIVE_TASK::resume_or_start(bool first_time) {
|
|||
}
|
||||
set_task_state(PROCESS_EXECUTING, "start");
|
||||
char buf[256];
|
||||
sprintf(buf, "<br>Starting %s: %f", result->name, cpu_time_left);
|
||||
sprintf(buf, "Starting %s: %f<br>", result->name, cpu_time_left);
|
||||
gstate.html_msg += buf;
|
||||
return 0;
|
||||
}
|
||||
|
@ -392,15 +392,26 @@ PROJECT::PROJECT() {
|
|||
}
|
||||
|
||||
double NORMAL_DIST::sample() {
|
||||
int i;
|
||||
double x=0;
|
||||
for (i=0; i<9; i++) {
|
||||
x += drand();
|
||||
}
|
||||
x /= 3;
|
||||
x *= var;
|
||||
x += mean;
|
||||
return x;
|
||||
const double p0 = 0.322232431088; const double q0 = 0.099348462606;
|
||||
const double p1 = 1.0; const double q1 = 0.588581570495;
|
||||
const double p2 = 0.342242088547; const double q2 = 0.531103462366;
|
||||
const double p3 = 0.204231210245e-1; const double q3 = 0.103537752850;
|
||||
const double p4 = 0.453642210148e-4; const double q4 = 0.385607006340e-2;
|
||||
double u, t, p, q, z;
|
||||
|
||||
u = drand();
|
||||
if (u < 0.5)
|
||||
t = sqrt(-2.0 * log(u));
|
||||
else
|
||||
t = sqrt(-2.0 * log(1.0 - u));
|
||||
p = p0 + t * (p1 + t * (p2 + t * (p3 + t * p4)));
|
||||
q = q0 + t * (q1 + t * (q2 + t * (q3 + t * q4)));
|
||||
if (u < 0.5)
|
||||
z = (p / q) - t;
|
||||
else
|
||||
z = t - (p / q);
|
||||
return (mean + stdev * z);
|
||||
|
||||
}
|
||||
|
||||
int NORMAL_DIST::parse(XML_PARSER& xp, char* end_tag) {
|
||||
|
@ -409,9 +420,12 @@ int NORMAL_DIST::parse(XML_PARSER& xp, char* end_tag) {
|
|||
while(!xp.get(tag, sizeof(tag), is_tag)) {
|
||||
if (!is_tag) return ERR_XML_PARSE;
|
||||
if (xp.parse_double(tag, "mean", mean)) continue;
|
||||
else if (xp.parse_double(tag, "var", var)) continue;
|
||||
else if (xp.parse_double(tag, "stdev", stdev)) continue;
|
||||
else if (!strcmp(tag, end_tag)) return 0;
|
||||
else return ERR_XML_PARSE;
|
||||
else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -424,7 +438,10 @@ int UNIFORM_DIST::parse(XML_PARSER& xp, char* end_tag) {
|
|||
if (xp.parse_double(tag, "lo", lo)) continue;
|
||||
else if (xp.parse_double(tag, "hi", hi)) continue;
|
||||
else if (!strcmp(tag, end_tag)) return 0;
|
||||
else return ERR_XML_PARSE;
|
||||
else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -437,7 +454,10 @@ int RANDOM_PROCESS::parse(XML_PARSER& xp, char* end_tag) {
|
|||
if (xp.parse_double(tag, "frac", frac)) continue;
|
||||
else if (xp.parse_double(tag, "lambda", lambda)) continue;
|
||||
else if (!strcmp(tag, end_tag)) return 0;
|
||||
else return ERR_XML_PARSE;
|
||||
else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -461,7 +481,10 @@ int SIM_APP::parse(XML_PARSER& xp) {
|
|||
retval = checkpoint_period.parse(xp, "/checkpoint_period");
|
||||
if (retval) return retval;
|
||||
} else if (xp.parse_double(tag, "working_set", working_set)) continue;
|
||||
else return ERR_XML_PARSE;
|
||||
else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -485,7 +508,10 @@ int SIM_PROJECT::parse(XML_PARSER& xp) {
|
|||
if (retval) return retval;
|
||||
} else if (xp.parse_double(tag, "resource_share", resource_share)) {
|
||||
continue;
|
||||
} else return ERR_XML_PARSE;
|
||||
} else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -508,7 +534,10 @@ int SIM_HOST::parse(XML_PARSER& xp) {
|
|||
} else if (!strcmp(tag, "idle")) {
|
||||
retval = idle.parse(xp, "/idle");
|
||||
if (retval) return retval;
|
||||
} else return ERR_XML_PARSE;
|
||||
} else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -517,7 +546,7 @@ int CLIENT_STATE::parse_projects(char* name) {
|
|||
char tag[256];
|
||||
bool is_tag;
|
||||
MIOFILE mf;
|
||||
int retval;
|
||||
int retval, index=0;
|
||||
|
||||
FILE* f = fopen(name, "r");
|
||||
if (!f) return ERR_FOPEN;
|
||||
|
@ -531,9 +560,14 @@ int CLIENT_STATE::parse_projects(char* name) {
|
|||
p->init();
|
||||
retval = p->parse(xp);
|
||||
if (retval) return retval;
|
||||
p->index = index++;
|
||||
p->result_index = 0;
|
||||
projects.push_back(p);
|
||||
} else if (!strcmp(tag, "/projects")) {
|
||||
return 0;
|
||||
} else {
|
||||
printf("unrecognized: %s\n", tag);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
|
@ -550,6 +584,15 @@ int CLIENT_STATE::parse_host(char* name) {
|
|||
return host_info.parse(xp);
|
||||
}
|
||||
|
||||
char* colors[] = {
|
||||
"#ffffdd",
|
||||
"#ffddff",
|
||||
"#ddffff",
|
||||
"#ddffdd",
|
||||
"#ddddff",
|
||||
"#ffdddd",
|
||||
};
|
||||
|
||||
void CLIENT_STATE::html_start() {
|
||||
html_out = fopen("sim_out.html", "w");
|
||||
fprintf(html_out, "<table border=1>\n");
|
||||
|
@ -561,7 +604,9 @@ void CLIENT_STATE::html_rec() {
|
|||
for (unsigned int i=0; i<active_tasks.active_tasks.size(); i++) {
|
||||
ACTIVE_TASK* atp = active_tasks.active_tasks[i];
|
||||
if (atp->task_state() == PROCESS_EXECUTING) {
|
||||
fprintf(html_out, "<td>%s: %.2f</td>", atp->result->name, atp->cpu_time_left);
|
||||
SIM_PROJECT* p = (SIM_PROJECT*)atp->result->project;
|
||||
fprintf(html_out, "<td bgcolor=%s>%s: %.2f</td>",
|
||||
colors[p->index], atp->result->name, atp->cpu_time_left);
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
@ -572,7 +617,7 @@ void CLIENT_STATE::html_rec() {
|
|||
fprintf(html_out, "<td><br></td>");
|
||||
n++;
|
||||
}
|
||||
fprintf(html_out, "<td>%s</td></tr>\n", html_msg.c_str());
|
||||
fprintf(html_out, "<td><font size=-2>%s</font></td></tr>\n", html_msg.c_str());
|
||||
html_msg = "";
|
||||
}
|
||||
|
||||
|
@ -603,8 +648,8 @@ void CLIENT_STATE::simulate(double duration, double delta) {
|
|||
html_end();
|
||||
}
|
||||
|
||||
void parse_error(char* file) {
|
||||
printf("can't parse %s\n", file);
|
||||
void parse_error(char* file, int retval) {
|
||||
printf("can't parse %s: %d\n", file, retval);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -623,7 +668,7 @@ char* next_arg(int argc, char** argv, int& i) {
|
|||
|
||||
int main(int argc, char** argv) {
|
||||
char projects[256], host[256], prefs[256];
|
||||
double duration = 20000, delta = 10;
|
||||
double duration = 200, delta = 10;
|
||||
bool flag;
|
||||
int i, retval;
|
||||
|
||||
|
@ -647,11 +692,11 @@ int main(int argc, char** argv) {
|
|||
read_config_file();
|
||||
|
||||
retval = gstate.parse_projects(projects);
|
||||
if (retval) parse_error("projects");
|
||||
if (retval) parse_error(projects, retval);
|
||||
retval = gstate.parse_host(host);
|
||||
if (retval) parse_error("host");
|
||||
if (retval) parse_error(host, retval);
|
||||
retval = gstate.global_prefs.parse_file(prefs, "", flag);
|
||||
if (retval) parse_error("prefs");
|
||||
if (retval) parse_error(prefs, retval);
|
||||
|
||||
gstate.set_ncpus();
|
||||
printf("ncpus: %d\n", gstate.ncpus);
|
||||
|
|
|
@ -23,7 +23,7 @@ using std::vector;
|
|||
class NORMAL_DIST {
|
||||
public:
|
||||
double mean;
|
||||
double var;
|
||||
double stdev;
|
||||
int parse(XML_PARSER&, char* end_tag);
|
||||
double sample();
|
||||
};
|
||||
|
@ -59,6 +59,8 @@ public:
|
|||
class SIM_PROJECT: public PROJECT {
|
||||
public:
|
||||
RANDOM_PROCESS available;
|
||||
int index;
|
||||
int result_index;
|
||||
int parse(XML_PARSER&);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<host>
|
||||
<p_fpops>1</p_fpops>
|
||||
<m_nbytes>1e9</m_nbytes>
|
||||
<p_ncpus>2</p_ncpus>
|
||||
<available>
|
||||
<frac>.8</frac>
|
||||
<lambda>1000</lambda>
|
||||
</available>
|
||||
</host>
|
|
@ -0,0 +1,23 @@
|
|||
<global_preferences>
|
||||
<source_project>http://isaac.ssl.berkeley.edu/alpha/</source_project>
|
||||
<source_scheduler>isaac.ssl.berkeley.edu/alpha_cgi/cgi</source_scheduler>
|
||||
<mod_time>1170192285</mod_time>
|
||||
<run_if_user_active/>
|
||||
<idle_time_to_run>3</idle_time_to_run>
|
||||
<leave_apps_in_memory/>
|
||||
<cpu_scheduling_period_minutes>1</cpu_scheduling_period_minutes>
|
||||
<hangup_if_dialed/>
|
||||
<work_buf_min_days>0.0001</work_buf_min_days>
|
||||
<max_cpus>4</max_cpus>
|
||||
<cpu_usage_limit>100</cpu_usage_limit>
|
||||
<disk_interval>180</disk_interval>
|
||||
<disk_max_used_gb>100</disk_max_used_gb>
|
||||
<disk_max_used_pct>50</disk_max_used_pct>
|
||||
<disk_min_free_gb>2</disk_min_free_gb>
|
||||
<vm_max_used_pct>75</vm_max_used_pct>
|
||||
<ram_max_used_busy_pct>50</ram_max_used_busy_pct>
|
||||
<ram_max_used_idle_pct>90</ram_max_used_idle_pct>
|
||||
<max_bytes_sec_down>200000</max_bytes_sec_down>
|
||||
<max_bytes_sec_up>200000</max_bytes_sec_up>
|
||||
</global_preferences>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<projects>
|
||||
<project>
|
||||
<project_name>P1</project_name>
|
||||
<resource_share>100</resource_share>
|
||||
<app>
|
||||
<latency_bound>1000</latency_bound>
|
||||
<fpops_est>100</fpops_est>
|
||||
<fpops>
|
||||
<mean>100</mean>
|
||||
<stdev>10</stdev>
|
||||
</fpops>
|
||||
<working_set>1e7</working_set>
|
||||
</app>
|
||||
<available>
|
||||
<frac>.7</frac>
|
||||
<lambda>1000</lambda>
|
||||
</available>
|
||||
</project>
|
||||
<project>
|
||||
<project_name>P2</project_name>
|
||||
<resource_share>50</resource_share>
|
||||
<app>
|
||||
<latency_bound>500</latency_bound>
|
||||
<fpops_est>50</fpops_est>
|
||||
<fpops>
|
||||
<mean>50</mean>
|
||||
<stdev>10</stdev>
|
||||
</fpops>
|
||||
<working_set>1e7</working_set>
|
||||
</app>
|
||||
<available>
|
||||
<frac>.7</frac>
|
||||
<lambda>1000</lambda>
|
||||
</available>
|
||||
</project>
|
||||
</projects>
|
|
@ -8,7 +8,6 @@ THIS FILE IS DEPRECATED. DON'T LINK TO IT.
|
|||
<ul>
|
||||
<li> <a href=build.php>Software prerequisites</a>
|
||||
<li> <a href=source_code.php>Getting source code</a>
|
||||
<li> <a href=road_map.php>Source code road map</a>
|
||||
</ul>
|
||||
|
||||
<h3>Platform-specific cookbooks</h3>
|
||||
|
|
|
@ -46,10 +46,11 @@ typedef HRESULT (WINAPI *MYSHGETFOLDERPATH)(HWND hwnd, int csidl, HANDLE hToken,
|
|||
|
||||
#endif
|
||||
|
||||
// reterieve the user's application data directory.
|
||||
// retrieve the user's application data directory.
|
||||
// Win : C:\Documents and Settings\<username>\Application Data
|
||||
// Linux: ~/
|
||||
bool get_home_dir_path( std::string& path ) {
|
||||
// Unix: ~/
|
||||
//
|
||||
void get_home_dir_path( std::string& path ) {
|
||||
#ifdef _WIN32
|
||||
TCHAR szBuffer[MAX_PATH];
|
||||
HMODULE hShell32;
|
||||
|
@ -57,8 +58,9 @@ bool get_home_dir_path( std::string& path ) {
|
|||
|
||||
// Attempt to link to dynamic function if it exists
|
||||
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
||||
if (NULL != hShell32)
|
||||
if (NULL != hShell32) {
|
||||
pfnMySHGetFolderPath = (MYSHGETFOLDERPATH) GetProcAddress(hShell32, _T("SHGetFolderPathA"));
|
||||
}
|
||||
|
||||
if (NULL != pfnMySHGetFolderPath) {
|
||||
if (SUCCEEDED((pfnMySHGetFolderPath)(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, szBuffer))) {
|
||||
|
@ -68,15 +70,13 @@ bool get_home_dir_path( std::string& path ) {
|
|||
}
|
||||
|
||||
// Free the dynamically linked to library
|
||||
if (NULL != hShell32)
|
||||
if (NULL != hShell32) {
|
||||
FreeLibrary(hShell32);
|
||||
}
|
||||
|
||||
#else
|
||||
path = std::string(_T("~/"));
|
||||
path = std::string("~/");
|
||||
#endif
|
||||
if (!path.empty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// parse name value pairs based on INI file rules.
|
||||
|
|
|
@ -107,7 +107,7 @@ void GLOBAL_PREFS::defaults() {
|
|||
hangup_if_dialed = false;
|
||||
dont_verify_images = false;
|
||||
work_buf_min_days = 0.1;
|
||||
work_buf_additional_days = 1.0;
|
||||
work_buf_additional_days = 0;
|
||||
max_cpus = 16;
|
||||
cpu_scheduling_period_minutes = 60;
|
||||
disk_interval = 60;
|
||||
|
@ -324,7 +324,7 @@ int GLOBAL_PREFS::parse_override(
|
|||
mask.dont_verify_images = true;
|
||||
continue;
|
||||
} else if (xp.parse_double(tag, "work_buf_min_days", work_buf_min_days)) {
|
||||
if (work_buf_min_days < 0.01) work_buf_min_days = 0.01;
|
||||
if (work_buf_min_days < 0.00001) work_buf_min_days = 0.00001;
|
||||
mask.work_buf_min_days = true;
|
||||
continue;
|
||||
} else if (xp.parse_double(tag, "work_buf_additional_days", work_buf_additional_days)) {
|
||||
|
|
Loading…
Reference in New Issue