Software Archive
Read-only legacy content
17060 Discussions

Hunting segmentation faults in native mode

Matara_Ma_Sukoy1
Beginner
448 Views

Hi all,

Quick question. I have different builds for the same code.

  • When I run the code on Xeon processor or any other ordinary one, there is no problem.
  • However, when I run it on Xeon Phi using native execution I get a segmentation fault.

I am trying to hunt these errors. But, it seems to me that, when I call printf on corprocessor, message is not displayed immediately like on processor. Code actually executes a little bit more before I can print something on screen. This makes it almost impossible for me to solve this.

Does anyone know how to work around this? Or know of any techniques to deal with this?

Answers, pointers, questions they are all welcome as always. Thanks in advance.

Regards

Matara Ma

0 Kudos
4 Replies
Sumedh_N_Intel
Employee
448 Views

I think if you follow your printfs with fflush(0);, it should display the message before moving on. 

I hope this helps. 

0 Kudos
Victor_L_2
Beginner
448 Views

You can use Intel provided debugger to debug your application. More details: http://software.intel.com/en-us/articles/debugging-on-intel-xeon-phi-coprocessor-use-case-overview

0 Kudos
Matara_Ma_Sukoy1
Beginner
448 Views

Putting fflush(0); just after printf works.

Oddly enough when using fflush(0) code works without any problem on native mode... Well at least I can get perform a debug now.

Thanks a lot for your lightning answer.

Matara Ma

0 Kudos
Charles_C_Intel1
Employee
448 Views

Note that segment faults due to coding errors can be caught using the native version of gdb provided with the MPSS drivers.  The only exception to this is segment faults due to exceeding coprocessor memory - gdb gets killed too in this case.

Charles

0 Kudos
Reply