EasyOpenCL – The easiest way to get started with GPU programming
github.com
github.com
Thrust: http://thrust.github.io/
VexCL: http://ddemidov.github.io/vexcl/
Boost.Compute: http://boostorg.github.io/compute/
The author of VexCL provided a comparison of them two years ago: http://stackoverflow.com/questions/20154179/differences-betw...
I blogged about these kinds of libraries here (overview): http://www.soa-world.de/echelon/2014/04/c-accelerator-librar...
A new addition is welcome as we still have not found the perfect API for accelerator programming. EasyOpenCL seems very simple and easy to use but I feel like it is very restricted.
For getting started with OpenCL development these days I would recommend PyOpenCL. Since everything is in Python, data can be generated easily, results can be plotted using well known Python tools which simplified debugging. Kernels developed in PyOpenCL can directly be copied to other APIs (raw OpenCL C API or some of the other C/C++ wrappers) and reused in production code.
EasyOpenCL sounds quite similar to these STL-style libraries.
Thought - by the github TOS you at least get to fork the repo [1].
[1] https://help.github.com/articles/github-terms-of-service/#f-...
[1] https://github.com/Gladdy/EasyOpenCL/commit/da59775e94b580d4...
The latency of getting data from the CPU to the GPU and back is bad enough that for a small quantity of data (low megabytes), it's better just to compute it on the CPU. More practical tasks usually involve several kernel invocations, and keeping the data at the GPU is essential for any kind of decent performance.
But there are cases where executing a single kernel over some buffers would be useful (especially in early development or prototyping). In those cases, I'd like to write ZERO host-side code and use a CLI or GUI tool to run the code. So what I'd like to see is something like:
$ cl-cli --kernel=frobnicate.cl --input0=foos.bin --input1=bars.bin --output0=bazs.bin
Does such a tool exist already?It would be even better if this would allow building proper pipelines of multi-kernel programs by defining the inputs and outputs to kernels using a directed acyclic graph.
I do not intend to dishearten you, OP, but think about this when you consider future direction to take with your project.
But if you're already in PyOpenCL I guess would also prefer to generate the bin files there (maybe using numpy) ans evaluate the output (matplotlib possibly). For optimization you could run the kernel in a loop, time the runtime and vary the number or global and local work groups.
There is also a CLI interface that allows in principle what you want to do, e.g.
$ ufo-launch read path=foos.bin ! opencl filename=frobnicate.cl kernel=frobnicate ! fft ! blur ! write filename=bars.tifThe DAG idea sounds fun to build and very useful - I have some spare time anyway so I'll see what I can whip up. As for the command line interface - It too sounds pretty useful and it should only be a bit of parsing as all the OpenCL related code as been written already, but ufo-launch already performs pretty much the same function so it's not very high on my todo list.
Good! Additionally, it would be useful to memory map buffers and allow using raw pointers in addition to std::vectors. But more importantly, it would be necessary to use the output of one kernel as the input of another kernel invocation.
Anyway, build it to suit your use case primarily. Happy hacking!
No raw pointers, but you can use C arrays (was that what you meant by raw pointers?).
Apart from that, really nice work, the code is well written and commented, it's a joy reading things like that.
Therefore, I just implemented the most basic straightforward alternative (which is indeed rather restrictive at the moment) as a temporary solution.