Results 1 to 3 of 3

Thread: external function?

  1. #1
    Junior Member
    Join Date
    Apr 2010

    external function?

    I am consistently getting this error while trying to build from source on NVIDIA GPUs. It built fine on CPU though, haven't tried other devices yet:
    kernel referenced an external function exp, that could not be found.
    This is the line in my .cl source that uses exp
    Code :
    rc_n2o5 = 1./ ( 3.6e4 * exp( -pow((rh/0.28),2.8) + 300. ));

    What else could have gone wrong? I'm pretty sure exp is in the spec



  2. #2
    Junior Member
    Join Date
    Apr 2010

    Re: external function?

    ok... i replaced my code with the following line and it works now. But shouldn't it work without the casts? Sorry I'm still relatively new to OpenCL C

    Code :
    rc_n2o5 = 1./ ( 3.6e4 * exp( -pow((float)(rh/0.28),2.8f) + 300.f ));



  3. #3
    Senior Member
    Join Date
    Sep 2002
    Santa Clara

    Re: external function?

    -pow((rh/0.2,2. + 300.

    These are using double precision values for 0.28, 2.8 and 300. Double precision is only enabled if the cl_khr_fp64 extension is supported by the implementation and including a #pragma cl_khr_fp64 : enable in your kernel source. The change you made to append "f" or cast to a float was the right thing to do. On HW that does support double precision, you would have called a double precision pow which may be slower than single precision pow.

Similar Threads

  1. unresolved external symbol clIcdGetPlatformIDsKHR...
    By sean.settle in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 5
    Last Post: 05-29-2012, 06:30 PM
  2. how to add the external library into bellagio framework.
    By openmaxqq in forum OpenMAX IL - Discussion and questions about OpenMAX IL interface
    Replies: 0
    Last Post: 12-31-1969, 04:00 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