aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:35:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:35:47 +0200
commita90ee128ce0550cd05f969d0283312c2f42b8254 (patch)
treedade644101970d8f69ea3845db310499f2b66a76 /src/com/jogamp/opencl/util
parenta0e0c8a39d0ef41ff6b64d9b40d058f21b786e81 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/com/jogamp/opencl/util')
-rw-r--r--src/com/jogamp/opencl/util/CLBuildConfiguration.java8
-rw-r--r--src/com/jogamp/opencl/util/CLBuildListener.java8
-rw-r--r--src/com/jogamp/opencl/util/CLDeviceFilters.java32
-rw-r--r--src/com/jogamp/opencl/util/CLInfo.java28
-rw-r--r--src/com/jogamp/opencl/util/CLMultiContext.java52
-rw-r--r--src/com/jogamp/opencl/util/CLPlatformFilters.java36
-rw-r--r--src/com/jogamp/opencl/util/CLProgramConfiguration.java8
-rw-r--r--src/com/jogamp/opencl/util/CLUtil.java68
-rw-r--r--src/com/jogamp/opencl/util/Filter.java8
-rw-r--r--src/com/jogamp/opencl/util/JOCLVersion.java6
-rw-r--r--src/com/jogamp/opencl/util/MultiQueueBarrier.java30
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java95
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLQueueContext.java6
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLQueueContextFactory.java8
14 files changed, 197 insertions, 196 deletions
diff --git a/src/com/jogamp/opencl/util/CLBuildConfiguration.java b/src/com/jogamp/opencl/util/CLBuildConfiguration.java
index 89f59110..2978c4ff 100644
--- a/src/com/jogamp/opencl/util/CLBuildConfiguration.java
+++ b/src/com/jogamp/opencl/util/CLBuildConfiguration.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
diff --git a/src/com/jogamp/opencl/util/CLBuildListener.java b/src/com/jogamp/opencl/util/CLBuildListener.java
index d21109f9..09f7fc9b 100644
--- a/src/com/jogamp/opencl/util/CLBuildListener.java
+++ b/src/com/jogamp/opencl/util/CLBuildListener.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
diff --git a/src/com/jogamp/opencl/util/CLDeviceFilters.java b/src/com/jogamp/opencl/util/CLDeviceFilters.java
index 6281b844..f055ba1e 100644
--- a/src/com/jogamp/opencl/util/CLDeviceFilters.java
+++ b/src/com/jogamp/opencl/util/CLDeviceFilters.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -38,18 +38,18 @@ import java.util.List;
/**
* Pre-defined filters.
* @author Michael Bien
- * @see com.jogamp.opencl.CLPlatform#listCLDevices(com.jogamp.opencl.util.Filter[])
+ * @see com.jogamp.opencl.CLPlatform#listCLDevices(com.jogamp.opencl.util.Filter[])
* @see com.jogamp.opencl.CLPlatform#getMaxFlopsDevice(com.jogamp.opencl.util.Filter[])
*/
public class CLDeviceFilters {
-
+
/**
* Accepts all devices of the given type.
*/
public static Filter<CLDevice> type(final CLDevice.Type... types) {
return new Filter<CLDevice>() {
private final EnumSet<CLDevice.Type> set = EnumSet.copyOf(Arrays.asList(types));
- public boolean accept(CLDevice item) {
+ public boolean accept(final CLDevice item) {
if(set.contains(CLDevice.Type.ALL)) {
return true;
}
@@ -57,51 +57,51 @@ public class CLDeviceFilters {
}
};
}
-
+
/**
* Accepts all devices of the given {@link ByteOrder}.
*/
public static Filter<CLDevice> byteOrder(final ByteOrder order) {
return new Filter<CLDevice>() {
- public boolean accept(CLDevice item) {
+ public boolean accept(final CLDevice item) {
return item.getByteOrder().equals(order);
}
};
}
-
+
/**
* Accepts all devices which support OpenGL-OpenCL interoperability.
*/
public static Filter<CLDevice> glSharing() {
return new Filter<CLDevice>() {
- public boolean accept(CLDevice item) {
+ public boolean accept(final CLDevice item) {
return item.isGLMemorySharingSupported();
}
};
}
-
+
/**
* Accepts all devices supporting the given extensions.
*/
public static Filter<CLDevice> extension(final String... extensions) {
return new Filter<CLDevice>() {
private final List<String> extensionList = Arrays.asList(extensions);
- public boolean accept(CLDevice item) {
+ public boolean accept(final CLDevice item) {
return item.getExtensions().containsAll(extensionList);
}
};
}
-
+
/**
* Accepts all devices supporting the specified command queue modes.
*/
public static Filter<CLDevice> queueMode(final Mode... modes) {
return new Filter<CLDevice>() {
private final List<Mode> modeList = Arrays.asList(modes);
- public boolean accept(CLDevice item) {
+ public boolean accept(final CLDevice item) {
return item.getQueueProperties().containsAll(modeList);
}
};
}
-
+
}
diff --git a/src/com/jogamp/opencl/util/CLInfo.java b/src/com/jogamp/opencl/util/CLInfo.java
index 4d2ab08b..2dfbb5e9 100644
--- a/src/com/jogamp/opencl/util/CLInfo.java
+++ b/src/com/jogamp/opencl/util/CLInfo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -44,7 +44,7 @@ import java.util.Map;
*/
public class CLInfo {
- public static StringBuilder print(StringBuilder sb) {
+ public static StringBuilder print(final StringBuilder sb) {
// host
sb.append("HOST_JRE: ").append(System.getProperty("java.runtime.version")).append("\n");
@@ -62,16 +62,16 @@ public class CLInfo {
sb.append("\n");
// OpenCL
- CLPlatform[] platforms = CLPlatform.listCLPlatforms();
+ final CLPlatform[] platforms = CLPlatform.listCLPlatforms();
- for (CLPlatform platform : platforms) {
- Map<String, String> platformProperties = platform.getProperties();
+ for (final CLPlatform platform : platforms) {
+ final Map<String, String> platformProperties = platform.getProperties();
sb.append("\n");
printInfo(sb, "", platformProperties);
- CLDevice[] devices = platform.listCLDevices();
- for (CLDevice device : devices) {
- Map<String, String> deviceProperties = device.getProperties();
+ final CLDevice[] devices = platform.listCLDevices();
+ for (final CLDevice device : devices) {
+ final Map<String, String> deviceProperties = device.getProperties();
sb.append("\n");
printInfo(sb, " - ", deviceProperties);
}
@@ -81,13 +81,13 @@ public class CLInfo {
}
- private static void printInfo(StringBuilder sb, String prefix, Map<String, String> properties) {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
+ private static void printInfo(final StringBuilder sb, final String prefix, final Map<String, String> properties) {
+ for (final Map.Entry<String, String> entry : properties.entrySet()) {
sb.append(prefix).append(entry.getKey()).append(": ").append(entry.getValue()).append(Platform.getNewline());
}
}
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
System.out.println(print(new StringBuilder()).toString());
}
}
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java
index c5bed86b..c5624bb4 100644
--- a/src/com/jogamp/opencl/util/CLMultiContext.java
+++ b/src/com/jogamp/opencl/util/CLMultiContext.java
@@ -34,7 +34,7 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with all devices of the specified platforms.
*/
- public static CLMultiContext create(CLPlatform... platforms) {
+ public static CLMultiContext create(final CLPlatform... platforms) {
return create(platforms, ALL);
}
@@ -42,7 +42,7 @@ public class CLMultiContext implements CLResource {
* Creates a multi context with all devices of the specified platforms and types.
*/
@SuppressWarnings("unchecked")
- public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) {
+ public static CLMultiContext create(final CLPlatform[] platforms, final CLDevice.Type... types) {
return create(platforms, CLDeviceFilters.type(types));
}
@@ -50,7 +50,7 @@ public class CLMultiContext implements CLResource {
* Creates a multi context with all matching devices of the specified platforms.
*/
@SuppressWarnings("unchecked")
- public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) {
+ public static CLMultiContext create(final CLPlatform[] platforms, final Filter<CLDevice>... filters) {
if(platforms == null) {
throw new NullPointerException("platform list was null");
@@ -58,8 +58,8 @@ public class CLMultiContext implements CLResource {
throw new IllegalArgumentException("platform list was empty");
}
- List<CLDevice> devices = new ArrayList<CLDevice>();
- for (CLPlatform platform : platforms) {
+ final List<CLDevice> devices = new ArrayList<CLDevice>();
+ for (final CLPlatform platform : platforms) {
devices.addAll(asList(platform.listCLDevices(filters)));
}
return create(devices);
@@ -69,21 +69,21 @@ public class CLMultiContext implements CLResource {
* Creates a multi context with the specified devices.
* The devices don't have to be from the same platform.
*/
- public static CLMultiContext create(Collection<CLDevice> devices) {
+ public static CLMultiContext create(final Collection<CLDevice> devices) {
if(devices.isEmpty()) {
throw new IllegalArgumentException("device list was empty");
}
- Map<CLPlatform, List<CLDevice>> platformDevicesMap = filterPlatformConflicts(devices);
+ final Map<CLPlatform, List<CLDevice>> platformDevicesMap = filterPlatformConflicts(devices);
// create contexts
- CLMultiContext mc = new CLMultiContext();
- for (Map.Entry<CLPlatform, List<CLDevice>> entry : platformDevicesMap.entrySet()) {
- List<CLDevice> list = entry.getValue();
+ final CLMultiContext mc = new CLMultiContext();
+ for (final Map.Entry<CLPlatform, List<CLDevice>> entry : platformDevicesMap.entrySet()) {
+ final List<CLDevice> list = entry.getValue();
// one context per device to workaround driver bugs
- for (CLDevice device : list) {
- CLContext context = CLContext.create(device);
+ for (final CLDevice device : list) {
+ final CLContext context = CLContext.create(device);
mc.contexts.add(context);
}
}
@@ -94,8 +94,8 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with specified contexts.
*/
- public static CLMultiContext wrap(CLContext... contexts) {
- CLMultiContext mc = new CLMultiContext();
+ public static CLMultiContext wrap(final CLContext... contexts) {
+ final CLMultiContext mc = new CLMultiContext();
mc.contexts.addAll(asList(contexts));
return mc;
}
@@ -104,19 +104,19 @@ public class CLMultiContext implements CLResource {
* filter devices; don't allow the same device to be used in more than one platform.
* example: a CPU available via the AMD and Intel SDKs shouldn't end up in two contexts
*/
- private static Map<CLPlatform, List<CLDevice>> filterPlatformConflicts(Collection<CLDevice> devices) {
+ private static Map<CLPlatform, List<CLDevice>> filterPlatformConflicts(final Collection<CLDevice> devices) {
// FIXME: devicename-platform is used as unique device identifier - replace if we have something better
-
- Map<CLPlatform, List<CLDevice>> filtered = new HashMap<CLPlatform, List<CLDevice>>();
- Map<String, CLPlatform> used = new HashMap<String, CLPlatform>();
- for (CLDevice device : devices) {
+ final Map<CLPlatform, List<CLDevice>> filtered = new HashMap<CLPlatform, List<CLDevice>>();
+ final Map<String, CLPlatform> used = new HashMap<String, CLPlatform>();
- String name = device.getName();
+ for (final CLDevice device : devices) {
- CLPlatform platform = device.getPlatform();
- CLPlatform usedPlatform = used.get(name);
+ final String name = device.getName();
+
+ final CLPlatform platform = device.getPlatform();
+ final CLPlatform usedPlatform = used.get(name);
if(usedPlatform == null || platform.equals(usedPlatform)) {
if(!filtered.containsKey(platform)) {
@@ -125,7 +125,7 @@ public class CLMultiContext implements CLResource {
filtered.get(platform).add(device);
used.put(name, platform);
}
-
+
}
return filtered;
}
@@ -141,7 +141,7 @@ public class CLMultiContext implements CLResource {
throw new RuntimeException(getClass().getSimpleName()+" already released");
}
released = true;
- for (CLContext context : contexts) {
+ for (final CLContext context : contexts) {
context.release();
}
contexts.clear();
@@ -155,8 +155,8 @@ public class CLMultiContext implements CLResource {
* Returns a list containing all devices used in this multi context.
*/
public List<CLDevice> getDevices() {
- List<CLDevice> devices = new ArrayList<CLDevice>();
- for (CLContext context : contexts) {
+ final List<CLDevice> devices = new ArrayList<CLDevice>();
+ for (final CLContext context : contexts) {
devices.addAll(asList(context.getDevices()));
}
return devices;
diff --git a/src/com/jogamp/opencl/util/CLPlatformFilters.java b/src/com/jogamp/opencl/util/CLPlatformFilters.java
index 451c6b1f..8c22306a 100644
--- a/src/com/jogamp/opencl/util/CLPlatformFilters.java
+++ b/src/com/jogamp/opencl/util/CLPlatformFilters.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -40,7 +40,7 @@ import javax.media.opengl.GLContext;
* Pre-defined filters.
* @author Michael Bien
* @see CLPlatform#getDefault(com.jogamp.opencl.util.Filter[])
- * @see CLPlatform#listCLPlatforms(com.jogamp.opencl.util.Filter[])
+ * @see CLPlatform#listCLPlatforms(com.jogamp.opencl.util.Filter[])
*/
public class CLPlatformFilters {
@@ -49,7 +49,7 @@ public class CLPlatformFilters {
*/
public static Filter<CLPlatform> version(final CLVersion version) {
return new Filter<CLPlatform>() {
- public boolean accept(CLPlatform item) {
+ public boolean accept(final CLPlatform item) {
return item.isAtLeast(version);
}
};
@@ -60,21 +60,21 @@ public class CLPlatformFilters {
*/
public static Filter<CLPlatform> type(final CLDevice.Type type) {
return new Filter<CLPlatform>() {
- public boolean accept(CLPlatform item) {
+ public boolean accept(final CLPlatform item) {
return item.listCLDevices(type).length > 0;
}
};
}
-
+
/**
* Accepts all platforms containing at least one devices of which supports OpenGL-OpenCL interoperability.
*/
public static Filter<CLPlatform> glSharing() {
return new Filter<CLPlatform>() {
private final Filter<CLDevice> glFilter = CLDeviceFilters.glSharing();
- public boolean accept(CLPlatform item) {
- CLDevice[] devices = item.listCLDevices();
- for (CLDevice device : devices) {
+ public boolean accept(final CLPlatform item) {
+ final CLDevice[] devices = item.listCLDevices();
+ for (final CLDevice device : devices) {
if(glFilter.accept(device)) {
return true;
}
@@ -91,14 +91,14 @@ public class CLPlatformFilters {
public static Filter<CLPlatform> glSharing(final GLContext context) {
return new Filter<CLPlatform>() {
private final Filter<CLPlatform> glFilter = glSharing();
- public boolean accept(CLPlatform item) {
- String glVendor = context.getGL().glGetString(GL.GL_VENDOR);
- String clVendor = item.getVendor();
+ public boolean accept(final CLPlatform item) {
+ final String glVendor = context.getGL().glGetString(GL.GL_VENDOR);
+ final String clVendor = item.getVendor();
return areVendorsCompatible(glVendor,clVendor) && glFilter.accept(item);
}
};
}
-
+
/**
* We need this test because:
* - On at least some AMD cards, the GL vendor is ATI, but the CL vendor is AMD.
@@ -118,7 +118,7 @@ public class CLPlatformFilters {
*/
public static Filter<CLPlatform> extension(final String... extensions) {
return new Filter<CLPlatform>() {
- public boolean accept(CLPlatform item) {
+ public boolean accept(final CLPlatform item) {
return item.getExtensions().containsAll(Arrays.asList(extensions));
}
};
@@ -130,8 +130,8 @@ public class CLPlatformFilters {
public static Filter<CLPlatform> queueMode(final Mode... modes) {
return new Filter<CLPlatform>() {
private final Filter<CLDevice> queueModeFilter = CLDeviceFilters.queueMode(modes);
- public boolean accept(CLPlatform item) {
- for (CLDevice device : item.listCLDevices()) {
+ public boolean accept(final CLPlatform item) {
+ for (final CLDevice device : item.listCLDevices()) {
if(queueModeFilter.accept(device)) {
return true;
}
diff --git a/src/com/jogamp/opencl/util/CLProgramConfiguration.java b/src/com/jogamp/opencl/util/CLProgramConfiguration.java
index 3d460503..5b93a4de 100644
--- a/src/com/jogamp/opencl/util/CLProgramConfiguration.java
+++ b/src/com/jogamp/opencl/util/CLProgramConfiguration.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
diff --git a/src/com/jogamp/opencl/util/CLUtil.java b/src/com/jogamp/opencl/util/CLUtil.java
index 98a6cd7e..bcab6767 100644
--- a/src/com/jogamp/opencl/util/CLUtil.java
+++ b/src/com/jogamp/opencl/util/CLUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -48,7 +48,7 @@ import java.util.Map;
*/
public class CLUtil {
- public static String clString2JavaString(byte[] chars, int clLength) {
+ public static String clString2JavaString(final byte[] chars, int clLength) {
// certain char queries on windows always claim to have a fixed length
// e.g. (clDeviceInfo(CL_DEVICE_NAME) is always 64.. but luckily they are 0 terminated)
@@ -57,11 +57,11 @@ public class CLUtil {
return clLength==0 ? "" : new String(chars, 0, clLength+1);
}
- public static String clString2JavaString(ByteBuffer chars, int clLength) {
+ public static String clString2JavaString(final ByteBuffer chars, final int clLength) {
if (clLength==0) {
return "";
}else{
- byte[] array = new byte[clLength];
+ final byte[] array = new byte[clLength];
chars.get(array).rewind();
return clString2JavaString(array, clLength);
}
@@ -70,48 +70,48 @@ public class CLUtil {
/**
* Returns true if clBoolean == CL.CL_TRUE.
*/
- public static boolean clBoolean(int clBoolean) {
+ public static boolean clBoolean(final int clBoolean) {
return clBoolean == CL.CL_TRUE;
}
/**
* Returns b ? CL.CL_TRUE : CL.CL_FALSE
*/
- public static int clBoolean(boolean b) {
+ public static int clBoolean(final boolean b) {
return b ? CL.CL_TRUE : CL.CL_FALSE;
}
/**
* Reads all platform properties and returns them as key-value map.
*/
- public static Map<String, String> obtainPlatformProperties(CLPlatform platform) {
+ public static Map<String, String> obtainPlatformProperties(final CLPlatform platform) {
return readCLProperties(platform);
}
/**
* Reads all device properties and returns them as key-value map.
*/
- public static Map<String, String> obtainDeviceProperties(CLDevice dev) {
+ public static Map<String, String> obtainDeviceProperties(final CLDevice dev) {
return readCLProperties(dev);
}
- private static Map<String, String> readCLProperties(Object obj) {
+ private static Map<String, String> readCLProperties(final Object obj) {
try {
return invoke(listMethods(obj.getClass()), obj);
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
throw new JogampRuntimeException(ex);
- } catch (IllegalAccessException ex) {
+ } catch (final IllegalAccessException ex) {
throw new JogampRuntimeException(ex);
}
}
- static Map<String, String> invoke(List<Method> methods, Object obj) throws IllegalArgumentException, IllegalAccessException {
- Map<String, String> map = new LinkedHashMap<String, String>();
- for (Method method : methods) {
+ static Map<String, String> invoke(final List<Method> methods, final Object obj) throws IllegalArgumentException, IllegalAccessException {
+ final Map<String, String> map = new LinkedHashMap<String, String>();
+ for (final Method method : methods) {
Object info = null;
try {
info = method.invoke(obj);
- } catch (InvocationTargetException ex) {
+ } catch (final InvocationTargetException ex) {
info = ex.getTargetException();
}
@@ -119,17 +119,17 @@ public class CLUtil {
info = asList(info);
}
- String value = method.getAnnotation(CLProperty.class).value();
+ final String value = method.getAnnotation(CLProperty.class).value();
map.put(value, info.toString());
}
return map;
}
- static List<Method> listMethods(Class<?> clazz) throws SecurityException {
- List<Method> list = new ArrayList<Method>();
- for (Method method : clazz.getDeclaredMethods()) {
- Annotation[] annotations = method.getDeclaredAnnotations();
- for (Annotation annotation : annotations) {
+ static List<Method> listMethods(final Class<?> clazz) throws SecurityException {
+ final List<Method> list = new ArrayList<Method>();
+ for (final Method method : clazz.getDeclaredMethods()) {
+ final Annotation[] annotations = method.getDeclaredAnnotations();
+ for (final Annotation annotation : annotations) {
if (annotation instanceof CLProperty) {
list.add(method);
}
@@ -138,26 +138,26 @@ public class CLUtil {
return list;
}
- private static List<Number> asList(Object info) {
- List<Number> list = new ArrayList<Number>();
+ private static List<Number> asList(final Object info) {
+ final List<Number> list = new ArrayList<Number>();
if(info instanceof int[]) {
- int[] array = (int[]) info;
- for (int i : array) {
+ final int[] array = (int[]) info;
+ for (final int i : array) {
list.add(i);
}
}else if(info instanceof long[]) {
- long[] array = (long[]) info;
- for (long i : array) {
+ final long[] array = (long[]) info;
+ for (final long i : array) {
list.add(i);
}
}else if(info instanceof float[]) {
- float[] array = (float[]) info;
- for (float i : array) {
+ final float[] array = (float[]) info;
+ for (final float i : array) {
list.add(i);
}
}else if(info instanceof double[]) {
- double[] array = (double[]) info;
- for (double i : array) {
+ final double[] array = (double[]) info;
+ for (final double i : array) {
list.add(i);
}
}
diff --git a/src/com/jogamp/opencl/util/Filter.java b/src/com/jogamp/opencl/util/Filter.java
index b8a11faf..f950954e 100644
--- a/src/com/jogamp/opencl/util/Filter.java
+++ b/src/com/jogamp/opencl/util/Filter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java
index 7b837486..cc1edebc 100644
--- a/src/com/jogamp/opencl/util/JOCLVersion.java
+++ b/src/com/jogamp/opencl/util/JOCLVersion.java
@@ -53,7 +53,7 @@ public class JOCLVersion extends JogampVersion {
private static final String PACKAGE = "com.jogamp.opencl";
- private JOCLVersion(Manifest mf) {
+ private JOCLVersion(final Manifest mf) {
super(PACKAGE, mf);
}
@@ -84,7 +84,7 @@ public class JOCLVersion extends JogampVersion {
sb.append(Platform.getNewline());
createInstance().toString(sb);
sb.append(Platform.getNewline());
- }catch(Exception e) {
+ }catch(final Exception e) {
sb.append(e.getMessage());
e.printStackTrace();
}
@@ -92,7 +92,7 @@ public class JOCLVersion extends JogampVersion {
return sb.toString();
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
System.out.println(JOCLVersion.getAllVersions());
}
}
diff --git a/src/com/jogamp/opencl/util/MultiQueueBarrier.java b/src/com/jogamp/opencl/util/MultiQueueBarrier.java
index 9f8a461c..f1692f2e 100644
--- a/src/com/jogamp/opencl/util/MultiQueueBarrier.java
+++ b/src/com/jogamp/opencl/util/MultiQueueBarrier.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -52,7 +52,7 @@ public class MultiQueueBarrier {
* It is recommented to use {@link #MultiQueueBarrier(CLCommandQueue... allowedQueues)} if possible
* which restricts the set of allowed queues for the barrier.
*/
- public MultiQueueBarrier(int queueCount) {
+ public MultiQueueBarrier(final int queueCount) {
if(queueCount == 0) {
throw new IllegalArgumentException("queueCount was 0");
}
@@ -64,15 +64,15 @@ public class MultiQueueBarrier {
/**
* Creates a new MultiQueueBarrier for the given queues.
*/
- public MultiQueueBarrier(CLCommandQueue... allowedQueues) {
+ public MultiQueueBarrier(final CLCommandQueue... allowedQueues) {
if(allowedQueues.length == 0) {
throw new IllegalArgumentException("allowedQueues was empty");
}
this.latch = new CountDownLatch(allowedQueues.length);
this.count = allowedQueues.length;
- HashSet<CLCommandQueue> set = new HashSet<CLCommandQueue>(allowedQueues.length);
- for (CLCommandQueue queue : allowedQueues) {
+ final HashSet<CLCommandQueue> set = new HashSet<CLCommandQueue>(allowedQueues.length);
+ for (final CLCommandQueue queue : allowedQueues) {
set.add(queue);
}
this.queues = Collections.unmodifiableSet(set);
@@ -83,7 +83,7 @@ public class MultiQueueBarrier {
* This method may be invoked concurrently without synchronization on the MultiQueueBarrier object
* as long each Thread passes a distinct CLCommandQueue as parameter to this method.
*/
- public MultiQueueBarrier waitFor(CLCommandQueue queue) {
+ public MultiQueueBarrier waitFor(final CLCommandQueue queue) {
checkQueue(queue);
queue.putBarrier();
@@ -98,7 +98,7 @@ public class MultiQueueBarrier {
* This method may be invoked concurrently without synchronization on the MultiQueueBarrier object
* as long each Thread passes a distinct CLCommandQueue as parameter to this method.
*/
- public MultiQueueBarrier waitFor(CLCommandQueue queue, CLEventList events) {
+ public MultiQueueBarrier waitFor(final CLCommandQueue queue, final CLEventList events) {
checkQueue(queue);
queue.putWaitForEvents(events, true);
@@ -118,18 +118,18 @@ public class MultiQueueBarrier {
rebuildBarrierIfBroken();
return this;
}
-
+
/**
* @see #await()
* @param timeout the maximum time to wait
* @param unit the time unit of the {@code timeout} argument
*/
- public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
- boolean ret = latch.await(timeout, unit);
+ public boolean await(final long timeout, final TimeUnit unit) throws InterruptedException {
+ final boolean ret = latch.await(timeout, unit);
rebuildBarrierIfBroken();
return ret;
}
-
+
/**
* Resets this barrier and unblocks all waiting threads.
*/
@@ -160,7 +160,7 @@ public class MultiQueueBarrier {
return latch.getCount();
}
- private void checkQueue(CLCommandQueue queue) throws IllegalArgumentException {
+ private void checkQueue(final CLCommandQueue queue) throws IllegalArgumentException {
if (queues != null && !queues.contains(queue)) {
throw new IllegalArgumentException(queue + " is not in the allowedQueues Set: " + queues);
}
diff --git a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
index a1d376ab..dcd052cf 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
@@ -31,23 +31,23 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private FinishAction finishAction = FinishAction.DO_NOTHING;
private boolean released;
- private CLCommandQueuePool(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
+ private CLCommandQueuePool(final CLQueueContextFactory<C> factory, final Collection<CLCommandQueue> queues) {
this.contexts = initContexts(queues, factory);
initExecutor();
}
- private List<CLQueueContext> initContexts(Collection<CLCommandQueue> queues, CLQueueContextFactory<C> factory) {
- List<CLQueueContext> newContexts = new ArrayList<CLQueueContext>(queues.size());
-
+ private List<CLQueueContext> initContexts(final Collection<CLCommandQueue> queues, final CLQueueContextFactory<C> factory) {
+ final List<CLQueueContext> newContexts = new ArrayList<CLQueueContext>(queues.size());
+
int index = 0;
- for (CLCommandQueue queue : queues) {
-
+ for (final CLCommandQueue queue : queues) {
+
CLQueueContext old = null;
if(this.contexts != null && !this.contexts.isEmpty()) {
old = this.contexts.get(index++);
old.release();
}
-
+
newContexts.add(factory.setup(queue, old));
}
return newContexts;
@@ -57,19 +57,19 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
this.excecutor = Executors.newFixedThreadPool(contexts.size(), new QueueThreadFactory(contexts));
}
- public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory, CLMultiContext mc, CLCommandQueue.Mode... modes) {
+ public static <C extends CLQueueContext> CLCommandQueuePool<C> create(final CLQueueContextFactory<C> factory, final CLMultiContext mc, final CLCommandQueue.Mode... modes) {
return create(factory, mc.getDevices(), modes);
}
- public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory, Collection<CLDevice> devices, CLCommandQueue.Mode... modes) {
- List<CLCommandQueue> queues = new ArrayList<CLCommandQueue>(devices.size());
- for (CLDevice device : devices) {
+ public static <C extends CLQueueContext> CLCommandQueuePool<C> create(final CLQueueContextFactory<C> factory, final Collection<CLDevice> devices, final CLCommandQueue.Mode... modes) {
+ final List<CLCommandQueue> queues = new ArrayList<CLCommandQueue>(devices.size());
+ for (final CLDevice device : devices) {
queues.add(device.createCommandQueue(modes));
}
return create(factory, queues);
}
- public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
+ public static <C extends CLQueueContext> CLCommandQueuePool<C> create(final CLQueueContextFactory<C> factory, final Collection<CLCommandQueue> queues) {
return new CLCommandQueuePool<C>(factory, queues);
}
@@ -77,7 +77,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Submits this task to the pool for execution returning its {@link Future}.
* @see ExecutorService#submit(java.util.concurrent.Callable)
*/
- public <R> Future<R> submit(CLTask<? super C, R> task) {
+ public <R> Future<R> submit(final CLTask<? super C, R> task) {
return excecutor.submit(new TaskWrapper<C,R>(task, finishAction));
}
@@ -85,9 +85,9 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Submits all tasks to the pool for execution and returns their {@link Future}.
* Calls {@link #submit(com.jogamp.opencl.util.concurrent.CLTask)} for every task.
*/
- public <R> List<Future<R>> submitAll(Collection<? extends CLTask<? super C, R>> tasks) {
- List<Future<R>> futures = new ArrayList<Future<R>>(tasks.size());
- for (CLTask<? super C, R> task : tasks) {
+ public <R> List<Future<R>> submitAll(final Collection<? extends CLTask<? super C, R>> tasks) {
+ final List<Future<R>> futures = new ArrayList<Future<R>>(tasks.size());
+ for (final CLTask<? super C, R> task : tasks) {
futures.add(submit(task));
}
return futures;
@@ -95,10 +95,10 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
/**
* Submits all tasks to the pool for immediate execution (blocking) and returns their {@link Future} holding the result.
- * @see ExecutorService#invokeAll(java.util.Collection)
+ * @see ExecutorService#invokeAll(java.util.Collection)
*/
- public <R> List<Future<R>> invokeAll(Collection<? extends CLTask<? super C, R>> tasks) throws InterruptedException {
- List<TaskWrapper<C, R>> wrapper = wrapTasks(tasks);
+ public <R> List<Future<R>> invokeAll(final Collection<? extends CLTask<? super C, R>> tasks) throws InterruptedException {
+ final List<TaskWrapper<C, R>> wrapper = wrapTasks(tasks);
return excecutor.invokeAll(wrapper);
}
@@ -106,14 +106,14 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Submits all tasks to the pool for immediate execution (blocking) and returns their {@link Future} holding the result.
* @see ExecutorService#invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit)
*/
- public <R> List<Future<R>> invokeAll(Collection<? extends CLTask<? super C, R>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
- List<TaskWrapper<C, R>> wrapper = wrapTasks(tasks);
+ public <R> List<Future<R>> invokeAll(final Collection<? extends CLTask<? super C, R>> tasks, final long timeout, final TimeUnit unit) throws InterruptedException {
+ final List<TaskWrapper<C, R>> wrapper = wrapTasks(tasks);
return excecutor.invokeAll(wrapper, timeout, unit);
}
- private <R> List<TaskWrapper<C, R>> wrapTasks(Collection<? extends CLTask<? super C, R>> tasks) {
- List<TaskWrapper<C, R>> wrapper = new ArrayList<TaskWrapper<C, R>>(tasks.size());
- for (CLTask<? super C, R> task : tasks) {
+ private <R> List<TaskWrapper<C, R>> wrapTasks(final Collection<? extends CLTask<? super C, R>> tasks) {
+ final List<TaskWrapper<C, R>> wrapper = new ArrayList<TaskWrapper<C, R>>(tasks.size());
+ for (final CLTask<? super C, R> task : tasks) {
if(task == null) {
throw new NullPointerException("at least one task was null");
}
@@ -121,17 +121,17 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
}
return wrapper;
}
-
+
/**
* Switches the context of all queues - this operation can be expensive.
* Blocks until all tasks finish and sets up a new context for all queues.
* @return this
*/
- public CLCommandQueuePool<C> switchContext(CLQueueContextFactory<C> factory) {
-
+ public CLCommandQueuePool<C> switchContext(final CLQueueContextFactory<C> factory) {
+
excecutor.shutdown();
finishQueues(); // just to be sure
-
+
contexts = initContexts(getQueues(), factory);
initExecutor();
return this;
@@ -141,7 +141,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Calls {@link CLCommandQueue#flush()} on all queues.
*/
public void flushQueues() {
- for (CLQueueContext context : contexts) {
+ for (final CLQueueContext context : contexts) {
context.queue.flush();
}
}
@@ -150,7 +150,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Calls {@link CLCommandQueue#finish()} on all queues.
*/
public void finishQueues() {
- for (CLQueueContext context : contexts) {
+ for (final CLQueueContext context : contexts) {
context.queue.finish();
}
}
@@ -165,7 +165,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
}
released = true;
excecutor.shutdown();
- for (CLQueueContext context : contexts) {
+ for (final CLQueueContext context : contexts) {
context.queue.finish().release();
context.release();
}
@@ -175,8 +175,8 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Returns the command queues used in this pool.
*/
public List<CLCommandQueue> getQueues() {
- List<CLCommandQueue> queues = new ArrayList<CLCommandQueue>(contexts.size());
- for (CLQueueContext context : contexts) {
+ final List<CLCommandQueue> queues = new ArrayList<CLCommandQueue>(contexts.size());
+ for (final CLQueueContext context : contexts) {
queues.add(context.queue);
}
return queues;
@@ -202,7 +202,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Sets the action which is run after every completed task.
* This is mainly intended for debugging, default value is {@link FinishAction#DO_NOTHING}.
*/
- public void setFinishAction(FinishAction action) {
+ public void setFinishAction(final FinishAction action) {
this.finishAction = action;
}
@@ -216,28 +216,28 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private final List<CLQueueContext> context;
private int index;
- private QueueThreadFactory(List<CLQueueContext> queues) {
+ private QueueThreadFactory(final List<CLQueueContext> queues) {
this.context = queues;
this.index = 0;
}
- public synchronized Thread newThread(Runnable runnable) {
+ public synchronized Thread newThread(final Runnable runnable) {
- SecurityManager sm = System.getSecurityManager();
- ThreadGroup group = (sm != null) ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup();
+ final SecurityManager sm = System.getSecurityManager();
+ final ThreadGroup group = (sm != null) ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup();
- CLQueueContext queue = context.get(index);
- QueueThread thread = new QueueThread(group, runnable, queue, index++);
+ final CLQueueContext queue = context.get(index);
+ final QueueThread thread = new QueueThread(group, runnable, queue, index++);
thread.setDaemon(true);
-
+
return thread;
}
}
-
+
private static class QueueThread extends Thread {
private final CLQueueContext context;
- public QueueThread(ThreadGroup group, Runnable runnable, CLQueueContext context, int index) {
+ public QueueThread(final ThreadGroup group, final Runnable runnable, final CLQueueContext context, final int index) {
super(group, runnable, "queue-worker-thread-"+index+"["+context+"]");
this.context = context;
}
@@ -247,17 +247,18 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private final CLTask<? super C, R> task;
private final FinishAction mode;
-
- public TaskWrapper(CLTask<? super C, R> task, FinishAction mode) {
+
+ public TaskWrapper(final CLTask<? super C, R> task, final FinishAction mode) {
this.task = task;
this.mode = mode;
}
public R call() throws Exception {
- CLQueueContext context = ((QueueThread)Thread.currentThread()).context;
+ final CLQueueContext context = ((QueueThread)Thread.currentThread()).context;
// we make sure to only wrap tasks on the correct kind of thread, so this
// shouldn't fail (trying to genericize QueueThread properly becomes tricky)
@SuppressWarnings("unchecked")
+ final
R result = task.execute((C)context);
if(mode.equals(FinishAction.FLUSH)) {
context.queue.flush();
@@ -284,7 +285,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Flushes the queue on task completion.
*/
FLUSH,
-
+
/**
* Finishes the queue on task completion.
*/
diff --git a/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java b/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
index 9f92b9a3..a9d3766a 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
@@ -24,7 +24,7 @@ public abstract class CLQueueContext implements CLResource {
public final CLCommandQueue queue;
- public CLQueueContext(CLCommandQueue queue) {
+ public CLQueueContext(final CLCommandQueue queue) {
this.queue = queue;
}
@@ -45,7 +45,7 @@ public abstract class CLQueueContext implements CLResource {
public final CLProgram program;
public final Map<String, CLKernel> kernels;
- public CLSimpleQueueContext(CLCommandQueue queue, CLProgram program) {
+ public CLSimpleQueueContext(final CLCommandQueue queue, final CLProgram program) {
super(queue);
this.program = program;
this.kernels = program.createCLKernels();
@@ -55,7 +55,7 @@ public abstract class CLQueueContext implements CLResource {
return kernels;
}
- public CLKernel getKernel(String name) {
+ public CLKernel getKernel(final String name) {
return kernels.get(name);
}
diff --git a/src/com/jogamp/opencl/util/concurrent/CLQueueContextFactory.java b/src/com/jogamp/opencl/util/concurrent/CLQueueContextFactory.java
index 58f389bf..3be33f91 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLQueueContextFactory.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLQueueContextFactory.java
@@ -24,7 +24,7 @@ public abstract class CLQueueContextFactory<C extends CLQueueContext> {
* Creates a simple context factory producing single program contexts.
* @param source sourcecode of a OpenCL program.
*/
- public static CLSimpleContextFactory createSimple(String source) {
+ public static CLSimpleContextFactory createSimple(final String source) {
return new CLSimpleContextFactory(source);
}
@@ -36,13 +36,13 @@ public abstract class CLQueueContextFactory<C extends CLQueueContext> {
private final String source;
- public CLSimpleContextFactory(String source) {
+ public CLSimpleContextFactory(final String source) {
this.source = source;
}
@Override
- public CLSimpleQueueContext setup(CLCommandQueue queue, CLQueueContext old) {
- CLProgram program = queue.getContext().createProgram(source).build(queue.getDevice());
+ public CLSimpleQueueContext setup(final CLCommandQueue queue, final CLQueueContext old) {
+ final CLProgram program = queue.getContext().createProgram(source).build(queue.getDevice());
return new CLSimpleQueueContext(queue, program);
}