All,
Which is the best way to detect if a machine is cuda-enable programmatically ? I have to write a java method which check it.
Thanks for your help,
Best regards
All,
Which is the best way to detect if a machine is cuda-enable programmatically ? I have to write a java method which check it.
Thanks for your help,
Best regards
Well, I do my stuff in C#, so I don’t really know about how to write in Java…but basically, I think there is a registry entry you can check for to detect the presence of the nVidia driver dll, and check the version number on it (version xxx.xx will mean CUDA 1.1, version yyy.yy will be 2.0, etc. – you’ll have to look up the specific version numbers).
devicequery example? Java is supposed to be portable, so better not hack with windows-specific stuff
Do a “dl_open/loadLibrary” call on “cuda.dll” or “cudart.dll” and see if windows/linux is able to load it… Then you know CUDA is there or not without depending on any CUDA libraries…
You can have your main code as a library linked with CUDA but delay loaded… That way your app can run without a CUDA dependency (no missing DLL if CUDA is NOT installed…_)
I also do a LoadLibrary check on nvapi.dll and if it’s found do a check the driver version to ensure the cuda version you have is new enough. After this I check for nvcuda.dll and then cudart.dll.
To check the driver version (not really my code but it took me a little while to find a working example):
NvAPI_Status nvapiStatus;
NV_DISPLAY_DRIVER_VERSION version = {0};
version.version = NV_DISPLAY_DRIVER_VERSION_VER;
nvapiStatus = NvAPI_Initialize();
nvapiStatus = NvAPI_GetDisplayDriverVersion (NVAPI_DEFAULT_HANDLE, &version);
if(nvapiStatus != NVAPI_OK) {… inform user nvidia card not found …}
if(version.drvVersion < DESIRED_NVIDIA_DRIVER_VERSION) {… inform user nvidia driver version not the one you wanted …}