CUDA's printf()
in kernels prints to the standard output stream of my process. Now, I want to, at the least, redirect this printout to an arbitrary output stream , from here on. I do mean an arbitrary stream, that is not just a file descriptor (as is requested here) - I want to be able to use stringstreams, logging infrastructure etc.
If that's possible, what I would really like to be able to do something like tell a single kernel send its printf()
output to some output stream. Is this possible?
Note: To the two kind souls which marked this a favorite question of theirs - how come you like my question enough to make it a favorite, but not enough to upvote it? < puzzled. >
To the best of my knowledge, this isn't possible. The CUDA API doesn't provide any control over the IO stream to which the output will be emitted.
If you want something more elaborate than the facilities provided by the runtime, then your best solution is to roll your own. Before runtime support for in-kernel printf was added to CUDA, NVIDIA shipped (at least to developers) a utility called cuprintf which allowed kernels to emit output to the host console. My suggestion would be to grab the code for cuprintf and hack into doing what you are looking for.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments