cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
3,978 Views
Registered: ‎10-25-2016

Printf not working with OpenCL

Hello,

 

I want see the data that a kernel reads from global memory. To do this, i simply have a loop that prints the elements of the matrix that is read from memory (it's a matrix of floats). The CPU emulation works fine, but when i execute the kernel in the fpga, it seems like it ignores the printf, there's no output, but the kernel executes without errors (with bad results, that's why i want the printf). ¿What's happening?

 

Thanks

0 Kudos
5 Replies
Highlighted
Xilinx Employee
Xilinx Employee
3,968 Views
Registered: ‎11-28-2007

Re: Printf not working with OpenCL

How many elements are your trying to print? Can you attach your host code and kernel?

 

 

Cheers,
Jim
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
3,960 Views
Registered: ‎02-06-2013

Re: Printf not working with OpenCL

Hi,

 

You can try Hardware Emulation flow. You will see the same behaviour as on fpga (bad results) but with printf statements. It will be quick to iterate using this flow.

 

Thanks,
Sahil 

Highlighted
Visitor
Visitor
3,837 Views
Registered: ‎10-25-2016

Re: Printf not working with OpenCL

Hello,

 

I don't have the code at this moment, but it's very similar to the kernel I attached to the other reply I made to you in post "FPGA compilation not working like cpu simulation", but without pipes, only a single kernel.

 

I only put 3 loops, printing matrix Asub after reading it from global memory, Bsub also after reading it from global memory and acc after multiplying, before writing to global memory. The matrix size was 128*128, but every work-item only multiplied blocks of 32*32 elements, so it was 32*32*3 prints, maybe too much.

 

Thanks,

Juan Miguel

0 Kudos
Highlighted
Visitor
Visitor
3,834 Views
Registered: ‎10-25-2016

Re: Printf not working with OpenCL

Hi,

 

I tried  hardware emulation many times, but it doesn't work. When it's creating the program (clCreateProgramWIthBinary) it gives the next error: 

simulate_sysemulation.sh: line 4: 172819 Segmentation fault      (core dumped) "$@"

 

And the simulation freezes, forcing me to cancel execution.

 

Thanks,

Juan Miguel

0 Kudos
Highlighted
Observer
Observer
335 Views
Registered: ‎09-12-2018

Re: Printf not working with OpenCL

I am facing similar odd behavior with hardware emulation. In hardware emulation, I get weird reprints of the same value and odd jumps in the count.

I'm trying to print the address in a Bram block and the data(integer) at that location. 4096 print outs.

Additionally, it works in software emulation, but not hardware emulation. Could this really be cause by the printf statement? If so, how can the hardware emulation be debugged?