using printf in the .cl file

Hi everyone,

I’d like to use

printf("test
")

Unfortunately, I get the following mistake:



ptxas application ptx input, line 43; error   : Call has wrong number of parameters
ptxas fatal   : Ptx assembly aborted due to errors


Has anyone any idea about where does that mistake comes from?

Regards,

Elrachal

Hi,

printf() is not a standard openCL function. Then it depends on wich implementation you are using. I have no problem using it with Intel.

I you are using AMD SDK perhaps you could try to put this line into your kernel file:

#pragma OPENCL EXTENSION cl_amd_printf

I’m using Nvidia,

Does something like this exists on Nvidia?

No, NVIDIA does not expose a printf extension in OpenCL, even though its Fermi (and higher) cards actually support it. Complain to NVIDIA about it.

Or wait for them to release some OpenCl 1.2 compliant drivers :stuck_out_tongue:

I doubt they’ll ever think about doing that, unless a sizeable number of users complain about the lack of support and possibly threatens to switch to the competition.

Hi, i got the ptxas: Call has wrong number of parameters

I believe that it has to do compiling inline functions, after i transformed some of them to macros the error disappeared. My problem wasn’t related to printf at all, but i’m posting maybe somebody finds it useful.
I join too the group of enthusiasts hoping Nvidia will continue support OpenCL.