diff options
author | Wade Walker <[email protected]> | 2014-02-24 19:43:43 -0600 |
---|---|---|
committer | Wade Walker <[email protected]> | 2014-02-24 19:43:43 -0600 |
commit | 6ec10ee5e782da5d7ad88e93ee017925de85c37f (patch) | |
tree | 2a4de626d2e0a50607a76a96abf4cf78646a877e /make/config/clImplCustomCode.java | |
parent | af62da5b7ee3d99da7dc9364f1240fa7a8f5968e (diff) | |
parent | 54ced2cf5d801470c106275291be17583e5e206d (diff) |
Merge pull request #5 from WadeWalker/bug_978_fix_solaris_tests
Fix OpenCL test failures on Solaris for bug 978.
Diffstat (limited to 'make/config/clImplCustomCode.java')
-rw-r--r-- | make/config/clImplCustomCode.java | 27 |
1 files changed, 15 insertions, 12 deletions
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) |