Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsatisfiedLinkError on linux when opencl is not installed #52

Closed
fer-marino opened this issue Jul 18, 2017 · 5 comments
Closed

UnsatisfiedLinkError on linux when opencl is not installed #52

fer-marino opened this issue Jul 18, 2017 · 5 comments
Assignees
Labels
bug Fix something that is broken

Comments

@fer-marino
Copy link
Contributor

fer-marino commented Jul 18, 2017

Dears,
I'm evaluating aparapi for one of our project, and a requirement for it is that it runs pure java even if no opencl device is available.
I've designed a simple test case using the guide but the test fails:

java.lang.UnsatisfiedLinkError: /tmp/libaparapi_x86_64678632701802135793.so: libOpenCL.so.1: cannot open shared object file: No such file or directory
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at com.aparapi.natives.util.NativeUtils.loadLibraryFromJar(NativeUtils.java:100)
	at com.aparapi.natives.NativeLoader.load(NativeLoader.java:35)
	at com.aparapi.internal.opencl.OpenCLLoader.<clinit>(OpenCLLoader.java:43)
	at com.aparapi.internal.opencl.OpenCLPlatform.getOpenCLPlatforms(OpenCLPlatform.java:73)
	at fr.gael.drb.cortex.topic.sentinel3.AparapiTest.info(AparapiTest.java:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
	at org.testng.TestRunner.beforeRun(TestRunner.java:641)
	at org.testng.TestRunner.run(TestRunner.java:609)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
	at org.testng.SuiteRunner.run(SuiteRunner.java:254)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)

this exception is thrown when the program its the line:
List<OpenCLPlatform> platforms = (new OpenCLPlatform()).getOpenCLPlatforms();

Going through the code, it seems that he try to check if opencl is available on the machine running OpenCLLoader.isOpenCLAvailable(), inside the init static block of that class it try to load the native library, and it fails as it's not available. Anyway that exception is not caught and everything breaks.
It catches IOException but that does not catch the UnsatisfiedLinkError.

Thank you and regards,
Fernando

@freemo
Copy link
Member

freemo commented Jul 18, 2017 via email

@freemo freemo self-assigned this Jul 18, 2017
@freemo freemo added the bug Fix something that is broken label Jul 18, 2017
@fer-marino fer-marino changed the title UnsatisfiedLinkError on linux when no opencl is not installed UnsatisfiedLinkError on linux when opencl is not installed Jul 18, 2017
@automenta
Copy link
Collaborator

there are a few opencl implementations available for linux. i know at least one of them has CPU support. you may only need to install that in the system.

https://packages.ubuntu.com/search?keywords=opencl&searchon=names&suite=yakkety&section=all

@fer-marino
Copy link
Contributor Author

@automenta it's not about opencl support, but opencl device detection by aparapi

@freemo freemo closed this as completed in 7cb5b89 Jul 20, 2017
freemo added a commit that referenced this issue Jul 20, 2017
@freemo
Copy link
Member

freemo commented Jul 20, 2017

@fer-marino Thanks, pull request merged, this should now be fixed. Will go out in next release.

@freemo
Copy link
Member

freemo commented Jul 28, 2017

@fer-marino release 1.4.0 has just been made and includes the fix for this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix something that is broken
Projects
None yet
Development

No branches or pull requests

3 participants