You copied the Doc URL to your clipboard.

26 Main-thread, OpenMP and Pthread view modes

The percentage values and activity graphs shown alongside the source code and in the Stacks, OpenMP Regions and Functions views can present information for multithreaded programs in a variety of different ways.

MAP will initially choose the most appropriate view mode for your program. However, in some cases, for example such as when you have written a program to use raw pthreads rather than OpenMP, you may wish to change the mode to get a different perspective on how your program is executing multiple threads and using multiple cores. You can switch between view modes from the View menu.

26.1 Main thread only mode

In this view mode only the main thread from each process is displayed; the presence of any other thread is ignored. A value of 100% for a function or line means that all the processes' main threads are at that location. This is the best mode to use when exploring single-threaded programs and programs that are unintentionally/indirectly multithreaded (that is, recent implementations of both Open MPI and CUDA will start their own thread).

This is the default mode for all non-OpenMP programs. The OpenMP Regions tab is not displayed in this mode.

Note that the CPU instruction metric graphs (showing the proportion of time in various classes of CPU instructions: such as integer, floating-point, and vector) are not restricted to the main thread when in the Main thread only view mode. These metric graphs always represent the data gathered from all the CPU cores.

26.2 OpenMP mode

This view mode is optimized for interpreting programs where OpenMP is the primary source of multithreaded activity. Percentage values and activity graphs for a line or function indicate the proportion of the available resources that are being used on that line. For serial code on a main thread this is the proportion of processes at that location, for OpenMP code the contribution from each process is further broken down by the proportion of CPU cores running threads that are at that location in the code.

For example, a timeslice of an activity graph showing 50% dark green (serial, main-thread computation) and 50% light green (computation in an OpenMP region) means that half the processes were in serial code and half the processes were in an OpenMP region. Of the processes in an OpenMP region 100% of the available cores (as determined by the cores per process value, see 27 Processes and cores view) were being used for OpenMP.

This is the default mode for OpenMP programs. It is only available for programs where MAP detected an OpenMP region.

26.3 Pthread mode

This view mode is optimized for interpreting programs that make explicit use of pthreads. Percentage values and activity graphs reflect the proportion of CPU cores that are being used out of the maximum number of expected cores per process, see 27 Processes and cores view.

A value of 100% for a function or line means that 100% of the expected number of CPU cores per process were working at that location. The main thread's contribution gets no special attention so activity on the main thread(s) will appear the same height as activity from any other thread.

The advantage of this is that it makes it obvious when the program is not making full use of all the CPU cores available to it. But it has the downside of it being harder to analyze the performance of the intentionally serial sections of code performed by each process. This is because activity occurring only on one thread per process will be restricted to at most 1∕nth of a percentage value or height on an activity graph, where n is the number of cores per process.

This mode is not used by default so must be explicitly selected. It is only available for multithreaded programs.

The OpenMP Regions tab is not displayed in this mode.

Was this page helpful? Yes No