summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLPlatform.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-11-02 02:18:21 +0100
committerMichael Bien <[email protected]>2009-11-02 02:18:21 +0100
commitb2dfcb34a4cdc9c45d5ce20a2b1559b4bf3ebb8c (patch)
tree1245bfc07fdf03618a7d867c46e49e0762ccb967 /src/com/mbien/opencl/CLPlatform.java
parent1690ead6c21b61bd337706b836c04164940eed69 (diff)
refactoring and more utility methods.
Diffstat (limited to 'src/com/mbien/opencl/CLPlatform.java')
-rw-r--r--src/com/mbien/opencl/CLPlatform.java32
1 files changed, 32 insertions, 0 deletions
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.
*/