CUDA conditional compile inside host function?

I know that you can perform conditional compiling with CUDA using:

#ifdef __CUDA_ARCH__
  // CUDA code
#else
  // Non-CUDA code
#endif

However, the definition CUDA_ARCH is only available inside device functions. Is there a way to allow conditional condition in host function? Say I have inside my main:

int main() {
  #ifdef __CUDA_ARCH__
     // Launch CUDA kernel to perform calculation
  #else
     // Launch host functions instead (OpenMP or otherwise)
  #endif
}

You’d have to indicate what you want that macro to signify

This may be of interest:

[url]https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-identification-macro[/url]

Right - I should be using NVCC instead. And it works.

Cheers!