JCuda and cuPrintf

Hi all,

I was just wondering how to implement cuPrintf with JCuda…

I searched already on this forum, on the documentation and on google, but I didnt found anything

Any tip?


Unfortunately, it is not possible to use the cuPrintf helper with JCuda. The cuPrintf functionality relies on the existence of a single executable: It adds some global buffers, and “routes” the outputs of all printf calls to these buffers, which explicitly have to be intialized and flushed/printed afterwards using additional runtime API calls.

It might be possible to add a similar functionality in the native JCuda libraries, but at the moment, I have no idea whether (or even how) this might work - I’d have to look at and understand the details of the cuPrintf implementation (and this is quite complex).

At least, with devices with Compute Capability >= 2.0, it should be possible to use the “native” printf function. Although I could not yet test it myself, someone reported that it should be working in this thread.


Thanks Marco, you confirmed what I was afraid of :stuck_out_tongue:

However I am happy to know that there is a possibility on the 2.x devices (at the moment I am working on 1.1 and 1.3 but a 560 Ti 2.1 should come in the future ^^)