HowTo: Profiling LMDZ : Différence entre versions
((WIP) Add gprof guide) |
((WIP) Add scalasca install guide) |
||
Ligne 6 : | Ligne 6 : | ||
<code>gprof</code> is a rudimentary but simple to use tool to profile a sequential executable. | <code>gprof</code> is a rudimentary but simple to use tool to profile a sequential executable. | ||
+ | |||
+ | ''Note: a new tool [https://sourceware.org/pipermail/binutils/2021-August/117665.html gprofng] is currently being developed with several notable improvements including multithreading support. As of 06/24, it doesn't support Fortran yet. | ||
==== Instrumenting the code ==== | ==== Instrumenting the code ==== | ||
Ligne 23 : | Ligne 25 : | ||
[[Fichier:gprof.png|400px]] | [[Fichier:gprof.png|400px]] | ||
− | |||
== Profiling with scorep & scalasca == | == Profiling with scorep & scalasca == | ||
+ | |||
+ | Scalasca ([https://www.scalasca.org/ home], [https://apps.fz-juelich.de/scalasca/releases/scalasca/2.6/docs/manual/ manual]) is a profiling suite developed by Technische Universität Darmstadt Laboratory for Parallel Programming. It is much more capable than gprof, but also requires a heavier setup. | ||
+ | |||
+ | ==== Installing scalasca ==== | ||
+ | |||
+ | Some supercomputers have scalasca installed already, but for completeness here's a short guide to installing it locally (written 06/24, for v2.6.1): | ||
+ | |||
+ | All dependencies can be downloaded from [https://www.scalasca.org/scalasca/software/scalasca-2.x/requirements.html here]. | ||
+ | |||
+ | ===== Compiling CubeBundle / CubeLib ===== | ||
+ | |||
+ | ''Note: If you're on your own computer, we recommend installing CubeBundle, which includes CubeGUI. This requires Qt5 and OpenGL, which are a pain to install on supercomputers without sudo. For supercomputer local install, we recommand installing CubeW+CubeLib instead, and visualizing the results on your own computer.'' | ||
+ | |||
+ | No special instruction here - simply get the sources on the link above, extract them locally, and run <code>./configure --prefix=... && make -j 8 && make install</code>. | ||
+ | |||
+ | ==== Compiling scorep ==== | ||
+ | |||
+ | Scalasca relies on <code>scorep</code> to instrument your code for profiling. | ||
+ | |||
+ | On clusters like Adastra, you need to make sure that <code>clang</code> in your path points to the system install: <code>LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH" ./configure --prefix=... && LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH" make -j 8 && make install</code>. | ||
+ | |||
+ | ''Note: make sure to load the right environment before compiling ! <code>scorep</code> can only instrument compilers it has detected when configured.'' | ||
+ | |||
+ | ==== Compiling scalasca ==== | ||
+ | |||
+ | Usual process: <code>./configure --prefix=... && make -j 8 && make install</code>. | ||
+ | |||
+ | ''Note: Scalasca doesn't seem to like gcc-13 very much, but it doesn't need to be compiled with the same compiler as <code>scorep</code>.'' | ||
+ | |||
+ | ''Note: On Adastra, you need <code>module load craype-x86-trento</code> and we recommend <code>module load gcc/12.2.0</code>.'' | ||
+ | |||
+ | ''Note: To perform traces, Scalasca requires executables in <code>$install_dir/bin/backend/</code> to be in the path. You can safely simply copy them to <code>$install_dir/bin/</code> and add that to the path instead.'' | ||
+ | |||
[[Category:HowTo]] | [[Category:HowTo]] |
Version du 16 juillet 2024 à 19:29
Sommaire
Profiling with gprof =
The legacy way to profile the model is using gprof
.
- Pros: available everywhere, easy to use
- Cons: old, bad handling of multithreaded applications, requires instrumentation
gprof
is a rudimentary but simple to use tool to profile a sequential executable.
Note: a new tool gprofng is currently being developed with several notable improvements including multithreading support. As of 06/24, it doesn't support Fortran yet.
Instrumenting the code
In the .fcm
arch file used, add -pg
to BASE_FFLAGS
and BASE_LD
. Recompile the model.
Collecting statistics
Run the executable gcm.e
. This will generate a gmon.out
file locally.
Reading results
Run gprof gcm.e gmon.out > profiling.txt
to get a textual view of the profiling.
For a graphical representation, we recommend using gprof2dot, via gprof gcm.e | gprof2dot | dot -Tpng -o output.png
. A typical example is shown below.
Profiling with scorep & scalasca
Scalasca (home, manual) is a profiling suite developed by Technische Universität Darmstadt Laboratory for Parallel Programming. It is much more capable than gprof, but also requires a heavier setup.
Installing scalasca
Some supercomputers have scalasca installed already, but for completeness here's a short guide to installing it locally (written 06/24, for v2.6.1):
All dependencies can be downloaded from here.
Compiling CubeBundle / CubeLib
Note: If you're on your own computer, we recommend installing CubeBundle, which includes CubeGUI. This requires Qt5 and OpenGL, which are a pain to install on supercomputers without sudo. For supercomputer local install, we recommand installing CubeW+CubeLib instead, and visualizing the results on your own computer.
No special instruction here - simply get the sources on the link above, extract them locally, and run ./configure --prefix=... && make -j 8 && make install
.
Compiling scorep
Scalasca relies on scorep
to instrument your code for profiling.
On clusters like Adastra, you need to make sure that clang
in your path points to the system install: LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH" ./configure --prefix=... && LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH" make -j 8 && make install
.
Note: make sure to load the right environment before compiling ! scorep
can only instrument compilers it has detected when configured.
Compiling scalasca
Usual process: ./configure --prefix=... && make -j 8 && make install
.
Note: Scalasca doesn't seem to like gcc-13 very much, but it doesn't need to be compiled with the same compiler as scorep
.
Note: On Adastra, you need module load craype-x86-trento
and we recommend module load gcc/12.2.0
.
Note: To perform traces, Scalasca requires executables in $install_dir/bin/backend/
to be in the path. You can safely simply copy them to $install_dir/bin/
and add that to the path instead.