.NET bindings for OpenCL that are easy-to-use and true to the original API. There is no OOP abstraction, nor will there ever be. OpenCL.Net is meant to be small, fast (with as little explicit marshaling as possible) and .NET friendly at the same time.
OpenCL.NET now generates type-safe kernel wrappers using a custom build step. Steps to use it are:
- Fetch the latest OpenCL.NET package from Nuget
- Add a kernel (say kernel.cl) and write code in it as usual
- Go to Properties for that file and choose "Kernel" as the Build Action
- You can either choose the "Copy the file to the output directory" option (in which case the wrapper will reference this file to load sources) or leave it at "Do not copy" which will cause OpenCL.Net to embed the kernel source code in the wrapper.
- Simply instantiate and use the kernel as shown here
For the curious-minded, the actual kernel wrapper is generated as obj/<yourKernelName>.Kernel.cs
and included in the compile process, much like App.xaml.g.cs. Note: OpenCL.NET does not support custom types or complex preprocessor-based parameter type definitions at this time. Contact me if something you would very much like to have does not work.
OpenCL.NET is now available on Nuget! Get it here