![]() |
|
|
#1 |
|
∂2ω=0
Sep 2002
República de California
2×32×647 Posts |
Is there a way to get nvcc to dump all its internally defined compile-time macros? The nVidia docs typically mention just one, __CUDA_ARCH__ .
For example, I need a way to differentiate nvcc from gcc in my platform-identifying headers - right now nvcc trips the "compiler = gcc" #ifdefs. I need to tweak these to first look for nvcc-specific compiler-ID macros before testing for the gcc ones. Under gcc I can dump macros using gcc -dM -E - < /dev/null but nvcc doesn't recognize that: nvcc fatal : Unknown option 'dM' Last fiddled with by ewmayer on 2013-10-11 at 01:33 |
|
|
|
|
|
#2 |
|
Tribal Bullet
Oct 2004
3·1,181 Posts |
__CUDA_ARCH__ only appears in device code, and is used to select device-specific code generation. nvcc predefines __CUDACC__ in host code as an indication that you're compiling with nvcc.
To pass compiler option Q through nvcc to gcc, pass '-Xcompiler Q' to nvcc. |
|
|
|
|
|
#3 | ||
|
∂2ω=0
Sep 2002
República de California
2·32·647 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#4 |
|
Mar 2006
1DF16 Posts |
I'm not sure if this is very elegant, or if it will work across all versions of nvcc, but I just ran:
strings nvcc | grep [-]D And that produced the following output on my (linux) machine: Code:
-DFATBINFILE="\" -D__USE_FAST_MATH__ -D__CUDACC__ -D__NVCC__ -D__CUDABE__ -D__CUDANVVM__ -DREGISTERLINKBINARYFILE="\" -D__CUDA_PREC_SQRT -D__CUDA_PREC_DIV -D__CUDA_FTZ -DLL -D__CUDA_ARCH__=100 -D__CUDA_ARCH__=110 -D__CUDA_ARCH__=120 -D__CUDA_ARCH__=130 -D__CUDA_ARCH__=200 -D__CUDA_ARCH__=210 -D__CUDA_ARCH__=300 -D__CUDA_ARCH__=350 -DCUDA_DOUBLE_MATH_FUNCTIONS -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -DCUDA_DOUBLE_MATH_FUNCTIONS -DCUDA_DOUBLE_MATH_FUNCTIONS -DCUDA_DOUBLE_MATH_FUNCTIONS |
|
|
|
|
|
#5 |
|
∂2ω=0
Sep 2002
República de California
2·32·647 Posts |
Yes, that looks to be along the lines of what I was asking for - just by way of a spot-check, I see 2 distinct nVidia-compiler strings, __CUDACC__ (as noted by Jason) and also __NVCC__ . I wonder if those are entirely interchangeable, or perhaps nVidia is allowing for future differentiation of some kind there.
There are multiple __CUDA_ARCH__ in the list, which it seems represents all the ones this version of the compiler recognizes. Just out of curiosity, which one actually corresponds to the compute capacity of your GPU? |
|
|
|
|
|
#6 | |
|
"Oliver"
Mar 2005
Germany
11·101 Posts |
Quote:
Oliver |
|
|
|
|
|
|
#7 | |
|
∂2ω=0
Sep 2002
República de California
2×32×647 Posts |
Quote:
|
|
|
|
|
|
|
#8 |
|
"Oliver"
Mar 2005
Germany
11×101 Posts |
|
|
|
|
|
|
#9 |
|
Mar 2006
1110111112 Posts |
Well, my computer has a GTX570 and I'm running the 310.19 nVidia driver. If I'm reading the docs right, it looks like that card supports up to CC2.0. I'm not doing too much in the way of GPU-hardware work. My primary use of it so far was to do polynomial selection with msieve on this and on a GTX580 in another machine. The poly search finished a while ago and now I'm doing lots of ggnfs sieving.
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GCC/compiler warnings | Dubslow | Programming | 2 | 2016-02-27 06:55 |
| GNU specific macros | R.D. Silverman | Programming | 17 | 2015-09-29 03:44 |
| macros in nasm | tichy | Programming | 1 | 2011-03-06 16:24 |
| Help! Compiler bug | R.D. Silverman | Cunningham Tables | 30 | 2010-10-02 22:12 |
| Linux32 -> Windows64 C compiler? | geoff | Programming | 3 | 2007-09-26 03:09 |