cudanvidiacudnncuda-streams

Is it possible to manually set the SMs used for one CUDA stream?


By default, the kernel will use all available SMs of the device (if enough blocks). However, now I have 2 stream with one computational-intense and one memory-intense, and I want to limit the maximal SMs used for 2 stream respectively (after setting the maximal SMs, the kernel in one stream will use up to maximal SMs, like 20SMs for computational-intense and 4SMs for memory-intense), is it possible to do so? (if possible, which API should I use)


Solution

  • In short, no there is no way to do what you envisage.

    The CUDA execution model doesn't provide that sort of granularity, and that isn't an accident. By abstracting that level of scheduling and work distribution away, it means (within reason) any code you can run on the smallest GPU of a given architecture can also run on the largest without any modification. That is important from a portability and interoperability point of view.