Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limitation of CUDA printf

Tags:

printf

cuda

limit

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?

like image 563
Jindřich Žižka Avatar asked Oct 18 '25 22:10

Jindřich Žižka


1 Answers

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)

like image 103
Robert Crovella Avatar answered Oct 22 '25 07:10

Robert Crovella