Results 1 to 3 of 3

Thread: external function?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    2

    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

    Thanks!

    -John

  2. #2
    Junior Member
    Join Date
    Apr 2010
    Posts
    2

    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 ));

    Cheers,

    John

  3. #3
    Senior Member
    Join Date
    Sep 2002
    Location
    Santa Clara
    Posts
    105

    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. Replies: 5
    Last Post: 05-29-2012, 06:30 PM
  2. Replies: 0
    Last Post: 01-01-1970, 12:00 AM

Posting Permissions

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