- result of code shuffle: the HOST_INFO structure returned

by the get_host_info() GUI RPC now contains GPU info

svn path=/trunk/boinc/; revision=19798
This commit is contained in:
David Anderson 2009-12-07 06:13:17 +00:00
parent 6b937c7e54
commit e27659858d
10 changed files with 58 additions and 36 deletions

View File

@ -9808,3 +9808,17 @@ David 6 Dec 2009
cpu_sched.cpp
lib/
hostinfo.h
David 6 Dec 2009
- result of code shuffle: the HOST_INFO structure returned
by the get_host_info() GUI RPC now contains GPU info
client/
gui_rpc_server_ops.cpp
cs_scheduler.cpp
cs_statefile.cpp
lib/
hostinfo.cpp,h
coproc.cpp,h
sched/
sched_types.cpp

View File

@ -213,7 +213,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) {
//
host_info.get_host_info();
set_ncpus();
retval = host_info.write(mf, config.suppress_net_info);
retval = host_info.write(mf, config.suppress_net_info, false);
//if (retval) return retval;
// get and write disk usage
@ -242,12 +242,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) {
}
if (host_info.coprocs.coprocs.size()) {
fprintf(f, " <coprocs>\n");
for (i=0; i<host_info.coprocs.coprocs.size(); i++) {
COPROC* c = host_info.coprocs.coprocs[i];
c->write_xml(mf);
}
fprintf(f, " </coprocs>\n");
host_info.coprocs.write_xml(mf);
}
// report results

View File

