user3813674
user3813674

Reputation: 2683

Accessing CUDA built-in variable in child kernel

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?

Upvotes: 0

Views: 166

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151859

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.

Upvotes: 3

Related Questions