Reputation: 4585
The CUDA programming guide v 5.5 on page no. 117 mentions that the string passed to the printf used in a kernel is output to a stream on the host. My doubt is why it is required to pass this to host? will it not be better to directly send the output to the display device since the Graphics Card is directly connected to the display device? why unnecessarily go to host, then again send it back to the Graphics card for displaying on the monitor?
Upvotes: 0
Views: 467
Reputation: 152173
What if the graphics card is not hosting the display?
What if you have 4 GPUs in the system?
Anyway, device printf
coordinates with the operating system to send the output into the same queue as host printf
, according to the operating system's rules for console output. This allows you to do things like redirect the standard output to a file, for example.
You can't manage this by simply jamming some data somewhere on the GPU.
Presumably your question is motivated out of a concern for perfomance, and device printf
is not intended to be a high performance output path.
Upvotes: 3