aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/mbien/opencl/CLDevice.java58
-rw-r--r--src/com/mbien/opencl/CLProgramBuilder.java2
-rw-r--r--src/com/mbien/opencl/util/CLUtil.java3
-rw-r--r--test/com/mbien/opencl/HighLevelBindingTest.java7
4 files changed, 66 insertions, 4 deletions
diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java
index a4a4b380..cae250c0 100644
--- a/src/com/mbien/opencl/CLDevice.java
+++ b/src/com/mbien/opencl/CLDevice.java
@@ -355,6 +355,13 @@ public final class CLDevice extends CLObject {
}
/**
+ * Returns the execution capabilities as EnumSet.
+ */
+ public EnumSet<Capabilities> getExecutionCapabilities() {
+ return Capabilities.valuesOf((int)deviceInfo.getLong(CL_DEVICE_EXECUTION_CAPABILITIES));
+ }
+
+ /**
* Returns the optional half precision floating-point capability of the device.
* The required minimum half precision floating-point capabilities as implemented by this
* extension are {@link FPConfig#ROUND_TO_ZERO}, {@link FPConfig#ROUND_TO_INF}
@@ -432,7 +439,7 @@ public final class CLDevice extends CLObject {
/**
* Returns true if the OpenCL device is a little endian device and false otherwise.
*/
- public boolean isLittleEndianAvailable() {
+ public boolean isLittleEndian() {
return deviceInfo.getLong(CL_DEVICE_ENDIAN_LITTLE) == CL_TRUE;
}
@@ -546,6 +553,55 @@ public final class CLDevice extends CLObject {
}
/**
+ * Enumeration for the execution capabilities of the device.
+ */
+ public enum Capabilities {
+
+ /**
+ * The OpenCL device can execute OpenCL kernels.
+ */
+ EXEC_KERNEL(CL_EXEC_KERNEL),
+
+ /**
+ * The OpenCL device can execute native kernels.
+ */
+ EXEC_NATIVE_KERNEL(CL_EXEC_NATIVE_KERNEL);
+
+ /**
+ * Value of wrapped OpenCL device type.
+ */
+ public final int CAPS;
+
+ private Capabilities(int type) {
+ this.CAPS = type;
+ }
+
+ public static Capabilities valueOf(int caps) {
+ switch(caps) {
+ case(CL_EXEC_KERNEL):
+ return EXEC_KERNEL;
+ case(CL_EXEC_NATIVE_KERNEL):
+ return EXEC_NATIVE_KERNEL;
+ }
+ return null;
+ }
+
+ public static EnumSet<Capabilities> valuesOf(int bitfield) {
+ if((EXEC_KERNEL.CAPS & bitfield) != 0) {
+ if((EXEC_NATIVE_KERNEL.CAPS & bitfield) != 0) {
+ return EnumSet.of(EXEC_KERNEL, EXEC_NATIVE_KERNEL);
+ }else{
+ return EnumSet.of(EXEC_KERNEL);
+ }
+ }else if((EXEC_NATIVE_KERNEL.CAPS & bitfield) != 0){
+ return EnumSet.of(EXEC_NATIVE_KERNEL);
+ }
+ return null;
+ }
+
+ }
+
+ /**
* Enumeration for the type of a device.
*/
public enum Type {
diff --git a/src/com/mbien/opencl/CLProgramBuilder.java b/src/com/mbien/opencl/CLProgramBuilder.java
index fea611a9..7071d142 100644
--- a/src/com/mbien/opencl/CLProgramBuilder.java
+++ b/src/com/mbien/opencl/CLProgramBuilder.java
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* CLProgramBuilder is a helper for building programs with more complex configurations or
- * building multiple programs with the same configuration.
+ * building multiple programs with similar configurations.
* @see CLProgram#prepare()
* @see #createConfiguration()
* @see #createConfiguration(com.mbien.opencl.CLProgram)
diff --git a/src/com/mbien/opencl/util/CLUtil.java b/src/com/mbien/opencl/util/CLUtil.java
index f33451f3..2b47ac84 100644
--- a/src/com/mbien/opencl/util/CLUtil.java
+++ b/src/com/mbien/opencl/util/CLUtil.java
@@ -93,11 +93,12 @@ public class CLUtil {
map.put("CL_DEVICE_IMAGE2D_MAX_DIMENSIONS", Arrays.asList(dev.getMaxImage2dWidth(), dev.getMaxImage2dHeight()).toString());
map.put("CL_DEVICE_IMAGE3D_MAX_DIMENSIONS", Arrays.asList(dev.getMaxImage2dWidth(), dev.getMaxImage2dHeight(), dev.getMaxImage3dDepth()).toString());
map.put("CL_DEVICE_MAX_SAMPLERS", dev.getMaxSamplers()+"");
+ map.put("CL_DEVICE_EXECUTION_CAPABILITIES", dev.getExecutionCapabilities()+"");
map.put("CL_DEVICE_ADDRESS_BITS", dev.getAddressBits()+"");
map.put("cl_khr_fp16", dev.isHalfFPAvailable()+"");
map.put("cl_khr_fp64", dev.isDoubleFPAvailable()+"");
- map.put("CL_DEVICE_ENDIAN_LITTLE", dev.isLittleEndianAvailable()+"");
+ map.put("CL_DEVICE_ENDIAN_LITTLE", dev.isLittleEndian()+"");
map.put("CL_DEVICE_HALF_FP_CONFIG", dev.getHalfFPConfig()+"");
map.put("CL_DEVICE_SINGLE_FP_CONFIG", dev.getSingleFPConfig()+"");
map.put("CL_DEVICE_DOUBLE_FP_CONFIG", dev.getDoubleFPConfig()+"");
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java
index a6520851..fd201bad 100644
--- a/test/com/mbien/opencl/HighLevelBindingTest.java
+++ b/test/com/mbien/opencl/HighLevelBindingTest.java
@@ -10,6 +10,7 @@ import com.mbien.opencl.CLDevice.FPConfig;
import com.mbien.opencl.CLDevice.GlobalMemCacheType;
import com.mbien.opencl.CLDevice.LocalMemType;
import com.mbien.opencl.CLDevice.Type;
+import com.mbien.opencl.CLDevice.Capabilities;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
@@ -60,6 +61,9 @@ public class HighLevelBindingTest {
for (Type e : Type.values()) {
assertEquals(e, Type.valueOf(e.TYPE));
}
+ for (Capabilities e : Capabilities.values()) {
+ assertEquals(e, Capabilities.valueOf(e.CAPS));
+ }
// CLMemory enums
for (Mem e : Mem.values()) {
@@ -145,10 +149,11 @@ public class HighLevelBindingTest {
out.println(" number of address bits: "+device.getAddressBits());
out.println(" half FP available: "+device.isHalfFPAvailable());
out.println(" double FP available: "+device.isDoubleFPAvailable());
- out.println(" little endian: "+device.isLittleEndianAvailable());
+ out.println(" little endian: "+device.isLittleEndian());
out.println(" half FP config: "+device.getHalfFPConfig());
out.println(" single FP config: "+device.getSingleFPConfig());
out.println(" double FP config: "+device.getDoubleFPConfig());
+ out.println(" execution capabilities: "+device.getExecutionCapabilities());
out.println(" extensions: "+device.getExtensions());
}
}