Software Archive
Read-only legacy content
17061 Discussões

Hunting segmentation faults in native mode

Matara_Ma_Sukoy1
Principiante
950 Visualizações

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 Respostas
Sumedh_N_Intel
Funcionário
950 Visualizações

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

I hope this helps. 

Victor_L_2
Principiante
950 Visualizações

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

Matara_Ma_Sukoy1
Principiante
950 Visualizações

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

Charles_C_Intel1
Funcionário
950 Visualizações

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

Responder