cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rick_weber
Adept II

Why isn't printf supported on all GPUs?

According to the OpenCL documentation, cl_amd_printf is supported by Radeon 5000+ cards. When I run my application on my 5870, nothing prints. When I run it on my CPU, it does. This is about what I would expect because GPUs can't access file descriptors to write to the terminal. As such, I think printf() is a nop on the GPU.

However, in the programming guide, it says printf isn't supported on the Radeon 4000 series cards. Why is that if printf doesn't do anything? I suppose you theoretically could do printf on a GPU, writing the string directly to a host buffer from the kernel and then the CPU prints that, but I think ATI hardware has supported writes to host memory since RV600, which wouldn't explain why you can't do it with RV700.

Tags (1)
0 Likes
5 Replies
MicahVillmow
Staff
Staff

Why isn't printf supported on all GPUs?

What you think printf could do on the GPU is exactly how we do it. Printf on 7XX should work as long as you don't write byte/short values, I'll look into why it isn't.
0 Likes
MicahVillmow
Staff
Staff

Why isn't printf supported on all GPUs?

rick.weber,
There should be no issue with printf on 7XX as far as I can tell outside of byte/short. The extension isn't reported because of spec interpretation issues but it can still be used in a kernel.
0 Likes
rick_weber
Adept II

Why isn't printf supported on all GPUs?

In that case, if it helps, I'm using a Radeon 5870 Eyefinity, SDK 2.4, and I can't get even the simplest format strings to print, must less more interesting ones.

Both of the following don't printf anything (but they do increase the runtime) on a Radeon 5870:

printf("%f", (float)peptideLength);

printf("%.*s\n", peptideLength, &curPeptideString[myPeptide * 64 + 1]);

Both strings work correctly on a Nehalem quad core.

0 Likes
MicahVillmow
Staff
Staff

Why isn't printf supported on all GPUs?

rick.weber,
This looks like a bug, I am looking into it.
0 Likes
rick_weber
Adept II

Why isn't printf supported on all GPUs?

If printf works on the GPU, programmability will be increased by two orders of magnitude since you can actually see what's going on inside the damn things.

0 Likes