lava555

problem when add two float variable in GPU

Discussion created by lava555 on Jul 18, 2010
Latest reply on Jul 18, 2010 by lava555

When i run a demo, the two results on GPU and CPU of two variables is not

the same, and the precision of result is very low on GPU. for example:

float var1 =  0.89652568101882935000;

float var2 =  1.02036583423614500000;

And the results are as follows:

CPU: 1.02036587893962861000

GPU: 1.02036583423614500000

Obviously the result of GPU is not right of my  expectation. 

Ps: I added a predefine as that:

#pragma OPENCL EXTENSION cl_khr_fp64 : enable 

for the need of handling my data set. But i think it should not has any effect on adding two float data.

So what have happened on GPU? Can i avoid this precision problem?

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

Outcomes