Merge fixes from trunk. Prevent CUDA dll mismatches.
This commit is contained in:
parent
b013aa64b9
commit
cd112e2133
@ -22,6 +22,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <nvcore/Debug.h>
|
||||
#include <nvcore/Library.h>
|
||||
#include "CudaUtils.h"
|
||||
|
||||
#if defined HAVE_CUDA
|
||||
@ -52,23 +53,52 @@ 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
|
||||
|
||||
|
||||
static bool isCudaDriverAvailable(uint version)
|
||||
{
|
||||
#if NV_OS_WIN32
|
||||
Library nvcuda("nvcuda.dll");
|
||||
#else
|
||||
Library nvcuda(NV_LIBRARY_NAME("cuda"));
|
||||
#endif
|
||||
|
||||
if (!nvcuda.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (version > 2000)
|
||||
{
|
||||
void * address = nvcuda.bindSymbol("cuStreamCreate");
|
||||
if (address == NULL) return false;
|
||||
}
|
||||
|
||||
if (version > 2010)
|
||||
{
|
||||
void * address = nvcuda.bindSymbol("cuLoadDataEx");
|
||||
if (address == NULL) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// Determine if CUDA is available.
|
||||
bool nv::cuda::isHardwarePresent()
|
||||
{
|
||||
@ -90,6 +120,12 @@ bool nv::cuda::isHardwarePresent()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure that CUDA driver matches CUDA runtime.
|
||||
if (!isCudaDriverAvailable(CUDART_VERSION))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// @@ Make sure that warp size == 32
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user