cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
daryan
Visitor
Visitor
4,214 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
ywu
Xilinx Employee
Xilinx Employee
4,204 Views
Registered: ‎11-28-2007

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

 

 

Cheers,
Jim
0 Kudos
sahilg
Xilinx Employee
Xilinx Employee
4,196 Views
Registered: ‎02-06-2013

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 

daryan
Visitor
Visitor
4,073 Views
Registered: ‎10-25-2016

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
daryan
Visitor
Visitor
4,070 Views
Registered: ‎10-25-2016

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
cchuvalas
Observer
Observer
571 Views
Registered: ‎09-12-2018

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?