View Full Version : How can I simulate double precision?
I'm solving a problem that uses double precision on C++, but double precision is not supported by all hardware, specially the hardware I'm currently working on. In that case, how can I simulate the double precision I need on OpenCL? I've looked ate those float4, etc, but haven't figured out if they may be useful for what I need.
Can anyone one give a clue about it, and possibly indicate me some code to look at?
05-28-2010, 06:09 AM
See section 9.3 of the specification document... basically put the macro #pragma OPENCL EXTENSION cl_khr_fp64: enable and then normally, declare as cl_double, cl_double2, ... remember that they are too slow in comparison with float and half, so limit yourself to the use of it!
05-28-2010, 08:11 AM
#pragma OPENCL EXTENSION cl_khr_fp64 : enable is used to enable the double precision extension in your OpenCL program. However, it can only be enabled if this extension is supported by the OpenCL implementation. This is not the way to emulate double precision floating-point arithmetic.
You will need to write code to emulate DP basic operations.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.