The debugging of multithreaded program discussed in this section applies to both the OpenMP* Fortran API and the Intel® Fortran parallel compiler directives. When a program uses parallel decomposition directives, you must take into consideration that the bug might be caused either by an incorrect program statement or it might be caused by an incorrect parallel decomposition directive. In either case, the program to be debugged can be executed by multiple threads simultaneously.
To debug the multithreaded programs, you can use:
The Intel® Debugger (idb)
The Intel Fortran Compiler debugging options and methods.
The Intel parallelization extension routines for low-level debugging.
The VTune(TM) Performance Analyzer to define the problematic areas.
Other best known debugging methods and tips include:
Correct the program in a single-threaded, uni-processor environment
Statically analyze locks
Use a trace statement (such as the PRINT statement)
Think in parallel, make very few assumptions
Step through your code
Make sense of threads and callstack information
Identify the primary thread
Know what thread you are debugging
Single stepping in one thread does not mean single stepping in others
Watch out for context switch
The Intel® Debugger (idb) supports the debugging of programs that are executed by multiple threads. However, the debugger does not directly support the debugging of parallel decomposition directives, and therefore, there are limitations on the debugging features.
Some of the new features used in OpenMP are not yet fully supported by the debuggers, so it is important to understand how these features work to know how to debug them. The two problem areas are:
The Intel Debugger (idb) is not aware of and currently does not handle unique OpenMP features that relate to multi-threading.