diff --git a/checkin_notes b/checkin_notes index 61e507821e..01285c3cf0 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5540,7 +5540,7 @@ Rom 8 July 2008 boinccas.dll boinccas95.dll -Eric K 8 July 2008 +Eric K 8 July 2008 - Fix for unicode compiles in DlgItemProperties.cpp - Fix for compilers that can't concatenate a normal character string to a wide character string. For example L"Hi " "There" works in GCC @@ -5568,7 +5568,7 @@ Eric K 8 July 2008 BOINCBaseFrame.cpp ViewWorkGrid.cpp sg_DlgMessages.cpp - DlgItemProperties.cpp + DlgItemProperties.cpp David 8 July 2008 - web: if stop_web file is present, don't allow any DB access @@ -5579,7 +5579,7 @@ David 8 July 2008 file_xfer.C html/inc/ boinc_db.inc - util.inc + util.inc Eric K 8 July 2008 - sparc-solaris: detect_platforms() @@ -5895,3 +5895,17 @@ David 21 July 2008 cpu_sched.C lib/ coproc.h + +David 21 July 2008 + - client: bug fixes to the above + - client: better messages reporting coprocessors + - manager: bounds checks to avoid wxwidgets asserts + when job CPU estimates are absurdly large + + client/ + app_start.C + client_state.C + clientgui/ + ViewWorkGrid.cpp + lib/ + coproc.C,h diff --git a/client/app_start.C b/client/app_start.C index ea3d12b4cf..3e4a81934a 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -364,6 +364,8 @@ int ACTIVE_TASK::start(bool first_time) { FILE_REF fref; FILE_INFO* fip; int retval; + bool coprocs_reserved = false; + #ifdef _WIN32 get_sandbox_account_service_token(); // do this first because it affects how we create shmem seg @@ -495,6 +497,9 @@ int ACTIVE_TASK::start(bool first_time) { exit(0); } + reserve_coprocs(); + coprocs_reserved = true; + #ifdef _WIN32 PROCESS_INFORMATION process_info; STARTUPINFO startup_info; @@ -519,10 +524,9 @@ int ACTIVE_TASK::start(bool first_time) { set_task_state(PROCESS_EXECUTING, "start"); return 0; } - // NOTE: in Windows, stderr is redirected in boinc_init_diagnostics(); sprintf(cmdline, "%s %s %s", - exec_path, wup->command_line, app_version->cmdline + exec_path, wup->command_line.c_str(), app_version->cmdline ); cuda_cmdline(this, cmdline); @@ -841,12 +845,15 @@ int ACTIVE_TASK::start(bool first_time) { #endif set_task_state(PROCESS_EXECUTING, "start"); - reserve_coprocs(); return 0; // go here on error; "buf" contains error message, "retval" is nonzero // error: + if (coprocs_reserved) { + free_coprocs(); + } + // if something failed, it's possible that the executable was munged. // Verify it to trigger another download. // diff --git a/client/client_state.C b/client/client_state.C index 0541b79b13..3900e5f906 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -235,15 +235,16 @@ int CLIENT_STATE::init() { for (i=0; itype, c->count); + c->description(buf); + msg_printf(NULL, MSG_INFO, "Coprocessor: %s", buf); } } diff --git a/clientgui/ViewWorkGrid.cpp b/clientgui/ViewWorkGrid.cpp index d4b956119d..b81fa7e3cc 100644 --- a/clientgui/ViewWorkGrid.cpp +++ b/clientgui/ViewWorkGrid.cpp @@ -714,7 +714,7 @@ wxInt32 CViewWorkGrid::FormatProgress(wxInt32 item, wxString& strBuffer) const { wxInt32 CViewWorkGrid::FormatTimeToCompletion(wxInt32 item, wxString& strBuffer) const { - float fBuffer = 0; + double est = 0; wxInt32 iHour = 0; wxInt32 iMin = 0; wxInt32 iSec = 0; @@ -722,15 +722,19 @@ wxInt32 CViewWorkGrid::FormatTimeToCompletion(wxInt32 item, wxString& strBuffer) RESULT* result = wxGetApp().GetDocument()->result(item); if (result) { - fBuffer = result->estimated_cpu_time_remaining; + est = result->estimated_cpu_time_remaining; + if (est > 86400*365*10) { + est = 86400*365*10; // sanity check + } + } - if (0 >= fBuffer) { + if (est <= 0) { strBuffer = wxT("---"); } else { - iHour = (wxInt32)(fBuffer / (60 * 60)); - iMin = (wxInt32)(fBuffer / 60) % 60; - iSec = (wxInt32)(fBuffer) % 60; + iHour = (wxInt32)(est / (60 * 60)); + iMin = (wxInt32)(est / 60) % 60; + iSec = (wxInt32)(est) % 60; ts = wxTimeSpan(iHour, iMin, iSec); diff --git a/lib/coproc.C b/lib/coproc.C index 267ef7c20a..e608c7af94 100644 --- a/lib/coproc.C +++ b/lib/coproc.C @@ -105,11 +105,8 @@ const char* COPROC_CUDA::get(COPROCS& coprocs) { int count; #ifdef _WIN32 - int retval; int (__stdcall* __cudaGetDeviceCount)(int*); int (__stdcall* __cudaGetDeviceProperties)(cudaDeviceProp*, int); - int bufsize=256; - char buf[256], path[256]; HMODULE cudalib = LoadLibrary("nvcuda.dll"); if (!cudalib) { return "Can't load library nvcuda.dll"; @@ -175,10 +172,10 @@ const char* COPROC_CUDA::get(COPROCS& coprocs) { // add a non-existent CUDA coproc (for debugging) // -void fake_cuda(COPROCS& coprocs) { +void fake_cuda(COPROCS& coprocs, int count) { COPROC_CUDA* cc = new COPROC_CUDA; strcpy(cc->type, "CUDA"); - cc->count = 1; + cc->count = count; strcpy(cc->prop.name, "CUDA NVIDIA chip"); cc->prop.totalGlobalMem = 1000; cc->prop.sharedMemPerBlock = 100; @@ -310,6 +307,10 @@ int COPROC_CUDA::parse(FILE* fin) { return ERR_XML_PARSE; } +void COPROC_CUDA::description(char* p) { + sprintf(p, "%s (%d)", prop.name, count); +} + const char* COPROC_CELL_SPE::get(COPROCS&) { return NULL; } diff --git a/lib/coproc.h b/lib/coproc.h index 81266d537c..b765a8a2e6 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -46,7 +46,9 @@ struct COPROC { strcpy(type, t); count = 0; used = 0; + memset(&owner, 0, sizeof(owner)); } + virtual void description(char*){}; virtual ~COPROC(){} int parse(MIOFILE&); }; @@ -115,6 +117,7 @@ struct COPROC_CUDA : public COPROC { COPROC_CUDA(): COPROC("CUDA"){} virtual ~COPROC_CUDA(){} static const char* get(COPROCS&); + virtual void description(char*); void clear(); int parse(FILE*); }; @@ -123,9 +126,10 @@ struct COPROC_CUDA : public COPROC { struct COPROC_CELL_SPE : public COPROC { static const char* get(COPROCS&); COPROC_CELL_SPE() : COPROC("Cell SPE"){} + virtual void description(char*); virtual ~COPROC_CELL_SPE(){} }; -void fake_cuda(COPROCS&); +void fake_cuda(COPROCS&, int); #endif