nythrix's picture

Cloo 0.6.0 released!

A new version of Cloo has been released.
Added functionality includes image support, extension loading, a new layer of flat bindings and enums, OpenCL/OpenGL sharing support and more.
The release comes with Clootils, a small toolkit for OpenCL info querying and running tests. It also includes a handy OpenCL compiler which can be used for syntax checking your OpenCL programs.
Please note that this release is not compatible with 0.5.1 or earlier. Given the amount and nature of breaking changes, you are strongly encouraged to take advantage of an IDE to ease the process of update. And don't forget to back up your code first!

Available from: http://sourceforge.net/projects/cloo/


Comments

Comment viewing options

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

Good to see the project is coming along nicely.

However, I've just downloaded Cloo 0.6.0 and tried running Clootils but I get an error for each of the tests that tries to build the OpenCL program. My output from the "Run Tests" of Clootils:

------------------| Start Dummy Test |------------------
-------------------| End Dummy Test |-------------------
 
 
------------------| Start Mapping Test |------------------
Original content:
	8271977698777624576
	8282824114702712832
	4502325548893532672
	6593430338993726464
	7048156307997599744
	376104470900138496
Mapped content:
	8271977698777624576
	8282824114702712832
	4502325548893532672
	6593430338993726464
	7048156307997599744
	376104470900138496
-------------------| End Mapping Test |-------------------
 
 
------------------| Start Program Test |------------------
Cloo.BuildProgramFailureComputeException: Error in the application.
   at Cloo.ComputeException.ThrowOnError(ComputeErrorCode error) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeException.cs:line 118
   at Cloo.ComputeProgram.Build(ICollection`1 devices, String options, ComputeProgramBuildNotifier notify, IntPtr notifyDataPtr) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeProgram.cs:line 227
   at Clootils.ProgramTest.RunInternal() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\ProgramTest.cs:line 56
   at Clootils.AbstractTest.Run() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\AbstractTest.cs:line 50
-------------------| End Program Test |-------------------
 
 
------------------| Start Kernels Test |------------------
Program build notification.
Cloo.BuildProgramFailureComputeException: Error in the application.
   at Cloo.ComputeException.ThrowOnError(ComputeErrorCode error) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeException.cs:line 118
   at Cloo.ComputeProgram.Build(ICollection`1 devices, String options, ComputeProgramBuildNotifier notify, IntPtr notifyDataPtr) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeProgram.cs:line 227
   at Clootils.KernelsTest.RunInternal() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\KernelsTest.cs:line 98
   at Clootils.AbstractTest.Run() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\AbstractTest.cs:line 50
