Results 1 to 5 of 5

Thread: double precision math builtins on OSX

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    3

    double precision math builtins on OSX

    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.

  2. #2
    Member
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    55

    Re: double precision math builtins on OSX

    Can a GT 330M actually do double precision? I didn't think it could.

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    3

    Re: double precision math builtins on OSX

    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!

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: double precision math builtins on OSX

    You should always check which extensions supported using clGetDeviceInfo(CL_DEVICE_EXTENSIONS). In this case you are looking for "cl_khr_fp64".
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    3

    Re: double precision math builtins on OSX

    thanks. checked this out and indeed this device doesn't support double. thanks for the pointers. moving on towards better hardware...

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2010, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •