Hi, Im having a trouble running a program. Im currently working with GPU type Gefore9800GT and working in Windows OS. Im using nvcc to compile my program. Thing is I have succeed to compile the work, with cudart32_40.dll and it works. However, my coworkers computer only has cudart32_41.dll so he asks me to make the program run regardless to dll version.
By googling I found some solution as following.
typedef cudaError_t (*FnGetDeviceCount ) ( int * count ) ; HMODULE hCuda=LoadLibrary("cudart32_40_17.dll"); if( !hCuda ) return ; // ERROR: cannot load dll, DllMain must have failed because cudart only depends on Kernel dll implicitly. Or cannot find dll in curent directory or in the path. FnGetDeviceCount fnGetDeviceCount=(FnGetDeviceCount)GetProcAddress(hCuda, "cudaGetDeviceCount"); if( !fnGetDeviceCount) return; // ERROR: cudart has no entry point for cudaGetDeviceCount ?! int count = 0; if( cudaSuccess != (*fnGetDeviceCount)(&count) ) return ;// ERROR: we don't wanna use CUDA if even device enumeration fails if( !count ) return; // FALLBACK: CUDA has no devices, don't try to use it, fallback to some other BLAS
but shouldnt this debugging tool just work to find it there is cudart32_40_17.dll? Is there a way to make such code to find dll from toolkit version higher than 4.0? Thank you.