3

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)

`

JoshDM
  • 4,939
  • 7
  • 43
  • 72
  • You would get UnsatisfiedLinkError when in correct arch type software is installed / used. – Rao Apr 19 '17 at 10:55
  • I also have this issue on an NVIDIA based system. I have tested on various Intel and AMD based systems and all appears well. As far as i can tell i have the correct drivers, am using 64bit java on a 64bit machine etc. I have aparapi-1.3.4.jar and aparapi-jni-1.1.2.jar in my lib folder. I am using the Syncleus/aparapi – AdamH Jun 08 '17 at 02:02

2 Answers2

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

Community
  • 1
  • 1
  • 1
    I became aware of Aparapi back when it was started by AMD, and I thought it was a very promising approach. I even tried something similar in Groovy, which already has the AST infrastructure built-in - http://jocl.org/GroovyGPU/ - heck, that's already 6 years ago. However: Good to see that Aparapi is continued now. – Marco13 Apr 20 '18 at 20:49
  • @Marco13 Thanks, yea Aparapi just seems to keep building more and more momentum, we are over a dozen releases since I took over the project (about 2 years) and we just released 1.6 with 1.7 soon to come. – Jeffrey Phillips Freeman Apr 20 '18 at 21:03
-1

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.

Tobias G
  • 583
  • 2
  • 10