
Interactive GPU Programming, Part 3: CUDA Context Shenanigans - dragandj
https://dragan.rocks/articles/18/Interactive-GPU-Programming-3-CUDA-Context
======
dragandj
Library source code:
[https://github.com/uncomplicate/clojurecuda](https://github.com/uncomplicate/clojurecuda)

Documentation:
[https://clojurecuda.uncomplicate.org](https://clojurecuda.uncomplicate.org)

OpenCL alternative:
[https://github.com/uncomplicate/clojurecl](https://github.com/uncomplicate/clojurecl)

~~~
geokon
(comments on your previous posts are closed, so I'll ask here)

Does ClojureCL work with POCL[0]? I ask b/c ARM seems to have abandoned
OpenCL-on-CPU with NEON, but it can still be done using POCL[1].

I've gotta say, ClojureCL just looks fantastic and a very slick way to deal
with tight-loops (without having to do FFI with C++). And writing OpenCL
kernel interactively is going to be a huge win. This might be what pushes me
to switch from C++ to Clojure :)

[0] - [https://github.com/pocl/pocl](https://github.com/pocl/pocl)

[1] - [https://www.cnx-software.com/2017/11/14/first-opencl-
encount...](https://www.cnx-software.com/2017/11/14/first-opencl-encounters-
on-cortex-a72-some-benchmarking/)

PS: Hope you have a post about profiling/benchmarking kernels

~~~
dragandj
ClojureCL is driver-agnostic. As long as the OpenCL platform implementation
(POCL) is OpenCL-compliant, ClojureCL should work (but I have not tried).

Regarding profiling/benchmarking, you can measure wall-clock time very
precisely with Criterium, and you can also use kernel profiling built into
OpenCL, as explained in OpenCL in Action and demonstrated here:
[https://github.com/uncomplicate/clojurecl/blob/master/test/c...](https://github.com/uncomplicate/clojurecl/blob/master/test/clojure/uncomplicate/clojurecl/examples/openclinaction/ch07.clj)

~~~
geokon
Thanks for getting back to me and thanks for your amazing work. Seems POCL
doesn't support a few things:
[http://portablecl.org/docs/html/features.html](http://portablecl.org/docs/html/features.html)

I'll need to dig around a bit more. The OpenCL drivers are a rather confusing
mess (especially on the open source side of things)

~~~
dragandj
OTOH, even Intel CPUs support OpenCL, so practically there aren't such many
cases where you can't work with a "real" OpenCL implementation.

