- client: fix crash bug in CUDA init

svn path=/trunk/boinc/; revision=17856
This commit is contained in:
David Anderson 2009-04-22 03:59:39 +00:00
parent 5adb25381d
commit f9e1c98921
2 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -174,16 +174,19 @@ void COPROC_CUDA::get(COPROCS& coprocs, vector<string>& 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<string>& 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