nythrix's picture

Cloo 0.8

Cloo 0.8 is finally out! Since the initial plans three months have passed. During this time Khronos updated the OpenCL specification and, as it happens, some (actually a lot) of the new OpenCL functions do exactly what I was going to implement myself. So, a big thank you to those guys is in place.

These are some of the new bits you can expect in this version:
- Massive rewrite of the ComputeCommandQueue class. More than 40 new methods with a consistent interface for seamless and safe data transitions between .NET arrays (1, 2, and 3 dimensional) and OpenCL buffers and images were added. Most of them provide automatic argument tracking (pinning, referencing and releasing on completion) if invoked as non-blocking calls.
- Events fitted with... well... events, which are fired on command completion or abortion.
- OpenCL 1.1 user events (ComputeUserEvent)
- OpenCL 1.1 sub buffers (ComputeSubBuffer)
- OpenCL 1.1 related ComputeKernel queries (GetPreferredWorkGroupSizeMultiple, GetPrivateMemorySize)
- OpenCL 1.1 related ComputeDevice properties (NativeVectorWidth*, HostUnifiedMemory, OpenCLCVersion, OpenCLCVersionString, VersionString)
- Two new data types: SysIntX2 and SysIntX3. They are used (and can be enforced) wherever a size_t[3] is expected in the OpenCL API.
- Added new OpenCL 1.1 test to Clootils.

Speaking of testing. It wasn't possible for me to test each and every single new method. Although, I did test the core ones, bugs might have gone unnoticed in the others. Therefore, a sane HOWTO upgrade could look like this:
0) Update your drivers to support OpenCL 1.1.
1) BACK UP YOUR CODE before upgrading to Cloo 0.8 (or use source control).
2) Upgrade.
3) Report any problems you find.
4) Other messages are also welcome (no penis enlargement ads, please).

Note that Cloo 0.8 is NOT compatible with older releases. The main cause is the new event type which forced a change to the existing command queue methods. They now require an ICollection<ComputeEventBase> instead of an ICollection<ComputeEvent> argument (Find&Replace should be enough for this). A related change affected ComputeEventList, which now implements IList<ComputeEventBase> instead of IList<ComputeEvent>. Changes also affected the raw bindings (note that they aren't the primary focus of Cloo and shouldn't be used outside testing or edge cases. Their interface may change at any time without much warning).

Some of the existing command queue methods were deprecated. Especially methods with long[3] arguments were obsoleted in favour of methods with SysIntX3 typed arguments.
Also, aiming for a bit of practicality, some of the event properties were replaced with shortly named ones (the originals are deprecated but still there).

Last but not least: Given the amount of changes in 0.8, I will continue to maintain the 0.7 branch for those of you not willing to upgrade (either because it's too complicated or you just happen to like the previous version more). Naturally, I will focus on the newer releases, so, if you want me digging in older code you'll have to tell me (see readme.txt on how to do that). On the other hand, the deprecated parts will continue to be available across the whole 0.8.x series.

Happy coding!


Comments

Comment viewing options

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

Quick link (because I'm usually too lazy to find my way to the project pages): http://sourceforge.net/projects/cloo/files/

Thanks for keeping this up to date.

Is there a reason why you switched the solution/project files to VS2010? It seems to work fine when downgrading to VS2008, so maybe keep two solutions (?).

nythrix's picture

Thanks.

My VS 2008 Express broke down (for some weird reason it wouldn't display Find&Replace). So, I thought I might as well upgrade to the new one. But I forgot about the old solution and project files. Will put them back in.

kbzowski's picture

I can not run Clootils nor any of my software using Cloo 0.8.0. I had no problems with previous version 0.7.4
Problems start with:
ReadOnlyCollection<ComputePlatform> platforms = ComputePlatform.Platforms;

which throw:

Platforms = 'Cloo.ComputePlatform.Platforms' threw an exception of type 'System.TypeInitializationException'

I am using: Windows 7 64 bits
GeForce GT240 with 258.96 Drivers and ATI Stream SDK 2.2 (to get CPU supports);

I found solution here:
http://sourceforge.net/projects/cloo/forums/forum/1048266/topic/3834603

ComputeDevice.cs

                preferredVectorWidthDouble = 0;// GetInfo<uint>(ComputeDeviceInfo.PreferredVectorWidthDouble);
                preferredVectorWidthFloat = GetInfo<uint>(ComputeDeviceInfo.PreferredVectorWidthFloat);
                preferredVectorWidthHalf = 0;// GetInfo<uint>(ComputeDeviceInfo.PreferredVectorWidthHalf);

I would be glad if this was fixed in a future release.

nythrix's picture

I've put together a bugfix release, which should take care of the discovered bugs. I've also included the VS 2008 solution and project files.

Original release notes:

Cloo wrote:

This is a maintenance release which fixes a highly critical bug on OpenCL platforms that make use of a device without cl_krh_fp16 or cl_khr_fp64 support. The bug prevented 0.8.0 from initializing in such environments. This release also gets rid of the occasional IOException in the ComputeEvent bowels. Upgrade from 0.8.0 is strongly recommended.

Thanks for reporting and sorry for the trouble, guys.

Download