Can anyone explain whether opencl1.2 supports double precision? I understand that this is optional for 1.2 . If so how to enable the support?
Yes, OpenCL 1.2 supports double precision. Whether or not your device does is another question.
You can query your device to test this.
Page 39 onwards of the OpenCL 1.2 Specification: www.khronos.org/registry/cl/specs/opencl-1.2.pdf
If double precision is not supported, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return 0.
If double precision is not supported, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE must return 0.
As it says, the device must return zero if the device does not support double precision. Depending on the device you will get a zero or non-zero answer.
The values I get are:
Preferred Double Vector Width 1 // This is HD 7970 GPU
Preferred Double Vector Width 2 // This is Intel Q9450 CPU
indicating both devices support double precision.
I tried to get the info from the device Intel(R) Core(TM)2 Duo CPU E7500 and I got both the values as zero.
So does it mean that the CPU doesn't support double precision. Then how can I use double precision algorithms??
Indeed you can, you should get something like this:
CL_DEVICE_EXTENSIONS: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_atomic_counters_32 cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_popcnt cl_khr_d3d10_sharing cl_khr_dx9_media_sharing
Do we have any other API to read and write data from and to the device other than , clEnqueueReadBuffer and clEnqueueWriteBuffer ?