-------------------| End Kernels Test |-------------------
 
 
------------------| Start VectorAdd Test |------------------
Cloo.BuildProgramFailureComputeException: Error in the application.
   at Cloo.ComputeException.ThrowOnError(ComputeErrorCode error) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeException.cs:line 118
   at Cloo.ComputeProgram.Build(ICollection`1 devices, String options, ComputeProgramBuildNotifier notify, IntPtr notifyDataPtr) in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Cloo\Source\ComputeProgram.cs:line 227
   at Clootils.VectorAddTest.RunInternal() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\VectorAddTest.cs:line 60
   at Clootils.AbstractTest.Run() in C:\Users\Main\Documents\PersonalProjects\GPU Acceleration\Cloo-0.6.0\Clootils\AbstractTest.cs:line 50
-------------------| End VectorAdd Test |-------------------

My system specs:
Windows 7 x64 Ultimate,
AMD CPU with ATI Stream SDK 2.0 Final
No OpenCL GPU

Running the "Query" in Clootils gives:

[HOST INFO]
Operating system: Microsoft Windows NT 6.1.7600.0
 
[OPENCL PLATFORMS]
Name: ATI Stream
Vendor: Advanced Micro Devices, Inc.
Version: OpenCL 1.0 ATI-Stream-v2.0.0
Profile: FULL_PROFILE
Extensions:
 
Devices:
	Name: AMD Athlon(tm) 64 X2 Dual-Core Processor TK-57
	Vendor: AuthenticAMD
	Driver version: 1.0
	Global memory: 3221225472
	Local memory: 32768
	Image support: False
	Compute units: 2
	Extensions:
	 + cl_khr_global_int32_base_atomics
	 + cl_khr_global_int32_extended_atomics
	 + cl_khr_local_int32_base_atomics
	 + cl_khr_local_int32_extended_atomics
	 + cl_khr_int64_base_atomics
	 + cl_khr_int64_extended_atomics
	 + cl_khr_byte_addressable_store

I don't know what is causing the build failure right now. I've done a cursory debugging in Visual Studio and it appears that Cloo sees my CPU and OpenCL installs. I think there is likely a bug somewhere in ComputeContextPropertyList or ComputeContext. I also have Cloo 0.5.1 on my system and that runs fine.

nythrix's picture

Thanks for the report. Investigating.

nythrix's picture

Looks like ATI Stream doesn't like "windows apps".
0.5.1 suffers from the same problem but because the tests were run in a console everything worked.

I found a couple of related posts:
http://forums.amd.com/devforum/messageview.cfm?catid=390&threadid=120337...
http://forums.amd.com/devforum/messageview.cfm?catid=390&threadid=123091...
The second post also appeared on our very forums but I can't find it right now. I didn't know what to do with it back then so I'm glad I can finally blame someone.
Long story short there's a problem with ATI Stream trying to write stuff into stderr even though it might not be a console application that's using it. And, quite obiovusly, the recommended solution for everyone is to close their stderrs instead of ATI actually fixing the damn thing.
That's the spirit...

viewon01's picture

Hi,

Also, does someone has find a way to DEBUG the KERNEL CODE ? My current code crash the application... so there is surely a memory access problem... but where :-P

Thx

nythrix's picture

There's the upcoming Nexus.
No pieces of AMD I know of .
I've never done it but you might try the very thing ATI's doing. Run your kernel on the CPU and printf(...) stuff.

ctk's picture

I've tried that. printf(...) doesn't work on x64 systems right now for the ATI Stream SDK 2.0, only works for x86 systems. So far, my debugging has consisted of outputting intermediate values from the kernel to an array that the host reads and then outputting that to the screen.

ctk's picture

Ok, I can confirm that this is the problem. I've tried running the VectorAdd test with Cloo 0.6.1 in a console application and that runs like normal. It's kind of lame that the ATI Stream SDK 2.0 has problems running in a GUI environment.

As a workaround, someone could use Process.Start(...) in .Net to run the console version of a OpenCL program and then redirect the console output to a GUI application. I was planning on doing this for another piece of code I have but now it seems like I should just separate the OpenCL portion of my code and run it in it's own process and pass data back and forth with files, console output, and command line arguments with Process.Start(...).

ctk's picture

BTW, nythrix, did you have any luck keeping the OpenCL objects alive after garbage collection in a fully managed way? Or should we still reference our OpenCL objects at the end of our programs to prevent the memory corruption errors?

viewon01's picture

Hi,

I have migrate to Cloo 0.6 and got a "memory access violation" with the NVidia OpenCL driver ! Here is my code

                ComputeContextPropertyList properties = new ComputeContextPropertyList(ComputePlatform.Platforms[0]);
                Context = new ComputeContext(ComputeDeviceTypes.All, properties, null, IntPtr.Zero);
 
                string[] source = new string[] { GetSourceCode(sourceCodeFile) };
                ComputeProgram program = new ComputeProgram(Context, source);
 
                Queue = new ComputeCommandQueue(Context, Context.Devices[0], ComputeCommandQueueFlags.Profiling);
                program.Build(null, null, null, IntPtr.Zero);

What I don't understand is that when I use Clootils... I load my kernel and build it without any problem !!!

How it is possible ?

Thx

nythrix's picture

@ctk:
I'm not sure what to do with the console constraint. I cannot silently redirect stderr because it may affect Cloo hosts. I'll probably introduce a method to let people manually overcome ATI's laziness.
Manual referencing cl objects is still a requirement. This version implements no anti GC mechanism because of the amount of other changes I introduced. I didn't want to leap too much forward without any kind of community feedback in between. However, if things go right, it will be present in 0.6.1, which is mostly backward compatible with 0.6.0 and due out in 10-12 days. "If things go right" means I am facing a couple of problems with this keep-alive strategy. Mostly due to the fact that it is hard to tell when are both the host application and OpenCL done with a given object. It might be Queue.Execute(), Queue.Finish(), Queue.Flush(), EventList.Wait() and possibly more. On the other hand Cloo shouldn't keep a cl object alive after it's been deliberately disposed. I'm still pretty much brainstorming on this front becuse in the worst scenario this problem may affect every asynchronous cl command there is...
@viewon1:
That piece of code looks ok. But I'll have to run it and tell you more. Which I can't do before tomorrow evening, so please bear with me.