From f9e1c98921b6ee5c56dc062875b0de791f739206 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 22 Apr 2009 03:59:39 +0000 Subject: [PATCH] - client: fix crash bug in CUDA init svn path=/trunk/boinc/; revision=17856 --- checkin_notes | 6 ++++++ lib/coproc.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1506238cda..107dec4ff0 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4076,3 +4076,9 @@ David 21 Apr 2009 app_start.cpp lib/ coproc.cpp,h + +David 21 Apr 2009 + - client: fix crash bug in CUDA init + + lib/ + coproc.cpp diff --git a/lib/coproc.cpp b/lib/coproc.cpp index 809ab29daf..c509dd6a1c 100644 --- a/lib/coproc.cpp +++ b/lib/coproc.cpp @@ -174,16 +174,19 @@ void COPROC_CUDA::get(COPROCS& coprocs, vector& strings) { HMODULE cudalib = LoadLibrary("cudart.dll"); if (!cudalib) { strings.push_back("Can't load library cudart.dll"); + return; } __cudaGetDeviceCount = (PCGDC)GetProcAddress( cudalib, "cudaGetDeviceCount" ); if (!__cudaGetDeviceCount) { strings.push_back("Library doesn't have cudaGetDeviceCount()"); + return; } __cudaGetDeviceProperties = (PCGDP)GetProcAddress( cudalib, "cudaGetDeviceProperties" ); if (!__cudaGetDeviceProperties) { strings.push_back("Library doesn't have cudaGetDeviceProperties()"); + return; } #ifndef SIM @@ -222,19 +225,17 @@ void COPROC_CUDA::get(COPROCS& coprocs, vector& strings) { #endif if (!cudalib) { strings.push_back("Can't load library libcudart"); -#ifdef _USING_FCGI_ - FCGI::perror("dlopen"); -#else - std::perror("dlopen"); -#endif + return; } __cudaGetDeviceCount = (void(*)(int*)) dlsym(cudalib, "cudaGetDeviceCount"); if(!__cudaGetDeviceCount) { strings.push_back("Library doesn't have cudaGetDeviceCount()"); + return; } __cudaGetDeviceProperties = (void(*)(cudaDeviceProp*, int)) dlsym( cudalib, "cudaGetDeviceProperties" ); if (!__cudaGetDeviceProperties) { strings.push_back("Library doesn't have cudaGetDeviceProperties()"); + return; } #endif