ThreadDim

Hey everyone,

I’m trying to write code to act on a 2D sheet with different boundary conditions at each edge. In order to do this, I’d like to access the maximum+minimum size of each block + thread. In the main code I have

int numBlocks;
int numThreadsPerBlock;

and

dim3 dimGrid(numBlocks);
dim3 dimBlock(numThreadsPerBlock);

and then a kernel

calc_V<<< dimGrid, dimBlock>>>(d_V, d_dVdT);

Inside this kernel, I can find the minmums, where threadIdx and blockIdx ==0, and the maximum where blockIdx = blockDim, however threadDim is undefined.

I have seen information that claims threadDim does not exist, however earlier presentations such as [url=“CNRGlab @ UWaterloo”]CNRGlab @ UWaterloo - page ten. claim that it does exist.

Has the variable changed names at some point? Does it still exist? Is there an easy way to find the maximum number of threads?

Cheers,

Epi.

Afaik, there is no threadDim variable, and never has been. blockDim describes the size(s) of a thread block (aka CTA) and gridDim describes the size(s) of the totality of your threads (measured in blocks).

Afaik, there is no threadDim variable, and never has been. blockDim describes the size(s) of a thread block (aka CTA) and gridDim describes the size(s) of the totality of your threads (measured in blocks).

Are you looking for the [font=“Courier New”]gridDim[/font] built-in variable?

Are you looking for the [font=“Courier New”]gridDim[/font] built-in variable?

GridDim sounds like exactly what I’m looking for! I have no idea why the lectures I was reading referred to it as threadDim. I’ll try that out now, thanks a lot.

GridDim sounds like exactly what I’m looking for! I have no idea why the lectures I was reading referred to it as threadDim. I’ll try that out now, thanks a lot.