1

I am new to cuda programming. I am working on Kepler GPU which has

3.2 compute_capability 
1024  max_threads_per_block 
1 Multiprocessor 
2048 max._threads per_Multiprocessor 
2147483647 grid size

Does this mean that I can only assign 2048 for a kernel ?. Then what to do with that large grid size?

My application includes some large no of matrix calculations.

talonmies
  • 70,661
  • 34
  • 192
  • 269
user8462
  • 11
  • 1
  • 2

1 Answers1

3

You'll need to learn more about CUDA programming.

You can have more than 1024 or 2048 threads in a kernel (i.e. a grid).

The limit of 1024 is the per-block limit. The 2048 number is something you don't need to focus on too much if you are a beginner.

In the kernel launch:

mykernel<<<A,B>>>(...);

The B parameter is the threads per block. It is limited to 1024.

The A parameter is blocks per grid. It is limited to 2^31-1 (for the x dimension on a Kepler GPU). So you could in theory launch (2^31-1)*1024 threads in a one-dimensional grid, on a cc3.x device.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • Thank you for your answer.I thought since the GPU has only one SM , SM can have max 2048 threads, max thread for a kernel will be 2048 – user8462 Apr 30 '15 at 15:28
  • 4
    Even if the GPU has only 1 SM, you can launch a kernel that contains many blocks, and those blocks will cycle through that SM as space and resources permit. The 2048 number gives you an idea of how many threads (maximum) can be handled by the SM *at any given instant*, i.e. concurrently. But as threadblocks complete their work, they will "exit" the SM and new threadblocks can begin running. – Robert Crovella Apr 30 '15 at 15:31
  • So as GPU works on SIMT , that does not mean all the threads have to occupy the SM at sametime. Thanks again. – user8462 Apr 30 '15 at 15:41
  • 3
    @user8462 - This has nothing to do with SIMT. You _really_ need to read documentation, or this misunderstanding will be the least of troubles you'll face in your CUDA programming. – void_ptr Apr 30 '15 at 16:56