HPCE / hpce-2017-cw5

1 stars 6 forks source link

OS X opencl kernel run time compile errors not being thrown #41

Open adityarajagopal opened 6 years ago

adityarajagopal commented 6 years ago

Has anybody had the issue on an os x machine where the open cl compiler doesn't throw compiler errors when an incorrect kernel is passed in? Right now I can change the kernel to be completely incorrect (for instance not declaring a variable that's used) and running it doesn't throw any compiler errors and the program runs incorrectly.

I've tried changing the kernel to one that I know before hand is correct and running it and the program executes as expected, which should mean that the kernel is being read and compiled.

kgiray commented 6 years ago

I had the same problem as well, maybe compiling the OpenCL before hand might help.

adityarajagopal commented 6 years ago

So the issue was the the program.build was in a try catch block, but even though I had #define __CL_ENABLE_EXCEPTIONS defined, the cl.hpp file sees to not be reading this and enabling the throwing of cl::Error. So I just moved the build log descriptions out of the catch and for now am using that as a temporary fix. So I can now see the errors if they are being thrown.

I'm still not sure why the cl.hpp isn't recognising the #define though

m8pple commented 6 years ago

Hrmm, it may be something else is #include-ing it before your #define? If you're doing it inside the file, you could try moving it outside to -D__CL_ENABLE_EXCEPTIONS=1 in the makefile?

Sometimes the thing to do is just to copy a header wholesale, give it a different name and change the #ifndef header_h names at the top, then #include that instead. That way you can force a known file to be included, and if you see multiple symbol definition errors it will lead you to the chain of #includes that is bringing in the header via a different route.