nbigaouette

[Solved] Simple hello world on CPU: Bug in AmdStream?

Discussion created by nbigaouette on Oct 20, 2010
Latest reply on Oct 20, 2010 by nbigaouette
Not a bug at all, just a mis-understanding of OpenCL...

First, I want to thanks AMD for providing AMD Stream SDK. I just started using v2.2, but unfortunately I don't have a GPU for the moment so I'm running some test on the CPU.

While trying a simple kernel, I could not get correct results. I then tried on two different machines having dedicated GPU and got the expected results. The kernel is simply adding two arrays and storing the result in the second one.

As soon as I include "b(i)" in the assignment of "b(i)" (or even using a temporary variable) the new values are always "2*b". The exact same code, on a real GPU, gives the correct addition.

 

 

I'm still new to OpenCL, but I cannot hink of anything else but a bug in the Stream package. Is it possible?

I'm developping on ArchLinux x86_64, but tested on an Ubuntu i686 machine with an nvidia GeForce 8400 GS (CUDA sdk) and on a cluster with many tesla cards.

Thank you for your help.

 

__kernel void Test_OpenCL(__global const float * const a, __global float * const b, const int n) { for (int i = 0 ; i < n ; i++) { b[i] = a[i] + b[i]; } }

Outcomes