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?
Under Windows CUDA uses the standard handle, which is active, when the context is first initialized.
You can
Just be careful that the CUDA command is really the first one for the process.
I believe that it works similarly under Linux (probably by using the two-argument dup2 to redirect stdout).