Bugfix: a NativeLong is 32bits on windows and might be 64bits on unix. A 'JavaLong' is always 64bits.
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
package com.sheepit.client.hardware.gpu;
|
package com.sheepit.client.hardware.gpu;
|
||||||
|
|
||||||
import com.sun.jna.Library;
|
import com.sun.jna.Library;
|
||||||
import com.sun.jna.NativeLong;
|
|
||||||
|
|
||||||
public interface CUDA extends Library {
|
public interface CUDA extends Library {
|
||||||
public int cuInit(int flags);
|
public int cuInit(int flags);
|
||||||
@@ -32,5 +31,6 @@ public interface CUDA extends Library {
|
|||||||
|
|
||||||
public int cuDeviceGetName(byte[] name, int len, int dev);
|
public int cuDeviceGetName(byte[] name, int len, int dev);
|
||||||
|
|
||||||
public int cuDeviceTotalMem(NativeLong bytes[], int dev);
|
// http://en.wikipedia.org/wiki/Java_Native_Access
|
||||||
|
public int cuDeviceTotalMem(long bytes[], int dev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.sheepit.client.os.OS;
|
import com.sheepit.client.os.OS;
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
import com.sun.jna.NativeLong;
|
|
||||||
|
|
||||||
public class GPU {
|
public class GPU {
|
||||||
public static List<GPUDevice> devices = null;
|
public static List<GPUDevice> devices = null;
|
||||||
@@ -84,7 +83,7 @@ public class GPU {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeLong[] ram = new NativeLong[1];
|
long[] ram = new long[1];
|
||||||
result = cudalib.cuDeviceTotalMem(ram, num);
|
result = cudalib.cuDeviceTotalMem(ram, num);
|
||||||
|
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
@@ -92,7 +91,7 @@ public class GPU {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
devices.add(new GPUDevice(new String(name).trim(), ram[0].longValue(), "CUDA_" + Integer.toString(num)));
|
devices.add(new GPUDevice(new String(name).trim(), ram[0], "CUDA_" + Integer.toString(num)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user