Building and Running for Profiling
We will look at how to build and run applications for doing simple serial profiling. We will show how to use the standard unix tool gprof as well as using the Intel profiling options. Gprof will do subroutine level profiling. The Intel profiling works at the loop level.
Profiling with gprof
We add the “-p” option to our build and them run in the normal way.
[bishop@mio stommel]$ ifort -O3 -p stf_00.f90 -o stf_00.gp [bishop@mio stommel]$ ./stf_00.gp < st.in > st.out
With the -p option you get an extra output file, gmon.out
[bishop@mio stommel]$ ls -l gmon.out -rw-rw-r-- 1 bishop bishop 247909 Nov 28 11:15 gmon.out
The file gmon.out is then converted to a report using the gprof utility. The report can be “typed” or read with an editor. We have a link to the gprof.out file produced by the run shown above.
[bishop@mio stommel]$ gprof stf_00.gp gmon.out > gprof.out [bishop@mio stommel]$ cat gprof.out
For additional information see the gprof man page.
Profiling with the Intel compiler
We add the “-profile-functions -profile-loops=all -profile-loops-report=2” options to our build and them run in the normal way.
[bishop@mio stommel]$ ifort -O3 \ -profile-functions -profile-loops=all -profile-loops-report=2 \ stf_00.f90 -o stf_00.ip [bishop@mio stommel]$ ./stf_00.ip < st.in > st.out
With these extra options you get an extra output files loop*. The “funcs” file has information similar to the gprof output. The “loops” file has more details. Finally, the “*.xml” file combines the other two. Again we provide links to these files.
[bishop@mio stommel]$ ls -gG loop* -rw-rw-r-- 1 26932 Nov 28 10:45 loop_prof_1354124736.xml -rw-rw-r-- 1 239 Nov 28 10:45 loop_prof_funcs_1354124736.dump -rw-rw-r-- 1 6799 Nov 28 10:45 loop_prof_loops_1354124736.dumpThese are text files which can be viewed in the normal way. However, there is a utility, loopprofileviewer.sh, that can be used to view the information graphically. Note that this is an X-windows application and thus must be run from X.
For additional information see the Intel compiler man page.