the Fiddler's picture

C# OpenCL bindings ready for testing

Update: current efforts are focused on Cloo (object-oriented CL wrapper), which can be found here. It provides a much cleaner OpenCL API compared to raw bindings (which are also available in case you need them).

The generator now supports generating C# OpenCL wrappers from the C headers. The OpenCL wrappers reside under the OpenTK.Compute.CL10 namespace of SVN trunk. An OpenCL sample has also been added to Examples.exe: if you have access to an OpenCL implementation, please run the VectorAdd sample and report your results here.

AMD has released a public beta of its OpenCL implementation that you can download from AMD's developer website (free registration needed). This implementation runs on all SSE3-capable CPUs and is available for Window and Linux platforms.

There is a lot of fine-tuning left to do for OpenTK's OpenCL wrappers and the sooner you test the bindings, the sooner they will become ready for release.


Comment viewing options

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

I've installed ATI Stream SDK.
Running VectorAdd produces the following error:
Unable to find an entry point named 'clCreateContextFromType' in DLL 'opencl.dll'

As far as I can see, this method is used in ATI demos, so there's probably something wrong with OpenTK bindings.

the Fiddler's picture

Thanks for testing.

I have encountered similar issues here and it's good to know they are not limited to my system. Haven't been able to find the cause yet.

It's a fact that P/Invokes work slightly different than the C linker, so it's possible that one works where the other one fails in some specific cases. We might be hitting such a corner case here.

I've yet to test on Linux.

nythrix's picture

Is it possible to move the bindings into one file? The current files were (originally) to contain the high level OpenCL classes.

the Fiddler's picture

Already done in SVN. The actual bindings are under 4 files in the CL10 directory. Everything else is empty and has remained as a guide for the high level classes.

nythrix's picture

Thanks. The ComputePlatform is ready though untested so far. ComputeDevice to arrive in a couple of days.

I too get an EntryPointNotFoundException on CL.GetPlatformID. Its the first CL call overall. Btw: it should be *CL.GetPlatformIDs*
WinXP 32bit / GF 9600GT / Core 2 Duo

Should I start a new thread for the OpenCL objects discussion? The old one is closed.

the Fiddler's picture

Yes, please create a new thread for this. It's also a good idea to create separate threads for any issues you encounter (e.g. GetPlatformIDs), otherwise they tend to get lost in the woods.

Zingam's picture

With Stream SDK 2.0 beta 3 the sample throws an exception.

The Mandelbrot sample with OpenCL.NET lib works.

the Fiddler's picture

Thanks for testing.

Can you please create an issue report with the exception and some details on your operating system? (OS, version and whether it's 32- or 64-bits)

Edit: Ati Stream 2.0 beta 3 still suffers from issue #1124: [OpenCL] EntryPointNotFoundException on CL calls. This is a bug in Ati's code on Windows - the Linux version is working correcty, as is Nvidia's implementation.

mike vasiljevs's picture

Concerning the OpenCL VectorAdd example, that is in latest repository revision, device to host memory writes seem to be missing, as well as the problem with the queue argument (queue instead of the context), more in

Inertia's picture

fyi: AMD released Stream SDK v2.0 beta 4 today.