aboutsummaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2014-02-23 18:23:57 -0600
committerWade Walker <[email protected]>2014-02-23 18:23:57 -0600
commit54ced2cf5d801470c106275291be17583e5e206d (patch)
tree3983673d769c898b515c46adf5f058af218b7710 /make/config
parent10f9ddfad21c8ab1d4287742d1b524ae11e916c8 (diff)
Fix OpenCL test failures on Solaris.
Since nobody currently makes an OpenCL driver for Solaris, all the tests used to fail, which told us nothing. This commit adds code to check whether OpenCL is unavailable and the OS is Solaris, in which case the test contents are skipped. If an OpenCL driver ever appears for Solaris, or if we start testing on another platform with no OpenCL driver, there's now one single place to add or remove checks that will allow for this.
Diffstat (limited to 'make/config')
-rw-r--r--make/config/cl-impl.cfg1
-rw-r--r--make/config/clImplCustomCode.java27
2 files changed, 15 insertions, 13 deletions
diff --git a/make/config/cl-impl.cfg b/make/config/cl-impl.cfg
index c2aff892..4beb22b3 100644
--- a/make/config/cl-impl.cfg
+++ b/make/config/cl-impl.cfg
@@ -3,7 +3,6 @@ Include cl-common.cfg
Style ImplOnly
#imports for all generated java files
-Import com.jogamp.opencl.llb.*
Import com.jogamp.opencl.llb.gl.CLGL
Import java.security.AccessController
Import java.security.PrivilegedAction
diff --git a/make/config/clImplCustomCode.java b/make/config/clImplCustomCode.java
index bee53425..6c407110 100644
--- a/make/config/clImplCustomCode.java
+++ b/make/config/clImplCustomCode.java
@@ -1,30 +1,33 @@
+ /** If null, OpenCL is not available on this machine. */
static final DynamicLibraryBundle dynamicLookupHelper;
protected static final CLProcAddressTable addressTable;
static {
- addressTable = new CLProcAddressTable();
- if(null==addressTable) {
- throw new RuntimeException("Couldn't instantiate ALProcAddressTable");
- }
-
- dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
+ addressTable = new CLProcAddressTable();
+ dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
public DynamicLibraryBundle run() {
- final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new CLDynamicLibraryBundleInfo());
- if(null==bundle) {
- throw new RuntimeException("Null CLDynamicLookupHelper");
- }
+ final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new CLDynamicLibraryBundleInfo());
if(!bundle.isToolLibLoaded()) {
- throw new RuntimeException("Couln't load native CL library");
+ // couldn't load native CL library
+ // TODO: log this?
+ return null;
}
if(!bundle.isLibComplete()) {
- throw new RuntimeException("Couln't load native CL/JNI glue library");
+ // couldn't load native CL/JNI glue library
+ // TODO: log this?
+ return null;
}
addressTable.reset(bundle);
return bundle;
} } );
}
+ /**
+ * Accessor.
+ * @returns true if OpenCL is available on this machine.
+ */
+ public static boolean isAvailable() { return dynamicLookupHelper != null; }
public static CLProcAddressTable getCLProcAddressTable() { return addressTable; }
static long clGetExtensionFunctionAddress(long clGetExtensionFunctionAddressHandle, java.lang.String procname)