redirect printf to file Is it possible within a kernel?

Instead of having my threads write to the console window, is there a way to have them write to file?

I normally use:


fp=freopen("c:\Text.txt", "w" ,stdout);

And that directs all my printfs to file while on the host, but any printf call I make while in a kernel just gets lost; it doesn’t get output to the console or to the file.

I couldn’t find anything in the programming guide or the reference guide…

Any ideas?


(GTX 480, SDK 3.1, XPx64)

No I/O of any kind is possible in a kernel which runs on a device (as opposed to emulation mode).

Get with the times, real device-side printf exists in 3.1. :)

There’s currently no way to redirect the output, though.

Thanks guys. Yep, It’s new with the 3.1.

From the Program Guide (3.1beta)

Guess I’ll wait for 3.2 for the redirect ability :D

Mea Cupla. Trying to finish my habilitation monograph at the moment and not coding much beyond python for making figures. Haven’t even looked at the 3.1 beta, beyond installing it at the same time I got my Fermi hardware (half of which is still in the box)…

I haven’t used 3.1’s printf, but with the cuPrintf library its pretty simple to use an stream different to stdout AFAIK…

Stone age debugging goes GPU, oh no :)