OpenCL: Problem with OpenCL Versioning and Shared Libraries?

So first of all this is about OpenCL. I’m not sure if this is the place to post stuff about OpenCL within NVIDIA’s Developer Zone. If it is not; please direct me to the correct location.

I am trying to run my OpenCL program on a Quadro 5000. I am running Linux; CentOS 6.8 (Final) to be exact. I installed the Linux 64bit driver (375.20) from here: http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/375.20/NVIDIA-Linux-x86_64-375.20.run&lang=us&type=GeForce

So the driver seems to work, except for when run my OpenCL program (called OpenCLmovestack… ignore the parameters I pass in because the problem happens regardless of what I pass in) I wrote I get the following error:

[zack@sockeye ~]$ OpenCLmovestack 8000 2000 8000 2
Exception in thread “main” java.lang.UnsatisfiedLinkError: /home/zack/my_prowess_home/sys/linux64/lib/libcom_nanoseis_ssa.so: /usr/lib64/libOpenCL.so.1: version `OPENCL_2.0’ not found (required by /home/zack/my_prowess_home/sys/linux64/lib/libcom_nanoseis_ssa.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1728)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.nanoseis.ssa.ParallelMoveoutAndStackApplier.(ParallelMoveoutAndStackApplier.java:15)
Could not find the main class: com.nanoseis.ssa.ParallelMoveoutAndStackApplier. Program will exit.

I also tried a c-standalone version that doesn’t use Java to launch and test the code, I get a similar error:

ParallelMoveoutAndStackApplier: /usr/lib64/libOpenCL.so.1: version `OPENCL_2.0’ not found (required by ParallelMoveoutAndStackApplier)

What I figured was that the old OpenCL .so(s) for the old card were left behind after instillation and it was picking those up instead of the new .so(s) (I did uninstall the older driver before installing the new driver). It looked like that might be the case:

[root@sockeye zack]# ls -l /usr/lib64 | grep -i opencl
lrwxrwxrwx 1 root root 26 Dec 8 15:23 libnvidia-opencl.so.1 -> libnvidia-opencl.so.375.20
-rwxr-xr-x 1 root root 8646792 Dec 8 15:23 libnvidia-opencl.so.375.20
lrwxrwxrwx 1 root root 14 Dec 8 15:23 libOpenCL.so -> libOpenCL.so.1
lrwxrwxrwx 1 root root 16 Dec 8 15:23 libOpenCL.so.1 -> libOpenCL.so.1.0
lrwxrwxrwx 1 root root 37 Dec 8 15:48 libOpenCL.so.1.0 -> libOpenCL.so.1.0.0
-rwxr-xr-x 1 root root 26328 Dec 8 15:23 libOpenCL.so.1.0.0

However when I attempt a simple fix by changing the link using “ln -s -f /usr/lib64/libnvidia-opencl.so.375.20 /usr/lib64/libOpenCL.so.1.0” and then try running my program I instead get this:

[zack@sockeye ~]$ OpenCLmovestack 8000 2000 8000 2
runOpenCLOnly() startIndexOut=800 endIndexOut=7200
samplesPerTrace: 8000 nTracesIn: 2000 nTracesOut: 8000
java: relocation error: /home/zack/my_prowess_home/sys/linux64/lib/libcom_nanoseis_ssa.so: symbol clGetPlatformIDs, version OPENCL_1.0 not defined in file libOpenCL.so.1 with link time reference

Here is looks like my program at least starts to run (because the first two lines are from my program) however it then crashes saying version OPENCL_1.0 is not defined. Huh?

Also if I do “cat /etc/OpenCL/vendors/nvidia.icd” I get “libnvidia-opencl.so.1”, so at least that’s pointing to the right one?

So I saved the old opencl .so from the old graphics card, I tried replacing the new .so in favor of it to see what happens. This is what I get:

[zack@sockeye ~]$ OpenCLmovestack 8000 2000 8000 2
runOpenCLOnly() startIndexOut=800 endIndexOut=7200
samplesPerTrace: 8000 nTracesIn: 2000 nTracesOut: 8000
java: relocation error: /home/zack/my_prowess_home/sys/linux64/lib/libcom_nanoseis_ssa.so: symbol clCreateCommandQueueWithProperties, version OPENCL_2.0 not defined in file libOpenCL.so.1 with link time reference

Also some additional information that I forgot: when I first installed the driver I could actually run and complete the OpenCL code! It however ran slower than I excepted. So this is getting stranger, because I expected what I did above to work except be slow like before… what .so could I have been using then?

Lastly; when I use readelf -WV I do see OPENCL_1.0 defined in the libOpenCL.so.1 that comes with the driver, meanwhile OPENCL_1.0 nor OPENCL_2.0 appears to be defined two .so(s) (the nvidia one and the old .so). This makes me even more confused.

Why does it seem want to use libOpenCL.so.1.0.0 over the libnvidia-opencl.so.375.20 despite what the .icd contains? I am correct in thinking that it should be using libnvidia-opencl.so.375.20, right?

What’s the issue with the second with the OPENCL_1.0 error? Why is it even trying to find version 1.0? I would hope my program is using OpenCL 2.0. Currently I compile the code on a different machine then I run the code on, but that shouldn’t matter?

Let me ask a simpler question: why is my code wanting OPENCL_2.0? What do I need to do to tell my code that I am okay with running OPENCL_1.0?

Edit: Nevermind, obviously what I need to do is compile the code with OpenCL 1.0 header files… where can I find such header files? I will report back if I find them.