informatyk.poznan's picture

Cloo and 4870GS problem

hi, i have problem with that simple helloworld code:

using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using System.IO;
using Cloo;
 
namespace testy
{
    class Program
    {
        static void Main(string[] args)
        {
            ComputePlatform platform = ComputePlatform.Platforms[0];
            ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu,
                new ComputeContextPropertyList(platform), null, IntPtr.Zero);
            ComputeCommandQueue queue = new ComputeCommandQueue(context,
                context.Devices[0], ComputeCommandQueueFlags.None);
 
            string clSource = @"kernel void helloWorld(global read_only int* message, int messageSize) {
	for (int i = 0; i < messageSize; i++) {
		printf(""%d"", message[i]);
	}
}
";
            ComputeProgram program = new ComputeProgram(context, clSource);
            program.Build(null, null, null, IntPtr.Zero);
            ComputeKernel kernel = program.CreateKernel("helloWorld");
            int[] message = new int[] { 1, 2, 3, 4, 5 };
            int messageSize = message.Length;
            ComputeBuffer<int> messageBuffer = new ComputeBuffer<int>(context,
                ComputeMemoryFlags.ReadOnly | ComputeMemoryFlags.UseHostPointer, message);
            kernel.SetMemoryArgument(0, messageBuffer); // set the integer array
            kernel.SetValueArgument(1, messageSize); // set the array size
            queue.ExecuteTask(kernel, null);
            queue.Finish();
            Console.ReadKey();
        }
 
    }
}

in line : program.Build(null, null, null, IntPtr.Zero);
OpenCL error code detected: BuildProgramFailure.

When i change

            ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu,
                new ComputeContextPropertyList(platform), null, IntPtr.Zero);

to

            ComputeContext context = new ComputeContext(ComputeDeviceTypes.Cpu,
                new ComputeContextPropertyList(platform), null, IntPtr.Zero);

it's works on CPU.

My graphic card is ATI Radeon 4870 GS, i ve installed last drivers and ATI Stream SDK

what is wrong with that?
Thx