Bugfix: detection of GPU vram over 4GB
This commit is contained in:
@@ -33,6 +33,6 @@ public interface CUDA extends Library {
|
|||||||
|
|
||||||
public int cuDeviceGetName(byte[] name, int len, int dev);
|
public int cuDeviceGetName(byte[] name, int len, int dev);
|
||||||
|
|
||||||
// http://en.wikipedia.org/wiki/Java_Native_Access
|
public int cuDeviceTotalMem_v2(LongByReference bytes, int dev);
|
||||||
public int cuDeviceTotalMem(LongByReference bytes, int dev);
|
public int cuDeviceTotalMem(LongByReference bytes, int dev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,13 @@ public class GPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LongByReference ram = new LongByReference();
|
LongByReference ram = new LongByReference();
|
||||||
|
try {
|
||||||
|
result = cudalib.cuDeviceTotalMem_v2(ram, num);
|
||||||
|
}
|
||||||
|
catch (UnsatisfiedLinkError e) {
|
||||||
|
// fall back to old function
|
||||||
result = cudalib.cuDeviceTotalMem(ram, num);
|
result = cudalib.cuDeviceTotalMem(ram, num);
|
||||||
|
}
|
||||||
|
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out.println("GPU::generate cuDeviceTotalMem failed (ret: " + CUresult.stringFor(result) + ")");
|
System.out.println("GPU::generate cuDeviceTotalMem failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
|
|||||||
Reference in New Issue
Block a user