summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLDevice.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-21 14:11:39 +0100
committerMichael Bien <[email protected]>2010-01-21 14:11:39 +0100
commit96251f7aa2770d2d8278afbd6e4b603c24932049 (patch)
tree9e650b567654215393dd2622cfa59febe68c928d /src/com/mbien/opencl/CLDevice.java
parent7a009264d53a4f9bc02fc01ea3cb12ef6cf432fe (diff)
more device properties.
Diffstat (limited to 'src/com/mbien/opencl/CLDevice.java')
-rw-r--r--src/com/mbien/opencl/CLDevice.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java
index f1a402be..e8d55eb1 100644
--- a/src/com/mbien/opencl/CLDevice.java
+++ b/src/com/mbien/opencl/CLDevice.java
@@ -2,6 +2,7 @@ package com.mbien.opencl;
import com.sun.gluegen.runtime.PointerBuffer;
import java.nio.Buffer;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
@@ -164,6 +165,16 @@ public final class CLDevice {
}
/**
+ * Returns the maximum number of work-items that can be specified in each
+ * dimension of the work-group.
+ * The minimum value is (1, 1, 1).
+ */
+ public int[] getMaxWorkItemSizes() {
+ int n = (int) deviceInfo.getLong(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
+ return deviceInfo.getInts(n, CL_DEVICE_MAX_WORK_ITEM_SIZES);
+ }
+
+ /**
* Returns the max size in bytes of the arguments that can be passed to a kernel.
* The minimum value is 256.
*/
@@ -417,13 +428,28 @@ public final class CLDevice {
}
- private class CLDeviceInfoAccessor extends CLInfoAccessor {
+ private final class CLDeviceInfoAccessor extends CLInfoAccessor {
@Override
protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet);
}
+ private int[] getInts(int n, int key) {
+
+ ByteBuffer buffer = localBB.get();
+ int ret = getInfo(key, buffer.capacity(), buffer, null);
+ CLException.checkForError(ret, "error while asking device for infos");
+
+ int[] array = new int[n];
+ for(int i = 0; i < array.length; i++) {
+ array[i] = (int)buffer.getLong();
+ }
+ buffer.rewind();
+
+ return array;
+ }
+
}