Aparapi, java.lang.UnsatisfiedLinkError: libaparapi_x86_... can't find dependent libraries

I try run my aparapi java program on 4 computer. 2 computer can run perfectly, but other 2 computer throw java.lang.UnsatisfiedLinkError:

`

Exception in thread "GPU" java.lang.UnsatisfiedLinkError: C:\Users\Wrusol\AppData\Local\Temp\libaparapi_x86_641952980562458381879.dll: Can't find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.aparapi.natives.util.NativeUtils.loadLibraryFromJar(NativeUtils.java:100)
        at com.aparapi.natives.NativeLoader.load(NativeLoader.java:42)
        at com.aparapi.internal.opencl.OpenCLLoader.<clinit>(OpenCLLoader.java:43)
        at com.aparapi.internal.opencl.OpenCLPlatform.getOpenCLPlatforms(OpenCLPlatform.java:73)
        at com.aparapi.device.OpenCLDevice.listDevices(OpenCLDevice.java:458)
        at com.aparapi.internal.kernel.KernelManager.createDefaultPreferredDevices(KernelManager.java:203)
        at com.aparapi.internal.kernel.KernelManager.createDefaultPreferences(KernelManager.java:178)
        at com.aparapi.internal.kernel.KernelManager.<init>(KernelManager.java:46)
        at com.aparapi.internal.kernel.KernelManager.<clinit>(KernelManager.java:38)
        at com.aparapi.internal.kernel.KernelRunner.<init>(KernelRunner.java:170)
        at com.aparapi.Kernel.prepareKernelRunner(Kernel.java:2270)
        at com.aparapi.Kernel.execute(Kernel.java:2439)
        at com.aparapi.Kernel.execute(Kernel.java:2396)
        at com.aparapi.Kernel.execute(Kernel.java:2336)
        at com.mycompany.insurancecompanywithgpu.SimulationCounter.GPUSimulation(SimulationCounter.java:387)
        at com.mycompany.insurancecompanywithgpu.SimulationCounter$2.run(SimulationCounter.java:357)
        at java.lang.Thread.run(Unknown Source)

`

Upvotes: 3

Views: 548

Answers (2)

Note: I'm the current lead of the Aparapi project. This was a bug that existed in very early versions of Aparapi. If you use version 1.5.0 as described here you will be fine: http://aparapi.com/introduction/getting-started.html

If you use the version of Aparapi in maven central, no need to install anything. Assuming you have any implementation of OpenCL installed then everything is installed that needs to be. Aparapi pulls in dependencies through maven and even the dll/so file for your platform and loads it automatically.

You can also find similar information here in the readme: https://github.com/Syncleus/Aparapi

The bug you expierenced was first mentioned here, and lists the patch/version that fixed it if you need that information: https://github.com/Syncleus/aparapi/issues/52

Upvotes: 2

Tobias G
Tobias G

Reputation: 583

You need to add necessary native libraries

For windows, that means .dll files. Locate the different arch type .dlls in a folder, in the same level as your jar file.

When starting your jar-file via the command line, add the following statement:

java "-Djava.library.path=lib" -jar your.jar

where lib is the folder containing the native .dlls. For other OS, there are also native libraries provided on the aparapi site. Just put these in your lib folder as well, if required.

Upvotes: -1

Related Questions