How to Use the Portland Group pgprof Profiler
On the Katana, you can use the Portland Group's pgprof multi-process and
multi-threaded profiler to profile MPI and OpenMP FORTRAN or C codes. For more details,
please consult the PGI Tools Guide (PDF).
Please note that only two licenses of pgprof
are available on the system. If both are in use, you will have to
wait for one to free up. When you are done using pgprof, please
exit from it to avoid blocking others from accessing it.
Profiling MPI codes with pgprof
Profiling an MPI code requires four steps:
- Step 1. Select MPI_IMPLEMENTATION to be mpich.
katana:~ % setenv MPI_IMPLEMENTATION mpich
katana:~ % printenv MPI_IMPLEMENTATION
mpich
The latter, optional, command confirms that mpich is the active MPI_IMPLEMENTATION.
- Step 2. Compile code with -Mprof=time,mpi,func
katana:~ % mpif77 -o example example.f -Mprof=mpi,func
- Step 3. Run code to generate timing data.
katana:~ % mpirun -np 4 example
- Step 4. Run the profiler to display performance data through GUI.
You will need X-server running because pgprof will spawn a GUI window
as shown below.
katana:~ % pgprof -exe example1
In the above GUI window, the elapsed time and slots used (4 processes)
are displayed immediately below the task bar at the top.
The left sub-window shows the starting locations for
"main", functions "integral" and "fct" within the single source file example1_2.f.
The function "integral" is
called by main exactly once per process. The function "integral" calls "fct" 500 times.
Since 4 slots are used, the work load for "fct" is 25%, which is also shown graphically
through a horizontal bar in red.
All these information is displayed on the top right sub-window. The bottom window
shows the work load of "example1" (shaded in blue). You may select "fct" by clicking
on "fct" and the bottom window will respond in kind.
- If pgprof -o example1 were used, the line near the top
of the GUI window that reports the wall clock time would print "example1_2" instead
of "a.out" as the executable name.
-
pgprof may also be invoked in the text mode
katana:F77/tmp % pgprof -exe example1 -text
pgprof 7.1-1
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2007, STMicroelectronics, Inc. All Rights Reserved.
Datafile : pgprof.out
Processes : 4
Threads : 4
pgprof> print
Profile output - Tue Nov 20 09:06:50 EST 2007
Program : a.out
Datafile : pgprof.out
Process : 0
Total Time for Process : 0.100336 secs
Sort by max time
Select all
Routine Source Line
Calls Time(%) Name File No.
1 91 example1_2 example1.f 1
500 5 fct example1.f 88
1 4 integral example1.f 73
pgprof>
Profiling OpenMP codes with pgprof
To start pgprof, follow the step-by-step procedures shown below:
|
|