wiki:Documentation/UserGuide/ProfileGprof

Version 1 (modified by luyssaert, 5 years ago) (diff)

--

Profiling with gprof on obelix is really easy and it can teach you quite a lot about where ORCHIDEE spends most of it time. Basically one needs to add the compiler option -p -g or -pg. Use the internet to learn about additional settings that can be used to fine tune the outcomes of gprof.

Because ORCHIDEE makes use of several scripts, these options need to be added at several places:

  • ORCHIDEE/config/Makefile add -p -g to the production line mode F_O
  • If you want this to become the default also after a make clean and ins_make then also change the compiler options in ORCHIDEE/util/AA_make.def add -p -g to the production line mode F_O for obelix. Then run ins_make (./ins_make)
  • ORCHIDEE/model/ORCHIDEE/arc.fcm add -p -g to the prod line

Recompile the model from the config/ORCHIDEE_OL folder. Rerun the model. If all goes well a gmon.out file will be created in the RUN_DIR. So, on obelix you will first have to change the path of the RUN_DIR. Open …/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh and change the RUN_DIR_PATH (example below)

#- RUN_DIR_PATH : Temporary working directory (=> TMP)
if [ X${PBS_JOBID} != X ] ; then
  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/home/scratch01/sluys/$PBS_O_LOGNAME.$PBS_JOBID}
else
  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/tmp/tmp$$}
fi

You can now look at the gmon.out file with gprof.

gprof orchide_ol gmon.out > view.txt