JOCL_0_2_0-windows-x86_64.dll does not link to opencl.dll

First, let me thank you for the excellent java software, certainly the best on the internet, for getting opencl up and running
but , I cant seem to link it to intel opencl.dll 2.0 driver I have on windows

I have several opencl.dll files in windows

C:\Windows\System32\OpenCL.DLL
C:\Program Files (x86)\Intel\OpenCL SDK\bin\icd\x64\OpenCL.dll (cant link to this one !!!)

was hoping to link to Intel version of opencl.dll (as this has a opencl 2.0 driver)

Looks like your dll does not link to opencl.dll (see output from depends below)
But is a custom version of opencl.dll, and does not call opencl.dll

Also, was not able to build in Visual studio 2015, had lots of trouble with .hpp files not compiling (which compiler did you use ?)
Any help appreciated, thanks

output from depends.exe :
[ 6] c:\opencl\java\jocl-0.2.0-rc-bin\JOCL_0_2_0-WINDOWS-X86_64.DLL
[ 6] c:\windows\system32\KERNEL32.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-RTLSUPPORT-L1-1-0.DLL
[ 6] c:\windows\system32\NTDLL.DLL
[ 6] c:\windows\system32\KERNELBASE.DLL
[ ^6] c:\windows\system32\NTDLL.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-HEAP-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-MEMORY-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-HANDLE-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-SYNCH-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-FILE-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-IO-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-THREADPOOL-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-LIBRARYLOADER-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-NAMEDPIPE-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-MISC-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-SYSINFO-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-LOCALIZATION-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-PROCESSENVIRONMENT-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-STRING-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-DEBUG-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-ERRORHANDLING-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-FIBERS-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-UTIL-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-CORE-PROFILE-L1-1-0.DLL
[ 6] c:\windows\system32\API-MS-WIN-SECURITY-BASE-L1-1-0.DLL
[F^6] c:\windows\system32\NTDLL.DLL

Hello

I’m not as familiar with some details about this as I probably should be, but I’ll describe this to the best of my knowledge and understanding, and am open and thankful for corrections:

OpenCL uses an „Installable Client Driver“ mechanism. This roughly means that an OpenCL implementation (e.g. by NVIDIA, AMD or Intel) places an „OpenCL.DLL“ into the system directory. This DLL should basically be the same for ALL OpenCL implementations (that refer to the same OpenCL version). So if you install OpenCL 1.2 from AMD and OpenCL 1.2 from Intel, then „the same“ OpenCL DLL would end up in the system directory.

This OpenCL.DLL only serves as some sort of „bridge“ or „dispatcher“ to the actual OpenCL implementation. It magically discovers the real implementation libraries (that is, the libraries that contain the actual OpenCL implementations, that are specific for AMD, NVIDIA and Intel), and dispatches all OpenCL calls to this library.

This is crucial in order to have multiple OpenCL implementations available on one system. For example, I have a system with an AMD CPU and an NVIDIA GPU. I can install drivers for both, and then I can use OpenCL on the AMD CPU and on the NVIDIA GPU at the same time. They both will be accessed via the same OpenCL.DLL. The underlying implementation is then identified via the cl_platform_id. That is: When I call clGetPlatformIDs, then I receive 2 platform IDs. If I additionally installed the Intel driver (which I should probably do, for testing…) then I would receive 3 platforms. The cl_platform_id will then determine whether an OpenCL call (that is issued against the „OpenCL.DLL“) is forwarded to some „NvidiaOpenCL.DLL“ or some „AmdOpenCL.DLL“.


What does all this mean for JOCL?

It basically means that JOCL does not link directly against a specific DLL. It loads the „OpenCL.DLL“ at runtime, from the system directory. The rest of the forwarding mechanism is then handled by the „OpenCL.DLL“.

So if your OpenCL implementation (that from Intel) is installed properly, then it should be discovered at runtime. Or specifically: What does clGetPlatformIDs return for you? In the simplest case, you can just run the device query sample from http://jocl.org/samples/JOCLDeviceQuery.java . It should list all devices from all platforms. And one of the platforms should be your „Intel“ platform.


Also, was not able to build in Visual studio 2015, had lots of trouble with .hpp files not compiling (which compiler did you use ?)

Can you describe the erros in more detail?

In any case: For the last versions, I used Visual Studio 2013. A few days ago, I installed Visual Studio 2015, but did not yet compile JOCL with this one. I’ll have a look at this ASAP, and will check whether there are any issues with the compilation with this new version.

A small update: I just tried the compilation with Visual Studio 2015, from freshly generated build files, and it worked properly.
If you hava any details about the “hpp files not compilig” that you mentioned, I’d be curious…

I tried compiling JOCL-0.2.0-RC-src.zip, using Visual Studio 2015
(I imported the visual studio 2012 solution, and visual studio upgraded)

it gave the following errors

Severity Code Description Project File Line Suppression State
Error C2146 syntax error: missing ‘;’ before identifier ‘clGetPlatformIDsFP’ JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 36
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 37
Error C2146 syntax error: missing ‘;’ before identifier ‘clGetPlatformInfoFP’ JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 37
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 38
Error C2146 syntax error: missing ‘;’ before identifier ‘clGetDeviceIDsFP’ JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 38
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 39
Error C2146 syntax error: missing ‘;’ before identifier ‘clGetDeviceInfoFP’ JOCL c:\work3\opencl\jocl_jni\src\clfunctions.cpp 39

Ah, sorry, this refers to the download package from the website. I thought you referred to the GitHub repo.

The download package has not been updated for a while, as the main source development has taken place on GitHub, and there haven’t been any releases recently. (I’d tackle the update for CL 2.1, but at the moment, there are hardly any 2.0 drivers available, so this would be rather useless…)

However, I’ll review the current source package on the website. Likely, there will be an update that reflects the latest GitHub version - so it will not contain the VS project files, but the CMake files.

OK, I looked at the current source package on the website, and it is indeed quite outdated. Most importantly, the include path for the CL headers would have to be set manually.

I updated the website a little, e.g. striked out the download for the source code package, and updated some links, but primarily added a link to the JOCL GitHub repo ( https://github.com/gpu/JOCL ) at the download page. This contains the source code (including the CL headers!) and build instructions.

If you encounter any problems with building JOCL from the GitHub source, just drop me a note here or open an issue in the issue tracker.

Sorry for the hassle (the transition from “local SVN + ZIP files” to “GitHub + Maven” happened in the previous version of JOCL, and the downloads page did not make this clear unambiguously…)