Is there a way to determine the Grid / Block geometry of the currently executing kernel from within the kernel itself or a function called from within the kernel?
Basically, I would like to do something like:
// If the time series is longer than then number of threads in the
// block, we need to iterate.
unsigned int i = (TS_LENGTH / THREADS_PER_BLOCK) + 1;
while(i) {
unsigned int j = i * threadIdx.x;
if(j < TS_LENGTH) {
sharedReferenceTimeSeries[j] = globalReferenceTimeSeries[j];
}
i--;
}
But determine THREADS_PER_BLOCK dynamically, rather than have it defined as a constant or passed everywhere as a parameter.
Is there a way to determine the Grid / Block geometry of the currently executing kernel from within the kernel itself or a function called from within the kernel?
Basically, I would like to do something like:
// If the time series is longer than then number of threads in the
// block, we need to iterate.
unsigned int i = (TS_LENGTH / THREADS_PER_BLOCK) + 1;
while(i) {
unsigned int j = i * threadIdx.x;
if(j < TS_LENGTH) {
sharedReferenceTimeSeries[j] = globalReferenceTimeSeries[j];
}
i--;
}
But determine THREADS_PER_BLOCK dynamically, rather than have it defined as a constant or passed everywhere as a parameter.