View Full Version : Strange results

04-06-2010, 06:02 PM
Hello again...

I have setup two kernels and, depending on the options on the host, one of them will be executed. The problem is that if I run one kernel, and then I run again the application and choose to execute the other one, the results I get (for the first time the different kernel runs) are similar to the results of the first one. So, I have to run a kernel 2 times to get the "real" results.. Could it be any problem related to initialization of variables inside the kernel, or something related to buffers I could be missing, or something related to flushing?

Thanks a lot

04-07-2010, 03:52 AM
Still haven't figured this out.. can anyone give ideas of what may be happening? Code's following, if it helps:

(Array "count" is the only local one)

// Some arrays initialization
count[localID] = 0;


// Make some calculations here, and count[i] has 0 or 1

if(localID == 0)
for(i=0; i<N; i++)
aux ++;

i = get_group_id(0);
cvs[i] = aux;

covered_points[idy] += cvs[i];

c = (100.0*covered_points[idy])/(GRID_SIZE);
fi = (c*c)/N;


I've try to setup several barriers/mem fences, but with no success.

04-07-2010, 01:29 PM
I can't really tell what's going on here since I don't know where localID or idx come from, but I'd suspect you have a bunch of data races. You have some loops that are walking over aux and setting cvs, but I suspect other work-items could be modifying them at the same time. If that's the case your results will depend on the order in which the work-items are executed.