From 068a79493a9e790ed9e39f0831ee3008ef8ebc31 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Wed, 23 Mar 2016 22:43:10 +0000 Subject: [PATCH] [CUDA] Update docs to reflect that we no longer define __NVCC__. llvm-svn: 264208 --- llvm/docs/CompileCudaWithLLVM.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/docs/CompileCudaWithLLVM.rst b/llvm/docs/CompileCudaWithLLVM.rst index bb1ce04..8e7ed0d 100644 --- a/llvm/docs/CompileCudaWithLLVM.rst +++ b/llvm/docs/CompileCudaWithLLVM.rst @@ -125,10 +125,9 @@ Detecting clang vs NVCC Although clang's CUDA implementation is largely compatible with NVCC's, you may still want to detect when you're compiling CUDA code specifically with clang. -This is tricky, because clang defines the ``__NVCC__`` macro, and because NVCC -may invoke clang as part of its own compilation process! For example, NVCC -uses the host compiler's preprocessor when compiling for device code, and that -host compiler may in fact be clang. +This is tricky, because NVCC may invoke clang as part of its own compilation +process! For example, NVCC uses the host compiler's preprocessor when +compiling for device code, and that host compiler may in fact be clang. When clang is actually compiling CUDA code -- rather than being used as a subtool of NVCC's -- it defines the ``__CUDA__`` macro. ``__CUDA_ARCH__`` is @@ -146,6 +145,8 @@ compilation, in host and device modes: // clang compiling CUDA code, device mode. #endif +Both clang and nvcc define ``__CUDACC__`` during CUDA compilation. You can +detect NVCC specifically by looking for ``__NVCC__``. Optimizations ============= -- 2.7.4