The best way to solve the segmentation problem in OpenMP

I am trying to parallelize a large program in Fortran90 using OpenMP.

I am getting segmentation errors all the time. I am wondering if there is an easy way to fix them. What do you do if you have a segmentation fault?

+3


source to share


2 answers


First, revert your code back to the original, non-parallel version. You've got it under version control, right?

Check very carefully that your serial program is not causing any segmentation faults. Pay special attention to the issues raised in this document from Intel . Read this even if you are not using the Intel Fortran compiler. Take the corrective action that he suggests.

Now, parallelize your first construct. Choose a simple, not nested, loop if you can. Check your program again. Think about what you have done and make sure you understand what is going on. Choose another simple construct for parallelization. When you're done, the easy ones move on to the harder ones, testing all the time as you walk and learning as you walk.



So, to answer your question, the best way to fix such mistakes is to not do them in the first place. You are reporting segmentation failures all the time, which tells me that you were trying to start before you can walk.

And to answer another question: no, there is no easy way to fix them.

+7


source


As HPM suggested, do you only get segmentation errors when compiling with OpenMP and also without OpenMP?



I suggest compiling using all the debug options provided by your compiler. Your compiler can identify some problems and report them to you as Fortran problems, not memory access problems. For example, a runtime index check will identify illegal indexes that can cause segmentation failures. Other compiler options can provide good coding practices that make errors less likely. Which compiler are you using?

+3


source







All Articles