View Full Version : double precision math builtins on OSX

05-01-2011, 02:38 PM
I am trying to use math builtin functions (exp, cos) with double precision on OSX (macbook pro, nvidia GT 330M). My sample code looks like

#pragma OPENCL EXTENSION cl_khr_fp64 : enable
__kernel void g(
__global double* input,
__global double* output,
const unsigned int count)
int i = get_global_id(0);
if(i < count) {
output[i] = exp(.1*input[i]);

i get a failure when trying to build the opencl executable with a message like:

error: more than one matching function found in __builtin_overload
output[i] = exp((.1*input[i]));

i have tried exp, native_exp, and have also tried various typecastings as was suggested on some other posts. it seems like i am not giving the compiler enough info to pick out the double precision routine? i am able to make this all work using float, but need to move to double.

any ideas? thanks.

05-02-2011, 09:34 AM
Can a GT 330M actually do double precision? I didn't think it could.

05-02-2011, 09:51 AM
ah...you may well be right...http://en.wikipedia.org/wiki/CUDA seems to support this.

appreciate the quick response, i don't need to beat my head against this if it is never going to work!

05-02-2011, 03:30 PM
You should always check which extensions supported using clGetDeviceInfo(CL_DEVICE_EXTENSIONS). In this case you are looking for "cl_khr_fp64".

05-02-2011, 03:33 PM
thanks. checked this out and indeed this device doesn't support double. thanks for the pointers. moving on towards better hardware...