From 22c1ff5cd90e476ddf59cf5c3d50e5b8400bf6bb Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 23 Jun 2011 09:15:40 +0000 Subject: [PATCH] -MGR: eliminate unnecessary get_host_info RPCs. svn path=/trunk/boinc/; revision=23772 --- checkin_notes | 13 +++++++++++++ clientgui/DlgAdvPreferences.cpp | 4 ++-- clientgui/MainDocument.cpp | 30 ++++-------------------------- clientgui/MainDocument.h | 4 ---- clientgui/ProjectInfoPage.cpp | 30 +++--------------------------- 5 files changed, 22 insertions(+), 59 deletions(-) diff --git a/checkin_notes b/checkin_notes index 25a9994273..516797758b 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3730,3 +3730,16 @@ Charlie 22 Jun 2011 coproc.cpp, .h gui_rpc_client.h gui_rpc_client_ops.cpp + +Charlie 23 Jun 2011 + - MGR: It turns out we want the Wizard ProjectInfo Page to check for ATI and NVIDIA + GPUs regardless of whether they were reported by CAL, CUDA or OpenCL, so we can + just check CC_STATE::have_ati and have_nvidia even for newer clients. This + means the Manager doesn't need to do get_host_info RPCs, because all the host + info it needs is available from the host_info section of the get_state RPC, so + eliminate the unnecessary get_host_info RPCs. + + clientgui/ + DlgAdvPreferences.cpp + MainDocument.cpp, .h + ProjectInfoPage.cpp diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index 5564b9b18f..9bbb5cfbde 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -774,10 +774,10 @@ void CDlgAdvPreferences::OnAddExclusiveApp(wxCommandEvent&) { wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - if (strstr(pDoc->host.os_name, "Darwin")) { + if (strstr(pDoc->state.host_info.os_name, "Darwin")) { hostIsMac = true; extension = wxT(".app"); - } else if (strstr(pDoc->host.os_name, "Microsoft")) { + } else if (strstr(pDoc->state.host_info.os_name, "Microsoft")) { hostIsWin = true; extension = wxT(".exe"); } diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 7877611e86..6133a29677 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -410,7 +410,6 @@ CMainDocument::CMainDocument() : rpc(this) { m_dtCachedStateTimestamp = wxDateTime((time_t)0); m_iGet_state_rpc_result = 0; - m_iGet_host_info_rpc_result = 0; m_dtCachedCCStatusTimestamp = wxDateTime((time_t)0); m_iGet_status_rpc_result = 0; @@ -623,7 +622,6 @@ int CMainDocument::CachedStateUpdate() { int retval = 0; if (m_iGet_state_rpc_result) retval = m_iGet_state_rpc_result; - if (m_iGet_host_info_rpc_result) retval = m_iGet_host_info_rpc_result; if (retval) m_pNetworkConnection->SetStateDisconnected(); @@ -634,7 +632,6 @@ int CMainDocument::CachedStateUpdate() { int CMainDocument::ResetState() { rpcClient.close(); state.clear(); - host.clear_host_info(); results.clear(); ft.clear(); statistics_status.clear(); @@ -999,19 +996,8 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) { request.arg1 = &async_state_buf; request.exchangeBuf = &state; request.rpcType = RPC_TYPE_ASYNC_NO_REFRESH; - request.resultPtr = &m_iGet_state_rpc_result; - - RequestRPC(request); - - // *********** RPC_GET_HOST_INFO ************** - - request.clear(); - request.which_rpc = RPC_GET_HOST_INFO; - request.arg1 = &async_host_buf; - request.exchangeBuf = &host; - request.rpcType = RPC_TYPE_ASYNC_NO_REFRESH; request.completionTime = &m_dtCachedStateTimestamp; - request.resultPtr = &m_iGet_host_info_rpc_result; + request.resultPtr = &m_iGet_state_rpc_result; RequestRPC(request); } @@ -1195,14 +1181,6 @@ int CMainDocument::ForceCacheUpdate(bool immediate) { wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get State Failed '%d'"), retval); m_pNetworkConnection->SetStateDisconnected(); } - pFrame->UpdateStatusText(_("Retrieving host information; please wait...")); - - m_iGet_host_info_rpc_result = rpc.get_host_info(host); - if (m_iGet_host_info_rpc_result) { - retval = m_iGet_host_info_rpc_result; - wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get Host Information Failed '%d'"), retval); - m_pNetworkConnection->SetStateDisconnected(); - } pFrame->UpdateStatusText(wxEmptyString); } else { @@ -1823,7 +1801,7 @@ int CMainDocument::CachedNoticeUpdate() { if (IsConnected()) { // Can't look up previous last read message until we know machine name - if (!strlen(host.domain_name)) { + if (!strlen(state.host_info.domain_name)) { goto done; } @@ -1856,7 +1834,7 @@ void CMainDocument::SaveUnreadNoticeInfo() { if (dLastSavedArrivalTime != m_dLastReadNoticeArrivalTime) { wxString strBaseConfigLocation = wxString(wxT("/Notices/")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); - wxString strDomainName = wxString(host.domain_name, wxConvUTF8, strlen(host.domain_name)); + wxString strDomainName = wxString(state.host_info.domain_name, wxConvUTF8, strlen(state.host_info.domain_name)); wxString strArrivalTime = wxEmptyString; pConfig->SetPath(strBaseConfigLocation + strDomainName); @@ -1872,7 +1850,7 @@ void CMainDocument::SaveUnreadNoticeInfo() { void CMainDocument::RestoreUnreadNoticeInfo() { wxString strBaseConfigLocation = wxString(wxT("/Notices/")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); - wxString strDomainName = wxString(host.domain_name, wxConvUTF8, strlen(host.domain_name)); + wxString strDomainName = wxString(state.host_info.domain_name, wxConvUTF8, strlen(state.host_info.domain_name)); double dLastReadNoticeTime; wxString strArrivalTime = wxEmptyString; int i, n = (int)notices.notices.size(); diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 0a41c85285..89c778f1ea 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -181,10 +181,6 @@ public: CC_STATUS status; CC_STATUS async_status_buf; int m_iGet_status_rpc_result; - - HOST_INFO host; - HOST_INFO async_host_buf; - int m_iGet_host_info_rpc_result; wxDateTime m_dtCachedStateTimestamp; // diff --git a/clientgui/ProjectInfoPage.cpp b/clientgui/ProjectInfoPage.cpp index 258e1d58f9..240adb8472 100644 --- a/clientgui/ProjectInfoPage.cpp +++ b/clientgui/ProjectInfoPage.cpp @@ -546,10 +546,6 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { wxArrayString aCategories; bool bCategoryFound = false; CProjectInfo* pProjectInfo = NULL; - wxString strVersion; - int iMajor, iMinor, iRelease; - bool bHave_CAL = false; - bool bHave_CUDA = false; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); @@ -578,26 +574,6 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { wxASSERT(m_pProjectURLStaticCtrl); wxASSERT(m_pProjectURLCtrl); - //TODO: Find a better way to determine whether Client has OpenCL support - pDoc->GetConnectedComputerVersion(strVersion); - sscanf(strVersion.char_str(), "%d.%d.%d", &iMajor, &iMinor, &iRelease); - - // Older clients (before OpenCL support) reported an ATI GPU iff CAL was installed, - // and reported NVIDIA GPUs iff CUDA was installed. Newer clients with can report - // ATI GPUS if either CAL or OpenCl or both is installed, and can report NVIDIA GPUs - // if either CUDA or OpenCl or both is installed. So newer clients must differentiate - // have_cal from have_ati and have_cuda from have_nvidia. - if ((iMajor > 6) || ((iMajor == 6) && (iMinor > 12))) { - // Newer Client with openCL support - bHave_CAL = pDoc->host._coprocs.ati.have_cal; - bHave_CUDA = pDoc->host._coprocs.nvidia.have_cuda; - } else { - // Older Client before openCL support - bHave_CAL = pDoc->state.have_ati; - bHave_CUDA = pDoc->state.have_nvidia; - } - - m_pTitleStaticCtrl->SetLabel( _("Choose a project") ); @@ -732,15 +708,15 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { } if (pProjectInfo->m_bProjectSupportsCUDA) { - if (!bHave_CUDA) continue; + if (!pDoc->state.have_nvidia) continue; } if (pProjectInfo->m_bProjectSupportsCAL) { - if (!bHave_CAL) continue; + if (!pDoc->state.have_ati) continue; } if (pProjectInfo->m_bProjectSupportsMulticore) { - if (pDoc->host.p_ncpus < 4) continue; + if (pDoc->state.host_info.p_ncpus < 4) continue; } // Application has CUDA, ATI or MT if required, or none are required