|
-
February 26th, 2012, 04:25 PM
#1
macro with in a macro
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:
Code:
#define __syncthreads() #pragma omp barrier
Thanks
-
February 26th, 2012, 06:38 PM
#2
Re: macro with in a macro
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.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
February 26th, 2012, 07:56 PM
#3
Re: macro with in a macro
Thanks I came up with an inline function solution but yours works too.
Code:
//inline void l_barrier() {
// #pragma omp barrier
//}
#define l_barrier() { \
__pragma(omp barrier) \
}
The __syncthreads with double underscores is defined by the cuda compiler (not from me).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|