summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-03-16 01:07:55 +0100
committerMichael Bien <[email protected]>2010-03-16 01:07:55 +0100
commit81b94f83cb76128c481d21134c3d462590db23d0 (patch)
tree3c6665bc97d07a06a780bfc655bda73d37657c1e /src
parent68b70f68f42a0fce94aea9c47981edc8de5dd1d1 (diff)
added Capabilities enum and getter to CLDevice.
updated tests.
Diffstat (limited to 'src')
-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
3 files changed, 60 insertions, 3 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()+"");