I am developing OpenCL code on Snow Leopard and understand that the OpenCL just-in-time compilation is done by Clang/LLVM. Is the C preprocessor used at all? Is there a way to set preprocessing definitions with the compiler? What definitions exist?
I would like the code to be aware of whether it is compiled for CPU or GPU so I for instance can use printf statements for debugging.
the clBuildProgram API takes compiler arguments (the const char * options parameter).
-D MYMACRO is understood, so is -D MYMACRO=value.
As to what predefined macros, see the OpenCL specification for a full list (Section 6.9). A non exhaustive list:
__FILE____LINE____OPENCL_VERSION__If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With