I have a kernel function that should execute many (hundreds of thousands) times with exactly the same values of its arguments, using the driver API.
Do I need to set the parameter stack of the kernel before each invocation, or could it be done only once, before the first invocation of the kernel?
I’d expect them not to change, but you should just write a test and see it yourself. Anyway, you can always keep your parameters in constant memory, which is preserved across kernel executions.
Sergey, thank you for your remarks!
Well, some quick testing has been done, and the kernel calls still work with the parameters set only once.
I’m just curious whether this happens by chance (i.e. it can be quietly changed in the future CUDA releases) or by design.
Unfortunately, no significant gains in the overall execution time could be seen.
Good point! I haven’t tried this yet, but I certainly will when I find some time.
Regarding that, am I wrong in presuming that the constant memory cache is spilt after a kernel is terminated?
I don’t know if it is spilt or not, but since the time to fill it again is negligible comparing to everything else when you launch a new kernel, you probably shouldn’t bother too much about that.
Sergey, thanks again for the constant memory hint!
I tried it and it works well, saving me more than a minute of the execution time.