Re: How to queue in a multidevice environment
Posted by
Wade Walker on
Feb 25, 2017; 6:09pm
URL: https://forum.jogamp.org/How-to-queue-in-a-multidevice-environment-tp4037674p4037675.html
Hi Arnold,
For these kind of questions, the ultimate resource is probably the OpenCL spec (
https://www.khronos.org/registry/OpenCL/specs/opencl-2.1.pdf) and the official OpenCL docs (
https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/). They go into far more detail than I could in a forum post :)
For examples of using JOCL's object-oriented features, the tests at
https://github.com/WadeWalker/jocl/tree/master/test/com/jogamp/opencl and the demos at
https://github.com/WadeWalker/jocl-demos are the best resource. Or, if you want to program OpenCL in a way similar to how it's used from C/C++, you can do it like in the "low-level bindings" test (
https://github.com/WadeWalker/jocl/blob/master/test/com/jogamp/opencl/LowLevelBindingTest.java).
The JOCL low-level bindings are just a thin wrapper around the C functions, so they should work just as explained in the official OpenCL docs, except for the use of ByteBuffers in place of array and pointer arguments. This way of programming is a little more painful than using JOCL's object-oriented features, but since it's more like the non-Java use of OpenCL, it's easier to find help for it on places like StackOverflow and to compare it to the official Khronos docs.
Lastly, don't be discouraged if OpenCL programming seems difficult to understand at first. It's like that for everyone :) It just takes practice and exposure to get used to.