There are two separate bugs in the latest version of cuPrintf.cu from the SDK example simplePrintf.
psr posted the first bug fix here:
Without this bug fix (on older hardware) the cuPrintf capability can only be used if the kernel is invoked only once.
The second bug fix is near line 825 and involves the proper management of the circular buffer pointers so that cuPrintf will return to the start of the buffer once it’s reached the end.
Without this fix. one eventually uses up the buffer (default size is one meg).
Here are the two fixes:
[font=“Courier New”]— …/simplePrintf/cuPrintf.cu 2011-06-17 16:15:34.504529595 -0400
+++ …/simplePrintf_new/cuPrintf.cu 2011-06-17 16:20:26.774958266 -0400
@@ -762,7 +762,7 @@
// first short from the buffer - it’ll be the magic number
// relating to the version.
unsigned short magic;
- cudaMemcpy(&magic, printfbuf_device, sizeof(unsigned short), cudaMemcpyDeviceToHost);
cudaMemcpy(&magic, printfbuf_start, sizeof(unsigned short), cudaMemcpyDeviceToHost);
// For SM_10 architecture, we’ve split our buffer into one-per-thread.
// That means we must do each thread block separately. It’ll require
@@ -825,7 +825,7 @@
doPrintfDisplay(showThreadID, clearOnPrint, printfbuf_device, printfbuf_device+printfbuf_len, endptr, printfbuf_device+printfbuf_len);
doPrintfDisplay(showThreadID, clearOnPrint, printfbuf_device, printfbuf_device+printfbuf_len, bufptr, endptr);
- printfbuf_start = printfbuf_end;
- printfbuf_start = endptr;
;//printf(“Bad magic number in cuPrintf buffer header\n”);
My thanks again to psr for pointing out the first bug.