agkdc's picture

How can I use OpenCL with OpenTK?

I read the documentation of OpenTK but I couldn't find how to use OpenCL 1.0 with OpenTK.

Is there a specific namespace or class in OpenTK for OpenCL? How can I run general purpose calculations with GPU?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Short answer: you need the Cloo project.

Long answer: the original idea was to provide low-level OpenCL bindings in OpenTK and high-level (object-oriented) bindings in Cloo. However, it proved more efficient to develop both in the same project, so everything was moved to Cloo.

Cloo works nicely alongside OpenTK, so you can use the first for GPU computing and the latter for rendering (e.g. to display the results).

nythrix's picture

Indeed, you can use Cloo for OpenCL development. Mixing with OpenTK is really easy since both projects share a similar naming scheme: Graphics*** for OpenTK classes vs Compute*** for Cloo classes.

OpenCL 1.0 is fully supported. OpenCL 1.1 is a WIP but low-level bindings are already available. Most of the extensions are supported as well.