Lesson 20: Running with max-opt, Profiling
Not that I know much about this, but since a few people explained to
me how to do this, I guess I "earned" the honor to write it up in a
small lesson:
Running with max-opt
Clearly, when studying the speed of L3 code (e.g. using
l3fstatmanager ), it's desirable to run code in an
environment as
close to a real L3 node as possible. This means you want to select
a PC with an architecture similar to a L3 node (or of course a
real L3 node when they become available), and you want to run
under linux using the optimized build. To do this, just tell SRT
to use maxopt:
srt_setup SRT_QUAL=maxopt
(right after setup D0RunII). After this recompile and rebuild
your local packages, the other libraries will be picked up from the
corresponding maxopt release.
At this point, d0lxcs2 and d0lxcs3 are recommended for L3 timing
tests. To run on these, note that because of KAI licence issues
you still have to build on e.g. d0lxbld1.
Profiling
Even though there is an SRT Qualifier optprof that I assume was
foreseen for this purpose, it seems that at the moment this option
is not supported and therefore not guaranteed to work. One way to
get the right compiler flags into all the makefiles is to check
out SRT_D0 in your local release area:
addpkg SRT_D0
Then edit SRT_D0/SoftRelTools/compilers/KCC.mk
and (for linux) add the compiler flag -pg to the maxopt flags (just as
they have already been added for optprof).
This compiler option will make the binary write out a file gmon.out
containing all the profiling information (well, at least it worked
for me...).
To analyze this output, run
gprof ScriptRunner_x gmon.out > gprof.log
(with your binary in place of ScriptRunner_x). Look at the gprof manpages for explanations of how to interpret this output.
If you discover more about this topic than summarized here, let me know
(or preferably just take over the maintenance of this page).