mtchamengo / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

Double precision #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I am currently implementing the conjugate gradient algorithm using double 
precision arrays. Running the implementation using JTP, I get perfect results 
with very little error. Running the same code using GPU, I get loads higher 
errors. I suspect the code does not run in double precision, because when 
changing the datatype to float, the difference between GPU and JTP is much 
smaller. 

Looking at the generated code, Aparapi recognizes that doubles are used and 
adds the pragma flag:

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

Am I doing anything wrong to let Aparapi run with doubles?

Thanks,
Matthias

Original issue reported on code.google.com by matthias.klass@gmail.com on 10 Jun 2013 at 2:11

GoogleCodeExporter commented 9 years ago
Matthias 

Hmm,  I wonder whether your card supports double.  Aparapi is supposed to check 
and revert to JTP if it does not. Are you sure that your card supports double?

Can you recreate with a small trivial program which fails for you, so we can 
try it on other hardware?

Original comment by frost.g...@gmail.com on 11 Jun 2013 at 11:19

GoogleCodeExporter commented 9 years ago
Hi,
I looked some more in this issue and created a reference implementation in 
JCuda, whereas I found out that the behaviour is exactly the same. So this 
definitely has nothing to do with Aparapi. I suppose the difference between CPU 
and GPU stems from some little different floating point implementation on GPUs. 
Running several hundred floating point operations, those errors might sum up 
and result in a total error. This is just a suspicion ...
Thanks,
Matthias

Original comment by matthias.klass@gmail.com on 12 Jun 2013 at 9:03

GoogleCodeExporter commented 9 years ago
Ah.  Very interesting, thanks for following up and for reporting back to the 
list. 

I will close this. 

Gary

Original comment by frost.g...@gmail.com on 17 Jun 2013 at 8:44