Is there a limit for number of lines printed to the standard output using printf inside CUDA kernel? If yes, is there a way to change it?
Yes, there is a limit, that limit is described in the documentation.
The output buffer for printf() is set to a fixed size before kernel launch (see Associated Host-Side API). It is circular and if more output is produced during kernel execution than can fit in the buffer, older output is overwritten.
Yes, the limit can be changed as you point out in your comment, that cuda runtime API call is covered in the documentation here.
The following API functions get and set the size of the buffer used to transfer the printf() arguments and internal metadata to the host (default is 1 megabyte):
cudaDeviceGetLimit(size_t* size,cudaLimitPrintfFifoSize)cudaDeviceSetLimit(cudaLimitPrintfFifoSize, size_t size)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With