cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Fuxianjun
Journeyman III

How to use double in kernel function?

I read section 9.3 of OpenCL specification,how can I use double in a kernel function? I tried to add "#pragma OPENCL EXTENSION cl_khr_fp64:enable"on the top of kernel function,but my program failed to compile,what can I do ?
By the way, I used "clGetDeviceInfo" to query"CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE", it returned 0,does it means my GPU support double precision or not ?

0 Likes
6 Replies
omkaranathan
Adept I

Which GPU are you using?

Extensions are supported in 8xx series of GPU's only. Also post the error message you are getting.

0 Likes

How to check my GPU's version ? If my GPU support extension, how can I use parameters of  double precision in kernel function?

0 Likes

query for device name. if it is cypress redwood and not 7xx than you have evergreen family GPU whhich support double.

you can enable it through cl_amd_fp64 but only basic +-*/ operation are support currently on GPU.

http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=88

0 Likes

Thank you very much, it displays?"Intel(R) Core(TM) i5 CPU         750  @ 2.67GHz"?My GPU surely support double. But I don't know how to include the #pragma OPENCL EXTENSION cl_amd_fp64 : enable directive. My kernel is like this, it fail to compile. Could you please tell me where is the grammar error !

#pragma OPENCL EXTENSION cl_amd_fp64 : enable __kernel void FunctionName( __global double* M1, __global double* M2) { // code without error compilation. }

0 Likes

Fuxianjun,
Just query for the list of extensions for a device and search the returned string for fp64. That will let you know if your device supports double precision.
0 Likes

Thank you very much ! My GPU support double extension.

0 Likes