Hi all,
I am confused about the allocation of blocks and grids. As I know, we could have 512 threads per block. Does this depends on GPU type? What is the maximum number of blocks we could use in a grid? And how many grids totally?
If I have 1000 threads to run, and I would like to assign a 1D block. Is this what I should do?
int BLOCK_SIZE=512;
int l = 1000;
dim3 dimBlock(BLOCK_SIZE);
dim3 dimGrid(l/BLOCK_SIZE);
I saw another post in this forum. One has 2048 threads to run. He said he would like to run all these in 1 grid, which has 4 blocks. The following is how he did:
char host_buf[2048] = { '
char host_buf[2048] = { ’
char host_buf[2048] = { '
char host_buf[2048] = { ’
char host_buf[2048] = { '
char host_buf[2048] = { ’
char host_buf[2048] = { '
char host_buf[2048] = { ‘\0’ };
…
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
' };
......
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
’ };
…
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
' };
......
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
’ };
…
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
' };
......
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
’ };
…
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
' };
......
dim3 dimBlock( sizeof(host_buf) );
dim3 dimGrid(1);
I thought we can only use up to 512 as the parameter value of dimBlock.
Could someone explain this to me?
Appreciate.