occa
occa copied to clipboard
Use compiler-defined macros in the preprocessor
Would it be possible to keep these directives down to the kernel? just asking
There only directives that will live through the preprocessing stage are:
#pragma occa @...
as attributes, or regular pragmas
#pragma ...
Is that what you're looking for?
hum, I was more thinking of http://en.cppreference.com/w/c/preprocessor/conditional
Oh, the preprocessor handles them since they are in the source code. Is there a reason to keep them around?
Well, even if they are in the OKL source code, if I do something like:
#ifdef __NVCC__ {CUDA debug stuff} #else {other host debug} #endif
then the parser only selects the {other host debug}
statements.
Oh, I'm planning on picking up the compiler defines. I have a TODO in the preprocessor constructor to remind me
https://github.com/libocca/occa/blob/master/parser_sandbox/src/preprocessor.cpp#L46
In f9f433f968d1602bfc7eca9d9926a8f5651139d5
#pragma occa @tile(16, @Inner, @outer)
for (int i = 0; i < N; ++i) {
}
↓
for (int i = 0; i < N; ++i; @tile(16, @inner, @outer)) {
}
Still missing compiler-dependent defines, like __NVCC__