0

I'm trying to use Kepler's Dynamic Parallelism for one of my application. The global index of the thread (in the parent kernel) launching the child kernel is needed in the child kernel. In other words, I want to access the parent's built-in coordinate variables in the child kernel.

Is there a canonical way to do that? Or should I just calculate global index of the parent thread (using built-in variables such as threadIdx.x, etc) and pass it in through one argument of the child kernel?

user3813674
  • 2,553
  • 2
  • 15
  • 26

1 Answers1

3

Pass it from the parent kernel to the child kernel via kernel parameter.

There is no way to access the parent's built-in thread variables (e.g. threadIdx.x, blockIdx.x, etc.) in the child kernel.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • 1
    Beat me to it. Passing the threadIdx and blockIdx dim3 structures by value is the simplest way, I think – talonmies Sep 02 '15 at 15:12