UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor luckyxiuxiu
Visitor
3,660 Views
Registered: ‎08-18-2015

Debug in SDAccel

Jump to solution

There is a little information about Application Debug in the SDAccel Environment in the SDAccel_User_Guide.I‘m doing some sw_emu in SDAccel,the program runs,but with a wrong result.CPU prepares the right initial data,but when trans to the FPGA,data goes wrong.(DATA are 100 structures in a vector).I want to know how to debug the program in GUI mode and cmd line with Gdb,please give me some help,thx

0 Kudos
1 Solution

Accepted Solutions
Explorer
Explorer
6,182 Views
Registered: ‎06-17-2012

Re: Debug in SDAccel

Jump to solution

I mean the host.cpp code not the debug information.

 

Anyay, you may also use xcl_memcpy_to_device() instead of the object copy function.

Which should be easier to make it work.

 

There is also a custom data structure example in the sdaccel github example.

it is located at /kernel_to_gmem/custom_datatype_ocl

Check it and see if it helps.

 

View solution in original post

7 Replies
Explorer
Explorer
3,652 Views
Registered: ‎06-17-2012

Re: Debug in SDAccel

Jump to solution

I am not expert on sdaccel either, but would like to share with my limited experience.

You can do sw_emu, hw_emu and hw in SDAccel. Make sure sw_emu mode works first.

In sw_emu, you can use gdb following the guide below.

Also note that printf is helpful particularly for the kernel code debugging in both sw_emu and hw_emu mode. 

 

Sometimes, sw_emu works but hw_emu may still fail. I see this problem while developing using hls instead of pure opencl.

In this case, I find printf is the only thing that helps.

 

I haven't seen the scenario that hw_emu works but hw fails.

 

Check the online document here and search for the debug part. 

https://www.xilinx.com/html_docs/xilinx2016_4/sdaccel_doc/index.html?q=/html_docs/xilinx2016_4/sdaccel_doc/topics/board-installation/task-install-ADM-PCIE-7V3.html

 

Here is instructions of using gdb in sdaccel project.(I copied from the website) 

 

You can launch GBD standalone to debug the host program if the host program was built with debug information (built with the -g flag).

Below are the instructions:
  1. Set up your SDAccel development environment by following instructions in the SDx Environments Release Notes, Installation, and Licensing Guide (UG1238).
  2. Launch GDB on the host program as in the following example:
gdb --args host.exe test.xclbin

 

Visitor luckyxiuxiu
Visitor
3,596 Views
Registered: ‎08-18-2015

Re: Debug in SDAccel

Jump to solution

Thans for replying, I've tried your advice, but didn't work.

I think something is wrong when data trans to FPGA,I use function "enqueueMigrateMemObjects",trans 100 structures whthin a vector  ,each structure is  composed of 5 double vars.I printf() one of the vars,named "S" and found that only part of the values are correct,the others are "-nan" or "0.000000"or a large value.

who have solved such a problem, I need help,thx

Tags (1)
0 Kudos
Explorer
Explorer
3,586 Views
Registered: ‎06-17-2012

Re: Debug in SDAccel

Jump to solution

Hi, @luckyxiuxiu

 

That sounds strange. 

You may post your code or a simplified version.

That will be easier to discuss. 

 

Regards,

Cheng Liu

 

0 Kudos
Visitor luckyxiuxiu
Visitor
3,577 Views
Registered: ‎08-18-2015

Re: Debug in SDAccel

Jump to solution

Hi,liucheng

     CPU initial data  (type  double),as follows(printf):

      S=406.300000

      X=330.00000

      u=1.004029

      e_rt_p=0.498992

      e_rt_q=0.501002

     I use "q.enqueueMigrateMemObjects(inBufVec,0)"to trans initial data from cpu to FPGA,inBufVec is a vector , wiht 100 structures  in it.Each structures if composed of S,X,u,e_rt_p,e_rt_q.

      the data in FPGA(printf)
      some are :(comes late)

      

      S=406.300000

      X=330.00000

      u=1.004029

      e_rt_p=0.498992

      e_rt_q=0.501002

  

       some are (comes early)

       

      S=-nan

      X=-nan

      u=-nan

      e_rt_p=-nan

      e_rt_q=-nan

 

     some are  (comes in the middle)

     

      S=-nan

      X=-nan

      u=0.00000

      e_rt_p=0.00000

      e_rt_q=0.00000

 

     some are :(comes in the middle)

   

      S=0.00000

      X=0.00000

      u=-nan

      e_rt_p=-nan

      e_rt_q=-nan

 

 

0 Kudos
Explorer
Explorer
6,183 Views
Registered: ‎06-17-2012

Re: Debug in SDAccel

Jump to solution

I mean the host.cpp code not the debug information.

 

Anyay, you may also use xcl_memcpy_to_device() instead of the object copy function.

Which should be easier to make it work.

 

There is also a custom data structure example in the sdaccel github example.

it is located at /kernel_to_gmem/custom_datatype_ocl

Check it and see if it helps.

 

View solution in original post

Visitor luckyxiuxiu
Visitor
3,509 Views
Registered: ‎08-18-2015

Re: Debug in SDAccel

Jump to solution

Thx for replying.I have fixed my code as the example tells,but it still does not work .Most of the examples use enqueueMigrateMemObjects. It's too strange why my enqueueMigrateMemObjects does not work.

0 Kudos
Visitor luckyxiuxiu
Visitor
3,472 Views
Registered: ‎08-18-2015

Re: Debug in SDAccel

Jump to solution

The example helps a lot

0 Kudos