compile prob: ext. func __sind can't be found (NO doubles!)

Hiya folks! [Mac OS 10.6.6, Xcode 3.2]

The current error: “kernel referenced an external function __sind, that could not be found.”

Compiling my first kernel; I had trouble with calling sin(x). Kept getting “more than one matching function found in __builtin_overload”. [btw, that complaint occured in those places where I was calling sin(x+PIx2)].

Attempted using native_sin(x). Forget what the error combo was there.

In any case, there are NO DOUBLES anywhere in my kernel, nor its header file. There should be no attempt to call __sind, which I think is a double-precision sine (I am on a MacBook Pro with the 330M, so I don’t have double precision on my gpu).

I even replace all calls to “sin” with calls to “syn”, which I #defined to redirect to a quadratic sine approximation function – so, NO calls to sine anywhere in my code. Still get the same error as at the top.

Thought, “perhaps the cosines are getting translated into sine calls”, and whacked all my calls to “cos”, replacing them with an approximation function.

There are NO DOUBLES ANYWHERE in my code. The OpenCL specification itself tells me to use sin(x) for floats!!! It tells me also that native_sin(x) works on floats!!!

Hellllllppppppp…
(I don’t understand why searching for this error didn’t turn up hundreds of hits with a simple fix. there must be one, or else the whole thing’s broken, or else nobody out there has tried using a sine under this circumstance?..)

OH!, p.s. a bonus one which is likely to be related:
I’ve also seen at times that the external function fabs can’t be found.
However, if I add my own macro for fabs, it complains that I’m redefining a macro…

No bites, huh? Maybe this is too simple, or too complex. Here is some further information I prepared earlier when I was out of wi-fi range. As you can see, it seems now like a linking problem.

  1. As implied above, I can comment out enough of my kernel to get the __sind error to go away (of course I had already eliminated sin and cos calls before then).
    That is when I get the error that it can’t find the external function fabs.
    If I then #define fabs(a) (a>0?a:-a), I get “warning: ‘fabs’ macro redefined”.
    If I then do #ifdef fabs … #undef fabs … #define fabs(a) … #endif, it is then happy with fabs and gives me “external function strlen could not be found”.

  2. I did at one point get CLH_ERROR_NO_BINARY_FOR_GPU.

  3. Galaxies and Grass both run on my system, and my project settings are copied from those. Also, I have another kernel inside my project, modeled from some example code, which runs just fine. The management code for my own kernel was copied from that kernel’s management code. So, my system, environment, and settings should be fine….

  4. With everything commented out except for the initial get_local_id calls, it does build and execute, but lacks needed functionality. :roll:

Ok well.

I’m past the above-described point now, and may if necessary start another thread on the main heterogenous OpenCL forum.

For those of you who may be interested, I did find one call to “sin” in my 1200+ lines of kernel code which gave the __sind error. I’d missed it because of a space between the name and the open-paren following. I still don’t think I’m linking correctly, as I had to write substitute estimators for sine and cosine, and had to provide my own fabs (these are all in the opencl spec.) Still have no substitute for “log” and “log10”, although I can do without that functionality for now.

My problem now is the dreaded NO_BINARY_FOR_GPU error from the ptx builder. SO, my code compiles to the IR and then NVidia can’t handle it.

Oh well. I’ll figure this out. Even if my kernel is too complex for OpenCL, and I can’t do the job with $5000 worth of hardware … well, then, I’ll just get 5 12-core mac pros and use XGrid (nono, not XGrid, dangit, I’d write my own job-sharing code, much simpler). Should be enough power with GCD. I’d rather not have to do that!!! … but, gotta get this done.

My many thanks go to those of you who have viewed this thread and would have offered advice if they could have!!! Frankly, It’s best for me to figure this out without any help from a discussion forum – I’ve built this project so far, over 25 years, without any interactive help, and why spoil that record so close to its culmination? (Sample code from the internet has of course been helpful, as has reading over other folks’ discussions.)

Bon Appétit!
Dave

Without seeing your kernel code, there’s only so much we can do to help you. Also, some of us do not frequent these forums every day, so give us a bit of time to look over and come up with a solution. Also, many of us don’t use Mac’s with XCode, so there’s only so much we can help with your linking issues.

Right off the back, it does sound like a linking issue. Have you tried the Mac developers forums? Have you double and triple-checked your forums, headers, etc? On all of my machines (linux and windows), I’ve never had a problem with sin or sind or any of the log functions not being defined. I have read on these forums problems with XCode linking.

viewtopic.php?f=28&t=3150&p=10134&hilit=XCode#p10134

Also, double-check the nvidia forums, since you have an nvidia graphics card on your computer, it sounds like.