Is it possible to define a macro with in a macro ? Any trick will do.
I am trying to do quick conversion of cuda program to open mp by defining some macros at the top:
ThanksCode:#define __syncthreads() #pragma omp barrier
Printable View
Is it possible to define a macro with in a macro ? Any trick will do.
I am trying to do quick conversion of cuda program to open mp by defining some macros at the top:
ThanksCode:#define __syncthreads() #pragma omp barrier
See http://msdn.microsoft.com/en-us/library/d9x1s805.aspx
Also note that you should not start names with an underscore, as these are reserved for the compiler.
Thanks I came up with an inline function solution but yours works too.
The __syncthreads with double underscores is defined by the cuda compiler (not from me).Code://inline void l_barrier() {
// #pragma omp barrier
//}
#define l_barrier() { \
__pragma(omp barrier) \
}