Is there a way to default execution space to device while compiling with NVCC?

The documentation on NVRTC (1. Introduction — NVRTC 12.8 documentation) mentions:

--device-as-default-execution-space (-default-device)
Treat entities with no execution space annotation as __device__ entities.

Could the same switch be used with NVCC? Can’t get it working there so far.

I want to port a large piece of code as a first draft without GPU-specific optimization and would like to avoid putting __device__ keyword to each and every function. It would be handy if I could just default all not marked functions __device__, this would save a lot of time and keep code cleaner.

There is no corresponding functionality for nvcc, currently, AFAIK. I believe nvc++, the hpc compiler available in the HPC SDK may have functionality like that. You can ask about it on the HPC compilers forum. nvc++ doesn’t have identical behavior to nvcc, so there may be a learning curve, but it can compile CUDA device code.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.