Workaround bug in CUDA runtime. When using CUDA 2.0, it's required to use a driver that supports CUDA 2.0.

This commit is contained in:
castano 2008-10-16 08:39:58 +00:00
parent 36ed6bebda
commit d01a5c1661

View File

@ -52,22 +52,42 @@ static bool isWow32()
{
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
BOOL bIsWow64 = FALSE;
BOOL bIsWow64 = FALSE;
if (NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
{
if (NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
{
// Assume 32 bits.
return true;
}
}
return true;
}
}
return !bIsWow64;
return !bIsWow64;
}
#endif
#if NV_OS_WIN32
static bool isCuda20DriverAvailable()
{
bool result = false;
HINSTANCE nvcuda = LoadLibraryExA( "nvcuda.dll", NULL, 0 );
if (nvcuda != NULL)
{
FARPROC lcuStreamCreate = GetProcAddress( nvcuda, "cuStreamCreate" );
result = lcuStreamCreate != NULL;
FreeLibrary( nvcuda );
}
return result;
}
#endif
/// Determine if CUDA is available.
bool nv::cuda::isHardwarePresent()
@ -90,6 +110,14 @@ bool nv::cuda::isHardwarePresent()
return false;
}
// Make sure that CUDA driver matches CUDA runtime.
#if NV_OS_WIN32 && CUDART_VERSION >= 2000
if (!isCuda20DriverAvailable())
{
return false;
}
#endif
// @@ Make sure that warp size == 32
}