
Cloo : Stream SDK v2.0 error
Posted Monday, 21 December, 2009 - 21:20 by CodyIrons inHeya,
I stumbled upon Cloo 0.4.1 and am very impressed by it!!! With AMD's new stream sdk 2.0 release they no longer allow platform to be null. So i just do the following:
ComputePlatform currentPlatform = null; //find our platform foreach (ComputePlatform platform in ComputePlatform.Platforms) { System.Console.WriteLine("VendorName = {0}",platform.Vendor); if(platform.Vendor.Equals("Advanced Micro Devices, Inc.")) { currentPlatform = platform; } //break; } ComputeContext.PropertiesDescriptor pd = new ComputeContext.PropertiesDescriptor(currentPlatform); ComputeContext context = new ComputeContext(DeviceTypeFlags.DeviceTypeDefault, pd, null);
One platform is listed:
"VendorName = Advanced Micro Devices, Inc."
I stepped through the ComputeContext constructor and the only thing that is still just Zero'd is the notifyDescr. But according to http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71 this is ok to be nulled out.
Here is the stacktrace that is thrown, at first glance it seems to be the same as if you passed a null platform.
Cloo.InvalidPlatformComputeException was unhandled Message="Exception of type 'Cloo.InvalidPlatformComputeException' was thrown." Source="Cloo" StackTrace: at Cloo.ComputeException.ThrowIfError(ErrorCode errorCode) in C:\Users\Cody\Documents\Downloads\Cloo-0.4.1\Cloo\Source\ComputeException.cs:line 125 at Cloo.ComputeContext..ctor(DeviceTypeFlags deviceType, PropertiesDescriptor properties, NotifyDescriptor notify) in C:\Users\Cody\Documents\Downloads\Cloo-0.4.1\Cloo\Source\ComputeContext.cs:line 111 at MonteCarloSimOpenCLoo.Program.Main(String[] args) in C:\Users\Cody\AppData\Local\Temporary Projects\MonteCarloSimOpenCLoo\Program.cs:line 28 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:


Comments
Re: Cloo : Stream SDK v2.0 error
The project is still in alpha stage. Because of time constraints, I haven't been able to test every code path.
This looks like a decent bug. Thanks for the report, I'll check things.
Re: Cloo : Stream SDK v2.0 error
I cannot reproduce this. Yes, Stream requires a platform but your code is working in my box. Can you check your ATI installation? I faced problems during setup.
http://www.opentk.com/node/1470
Edit:
I adhered to the Khronos specs as much as possible while putting together Cloo. To my knowledge, specifying a platform is NOT required by the standard:
...properties can be NULL in which case the platform that is selected is implementation-defined...
and
...it returns a NULL value with the following error...
...CL_INVALID_PLATFORM if properties is NULL and no platform could be selected or if platform value specified in properties is not a valid platform.
See clCreateContext and clCreateContextFromType.
However, I'll investigate into this further.
Re: Cloo : Stream SDK v2.0 error
I am also getting the same error as CodyIrons using the final release of the ATI Stream SDK 2.0 at the same spot using
as suggested.
On my system, I have an AMD cpu but no OpenCL enabled graphics card. I'm running Windows 7 64bit and using Visual Studio 2008 with Cloo 0.4.1. The ClooInfo program works, but any sample that tries to set up a context fails with an invalid platform error.
I was using Cloo 0.3.1 and Beta 4 of the ATI Stream SDK 2.0 before I installed the new versions and they worked like a charm.
Re: Cloo : Stream SDK v2.0 error
I don't believe i ever did list the system i was trying to run this on so here is that info:
AMD Phenom X4 940
3 * ATI 4870 1GB cards
4GB Ram
Vista Ultimate x64
ATI 9.12 hotfix drivers
(i can tell you more but this is all i would expect the new stream sdk to be able to pick up)
Currently i have two of the video cards disabled (i've been trying all combinations though) so we should only be dealing with the processor and 1 gpu being picked up in the devices list. but the ClooInfo only gives me this:
I may roll back the stream version to v2.0 beta 4 and see if i have similar issues.
But on a side note i have been testing a DirectCompute/OpenCL benchmarking tool that reads the info for my system just fine, BUT his 'combined' openCL test cannot detect more then one device from my system. Link
I'm curious if this isn't the stream v2.0 issue.
Re: Cloo : Stream SDK v2.0 error
Okay, some more (and interesting) info on this problem......The ATI samples in the SDK 2.0 final won't even run and they are not using CLOO! I get a "Error: clCreateContextFromType failed. Error code : CL_INVALID_PLATFORM" message when I try running them. I've even tried uninstalling and reinstalling the SDK and it didn't do anything. I've now reverted back to the SDK 2.0 Beta 4 and all CLOO code works as expected, even using the additional device code suggested here. However, the ATI Stream SDK 2.0 final samples don't work on the Beta: I get a "Error: clCreateContextFromType failed. Error code : CL_INVALID_PLATFORM"
I suspect this is a bug with the SDK itself. Hopefully, we get to the root of this. I'll try posting a thread in the AMD GPU forums in a little bit to ask for help.
Re: Cloo : Stream SDK v2.0 error
SDK samples working properly on nVidia implementation. Forcing ATI's makes them crash. This is ridiculous.
Re: Cloo : Stream SDK v2.0 error
Reverting back to sdk 2.0 beta 4 allowed the program to execute properly. But when printing out devices and device counts and platforms, only one platform is found and only 1 device is found (My processor).
I have two versions of the program i'm running, one is for Cloo and one is just using OpenTK. The OpenTK only program i can switch my DeviceTypeFlats.DeviceType from Cpu to Gpu and i see the performance change accordingly:
But on my Cloo version i noticed that the only DeviceType that works is Cpu (between those two):
And actually setting the DeviceType to Gpu gives me a 0 number of devices and a System.ArgumentOutOfRangeException when trying to create the Queue.
In the Cloo source for ComputeContext in your GetDevices() method I noticed your only returning 'valid' devices. Is it possible the other devices are being 'weeded out' here?
Re: Cloo : Stream SDK v2.0 error
I found it!
It's a flag I remember setting up since ATI Stream beta1, when the whole thing wasn't officially working in WinXP.
What a horrible leftover.
I've already patched the code but it's not online, yet. For the eager:
1) File: ComputePlatform.cs
2) Line: 189
3) Is:
int error = CL.GetDeviceIDs( Handle, DeviceTypeFlags.DeviceTypeDefault, 0, null, &handlesLength );4) Should read:
int error = CL.GetDeviceIDs( Handle, DeviceTypeFlags.DeviceTypeAll, 0, null, &handlesLength );Edit:
Online repository updated. Either one of these will do:
Re: Cloo : Stream SDK v2.0 error
Most Excellent!! I can confirm it worked on stream 2.0 beta 4 will be trying out the release version after this.
Edit:
Can't create a context with ati's 2.0 release version. You can query for the info and get platform and device info, but you can't create a context. I'm going to revert back to beta 4 to do some playing.
Re: Cloo : Stream SDK v2.0 error
Thanks for the help. It was a nice hint.
Can't create a context with ati's 2.0 release version. You can query for the info and get platform and device info, but you can't create a context. I'm going to revert back to beta 4 to do some playing.
As I said, I've succesfully managed to create a ComputeContext on ATI Stream 2.0 final using the code above. However, given that:
1) ATI samples on nVidia CL work and
2) ATI samples on ATI CL fail,
the workaround needn't work in all configurations (mine's WinXP). There's nothing Cloo can do about this ATM.
ATI's turn...