@ -636,7 +636,7 @@ int CLIENT_STATE::write_state(MIOFILE& f) {
int retval;
f.printf("<client_state>\n");
retval = host_info.write(f, false);
retval = host_info.write(f, false, false);
if (retval) return retval;
retval = time_stats.write(f, false);
if (retval) return retval;
@ -842,7 +842,7 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
// However, BoincView (which does its own parsing) expects it
// to be in the get_state() reply, so leave it in for now
//
retval = host_info.write(f, false);
retval = host_info.write(f, false, false);
if (retval) return retval;
retval = time_stats.write(f, false);
if (retval) return retval;

View File

@ -509,7 +509,7 @@ static void handle_result_op(char* buf, MIOFILE& fout, const char* op) {
}
static void handle_get_host_info(char*, MIOFILE& fout) {
gstate.host_info.write(fout, false);
gstate.host_info.write(fout, false, true);
}
static void handle_get_screensaver_tasks(MIOFILE& fout) {

View File

@ -210,7 +210,7 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
);
MIOFILE mf;
mf.init_file(f);
ai.host_info.write(mf, false);
ai.host_info.write(mf, false, true);
ai.proxy_info.write(mf);
ai.global_prefs.write(mf);
fprintf(f, "</app_init_data>\n");

View File

@ -116,12 +116,10 @@ void COPROCS::summary_string(char* buf, int len) {
strcpy(buf, bigbuf);
}
// used only to parse scheduler request messages
//
int COPROCS::parse(FILE* fin) {
int COPROCS::parse(MIOFILE& fin) {
char buf[1024];
while (fgets(buf, sizeof(buf), fin)) {
while (fin.fgets(buf, sizeof(buf))) {
if (match_tag(buf, "</coprocs>")) {
return 0;
}
@ -143,6 +141,17 @@ int COPROCS::parse(FILE* fin) {
return ERR_XML_PARSE;
}
void COPROCS::write_xml(MIOFILE& mf) {
#ifndef _USING_FCGI_
mf.printf(" <coprocs>\n");
for (unsigned i=0; i<coprocs.size(); i++) {
COPROC* c = coprocs[i];
c->write_xml(mf);
}
mf.printf(" </coprocs>\n");
#endif
}
COPROC* COPROCS::lookup(const char* type) {
for (unsigned int i=0; i<coprocs.size(); i++) {
COPROC* cp = coprocs[i];
@ -251,11 +260,11 @@ void COPROC_CUDA::clear() {
prop.multiProcessorCount = 0;
}
int COPROC_CUDA::parse(FILE* fin) {
int COPROC_CUDA::parse(MIOFILE& fin) {
char buf[1024], buf2[256];
clear();
while (fgets(buf, sizeof(buf), fin)) {
while (fin.fgets(buf, sizeof(buf))) {
if (strstr(buf, "</coproc_cuda>")) {
return 0;
}
@ -390,13 +399,13 @@ void COPROC_ATI::clear() {
memset(&info, 0, sizeof(info));
}
int COPROC_ATI::parse(FILE* fin) {
int COPROC_ATI::parse(MIOFILE& fin) {
char buf[1024];
int n;
clear();
while (fgets(buf, sizeof(buf), fin)) {
while (fin.fgets(buf, sizeof(buf))) {
if (strstr(buf, "</coproc_ati>")) return 0;
if (parse_int(buf, "<count>", count)) continue;
if (parse_str(buf, "<name>", name, sizeof(name))) continue;

View File

@ -157,22 +157,14 @@ struct COPROCS {
delete coprocs[i];
}
}
#if 0
#ifndef _USING_FCGI_
void write_xml(MIOFILE& out) {
for (unsigned int i=0; i<coprocs.size(); i++) {
coprocs[i]->write_xml(out);
}
}
#endif
#endif
void write_xml(MIOFILE& out);
void get(
bool use_all, std::vector<std::string> &descs,
std::vector<std::string> &warnings,
std::vector<int>& ignore_cuda_dev,
std::vector<int>& ignore_ati_dev
);
int parse(FILE*);
int parse(MIOFILE&);
void summary_string(char*, int);
COPROC* lookup(const char*);
bool fully_used() {
@ -248,7 +240,7 @@ struct COPROC_CUDA : public COPROC {
);
void description(char*);
void clear();
int parse(FILE*);
int parse(MIOFILE&);
// Estimate of peak FLOPS.
// FLOPS for a given app may be much less;
@ -310,7 +302,7 @@ struct COPROC_ATI : public COPROC {
);
void description(char*);
void clear();
int parse(FILE*);
int parse(MIOFILE&);
inline double peak_flops() {
double x = attribs.numberOfSIMD * attribs.wavefrontSize * 2.5 * attribs.engineClock * 1.e6;
// clock is in MHz

View File

@ -103,6 +103,9 @@ int HOST_INFO::parse(MIOFILE& in) {
else if (parse_double(buf, "<d_free>", d_free)) continue;
else if (parse_str(buf, "<os_name>", os_name, sizeof(os_name))) continue;
else if (parse_str(buf, "<os_version>", os_version, sizeof(os_version))) continue;
else if (match_tag(buf, "<coprocs>")) {
coprocs.parse(in);
}
}
return ERR_XML_PARSE;
}
@ -110,7 +113,9 @@ int HOST_INFO::parse(MIOFILE& in) {
// Write the host information, to the client state XML file
// or in a scheduler request message
//
int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
int HOST_INFO::write(
MIOFILE& out, bool suppress_net_info, bool include_coprocs
) {
char pv[265], pm[256], pf[256], osn[256], osv[256];
out.printf(
"<host_info>\n"
@ -146,8 +151,7 @@ int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
" <d_total>%f</d_total>\n"
" <d_free>%f</d_free>\n"
" <os_name>%s</os_name>\n"
" <os_version>%s</os_version>\n"
"</host_info>\n",
" <os_version>%s</os_version>\n",
host_cpid,
p_ncpus,
pv,
@ -165,6 +169,12 @@ int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
osn,
osv
);
if (include_coprocs) {
coprocs.write_xml(out);
}
out.printf(
"</host_info>\n"
);
return 0;
}

View File

@ -62,7 +62,7 @@ public:
HOST_INFO();
int parse(MIOFILE&);
int write(MIOFILE&, bool suppress_net_info);
int write(MIOFILE&, bool suppress_net_info, bool include_coprocs);
int parse_cpu_benchmarks(FILE*);
int write_cpu_benchmarks(FILE*);
void print();

View File

@ -350,7 +350,9 @@ const char* SCHEDULER_REQUEST::parse(FILE* fin) {
continue;
}
if (match_tag(buf, "coprocs")) {
coprocs.parse(fin);
MIOFILE mf;
mf.init_file(fin);
coprocs.parse(mf);
coproc_cuda = (COPROC_CUDA*)coprocs.lookup("CUDA");
coproc_ati = (COPROC_ATI*)coprocs.lookup("ATI");
continue;