Software Archive
Read-only legacy content
17060 Discussions

How to debug offload application using GDB

shiva_rama_krishna_b
510 Views

Hi,

i want to debug my application using gdb in offload mode. Unfortunately i could not find exact way to debug an offload application using GDB. This (https://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host) articles talks about debugging remotely, natively using GDB. It seems there is eclipse plugin for debugging in offload mode(i can not use eclipse). I want to know is there any way I can debug my application using GDB? 

I tried running my application using gdb-mic <executable>. My application has some offloaded code in middle. When i run it is giving me segmentation fault. i am not able to fback trace to identify the method which is creating problem on MIC. I am attaching screen shots of error. 

gdb-error.jpg

I am not able to see rouitne names using gdb-mic. How to get routine names and line number from where the problem is created?

Can some please help me on this?

Thanks

sivaramakrishna

 

0 Kudos
1 Reply
Georg_Z_Intel
Employee
510 Views

Hello,

officially we only support offload debugging by using the Eclipse* IDE integration as described here:
https://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host#Debugging%20with%20Eclipse*%20IDE

If you still want to debug on the command line only, here is a not validated way to do so:

  1. Set two environment variables (depending on the MPSS version) before starting the offload enabled application as described here:
    https://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host#Additional%20Requirements%20for%20Offload%20Debugging
     
  2. Start the offload enabled application.
     
  3. Start "gdbserver" on the coprocessor where the offloaded code is running on, e.g.:
    $ micnativeloadex /opt/intel/composer_xe_2015.0.086/debugger/gdb/target/mic/bin/gdbserver -a "--multi :2000"
    Note that it has to be started as "micuser" or whichever user the "coi_daemon" is running with. Hence we use "micnativeloadex" here which executes as "micuser" on the coprocessor.
     
  4. Get the offloaded code's section:
    Assuming the offloaded enabled application runs on host as "xxx" and the offloaded code section on the coprocessor as PID 5101:
    micuser    5101  0.3  0.0 217256  4088 ?        Sl   14:06   0:00 /tmp/coi_procs/1/5101/xxx?iccout6H59mG
    (output from "ps aux")

    Then you'll find on the host:
    /tmp/coi_procs/1/5101/xxx\?iccout6H59mG
    This should be used for the "file" command below.
     
  5. Start gdb-mic and attach, e.g.:
    (gdb) target extended-remote mic0:2000
    (gdb) set sysroot /opt/mpss/3.1.4/sysroots/k1om-mpss-linux/
    (gdb) file /tmp/coi_procs/1/5101/xxx\?iccout6H59mG
    (gdb) attach 5101

Now you can debug the offloaded code section. However, if you have multiple coprocessors and/or multiple offloaded code sections then you'll see how cumbersome this gets. It's better to use the Eclipse* IDE integration, which does all of that transparently for you.

Best regards,

Georg Zitzlsberger

0 Kudos
Reply