summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/mbien/opencl')
-rw-r--r--src/com/mbien/opencl/CLContext.java21
-rw-r--r--src/com/mbien/opencl/CLPlatform.java32
-rw-r--r--src/com/mbien/opencl/CLProgram.java33
3 files changed, 64 insertions, 22 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java
index 66716e41..c87f2310 100644
--- a/src/com/mbien/opencl/CLContext.java
+++ b/src/com/mbien/opencl/CLContext.java
@@ -299,26 +299,7 @@ public final class CLContext {
* MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.
*/
public CLDevice getMaxFlopsDevice() {
-
- CLDevice[] clDevices = getCLDevices();
- CLDevice maxFLOPSDevice = null;
-
- int maxflops = -1;
-
- for (int i = 0; i < clDevices.length; i++) {
-
- CLDevice device = clDevices[i];
- int maxComputeUnits = device.getMaxComputeUnits();
- int maxClockFrequency = device.getMaxClockFrequency();
- int flops = maxComputeUnits*maxClockFrequency;
-
- if(flops > maxflops) {
- maxflops = flops;
- maxFLOPSDevice = device;
- }
- }
-
- return maxFLOPSDevice;
+ return CLPlatform.findMaxFlopsDevice(getCLDevices());
}
/**
diff --git a/src/com/mbien/opencl/CLPlatform.java b/src/com/mbien/opencl/CLPlatform.java
index 56ef3713..f1ecdd86 100644
--- a/src/com/mbien/opencl/CLPlatform.java
+++ b/src/com/mbien/opencl/CLPlatform.java
@@ -82,6 +82,38 @@ public final class CLPlatform {
}
+ static final CLDevice findMaxFlopsDevice(CLDevice[] devices) {
+
+ CLDevice maxFLOPSDevice = null;
+
+ int maxflops = -1;
+
+ for (int i = 0; i < devices.length; i++) {
+
+ CLDevice device = devices[i];
+ int maxComputeUnits = device.getMaxComputeUnits();
+ int maxClockFrequency = device.getMaxClockFrequency();
+ int flops = maxComputeUnits*maxClockFrequency;
+
+ if(flops > maxflops) {
+ maxflops = flops;
+ maxFLOPSDevice = device;
+ }
+ }
+
+ return maxFLOPSDevice;
+ }
+
+
+ /**
+ * Gets the device with maximal FLOPS from this platform.
+ * The device speed is estimated by calulating the product of
+ * MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.
+ */
+ public CLDevice getMaxFlopsDevice() {
+ return findMaxFlopsDevice(listCLDevices());
+ }
+
/**
* Returns the platform name.
*/
diff --git a/src/com/mbien/opencl/CLProgram.java b/src/com/mbien/opencl/CLProgram.java
index ff2919e8..da0a0447 100644
--- a/src/com/mbien/opencl/CLProgram.java
+++ b/src/com/mbien/opencl/CLProgram.java
@@ -210,8 +210,37 @@ public class CLProgram {
}
/**
- * Returns the build log for this program. The contents of the log are
- * implementation dependent log can be an empty String.
+ * Returns the build log of this program on all devices. The contents of the log are
+ * implementation dependent.
+ */
+ public String getBuildLog() {
+ StringBuilder sb = new StringBuilder();
+ CLDevice[] devices = getCLDevices();
+ for (int i = 0; i < devices.length; i++) {
+ CLDevice device = devices[i];
+ sb.append(device).append(" build log:");
+ sb.append(getBuildLog(device));
+ if(i != devices.length-1)
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns the build status enum of this program for each device as Map.
+ */
+ public Map<CLDevice,Status> getBuildStatus() {
+ Map<CLDevice,Status> statusMap = new HashMap<CLDevice, Status>();
+ CLDevice[] devices = getCLDevices();
+ for (CLDevice device : devices) {
+ statusMap.put(device, getBuildStatus(device));
+ }
+ return Collections.unmodifiableMap(statusMap);
+ }
+
+ /**
+ * Returns the build log for this program on the specified device. The contents
+ * of the log are implementation dependent log can be an empty String.
*/
public String getBuildLog(CLDevice device) {
return getBuildInfoString(device.ID, CL.CL_PROGRAM_BUILD_LOG);