Discussion:
[PyCUDA] Can I use cuPrintf in PyCuda?
金陆
2014-03-16 04:50:30 UTC
Permalink
I am using an old PC with an old GPU card(GeForce 9800 GT).
As you may know, 9800 does not support "printf" function in device code. However, Nvidia supplies cuPrintf. In CU file, it can be used like following. The situation is how can I use "cudaPrintfInit, cudaPrintfDisplay and cudaPrintfEnd" in Python code?
Thanks

[cu starts]
#include "cuPrintf.cu"
__global__ void my_kernel()
{
cuPrintf("x=%u, y=%u, offset=%u\t", x, y, offset);
}

int main()
{
cudaPrintfInit();

my_kernel<<<...>>>();

cudaPrintfDisplay(stdout, true);
cudaPrintfEnd();
}
[cu ends]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140316/ce75e8d0/attachment.html>
Andreas Kloeckner
2014-03-16 17:49:01 UTC
Permalink
Post by 金陆
I am using an old PC with an old GPU card(GeForce 9800 GT).
As you may know, 9800 does not support "printf" function in device code. However, Nvidia supplies cuPrintf. In CU file, it can be used like following. The situation is how can I use "cudaPrintfInit, cudaPrintfDisplay and cudaPrintfEnd" in Python code?
Thanks
[cu starts]
#include "cuPrintf.cu"
__global__ void my_kernel()
{
cuPrintf("x=%u, y=%u, offset=%u\t", x, y, offset);
}
int main()
{
cudaPrintfInit();
my_kernel<<<...>>>();
cudaPrintfDisplay(stdout, true);
cudaPrintfEnd();
}
It looks like cudaPrintf() is a library for the so-called 'runtime'
interface to CUDA. PyCUDA uses what's called the 'driver' interface.
It's not impossible that you'll be able to get this to work, but I'm not
promising it will be easy.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140316/11aa127e/attachment.sig>
Loading...