OpenCL double precision different from CPU double precision

人走茶凉 提交于 2019-12-05 03:50:41

This is somewhat expected behavior, actually.

On older x86 CPUs, floating point numbers are 80bits long (Intel's "long double"), and truncated to 64bit only when need be. When SIMD units/instructions for floating point arithmetics arrived for x86 CPUs, floating point double precision became 64bit by default; however, 80bit is still possible, depending on your compiler settings. There's a lot to read about this out there: Wikipedia: Floating Point.

Check your compiler settings for OpenCL and host code on floating point "magic tricks", to get better agreement of your results. Calculate the absolute and relative error of your values and check if this error margin is safe for your application.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!