Differences between revisions 5 and 6
Revision 5 as of 2018-09-12 11:46:39
Size: 2739
Editor: JendrikSeipp
Comment: Add instructions for memory profiling
Revision 6 as of 2018-09-13 21:41:52
Size: 3622
Editor: MalteHelmert
Comment: Describe profiling with cachegrind.
Deletions are marked like this. Additions are marked like this.
Line 33: Line 33:
=== Installing QCacheGrind === See section "Installing QCacheGrind" below if you have neither KCacheGrind nor QCacheGrind installed.

== Profiling Cache Misses ==

Here is an example of how to run the `cachegrind` tool of `valgrind` to profile the CPU cache behaviour of the search component.

To set up, run the translator component:

{{{
./fast-downward.py --translate PROBLEM.PDDL
}}}

To profile, run the search component manually under `valgrind` (substitute the appropriate build and search options):

{{{
valgrind --tool=cachegrind --cachegrind-out-file=cachegrind.out \
    ./builds/release64/bin/downward --search "astar(blind())" < output.sas
}}}

To browse the profiling results:

{{{
# either this:
kcachegrind cachegrind.out

# or this:
qcachegrind cachegrind.out
}}}

See section "Installing QCacheGrind" below if you have neither KCacheGrind nor QCacheGrind installed.

== Profiling Memory Usage ==

Here is an example of how to run the `massif` tool of `valgrind` to profile memory usage of the search component.

To set up, run the translator component:

{{{
./fast-downward.py --translate PROBLEM.PDDL
}}}

`massif` only works for dynamically linked binaries:

{{{
./build.py release64dynamic
}}}

To profile, run the search component manually under `valgrind` (substitute the appropriate search options):

{{{
valgrind --tool=massif --massif-out-file=massif.out \
    ./builds/release64dynamic/bin/downward --search "astar(blind())" < output.sas
}}}

To browse the profiling results:

{{{
sudo apt install massif-visualizer
massif-visualizer massif.out
}}}

== Installing QCacheGrind ==
Line 64: Line 125:

== Profiling Memory Usage ==

Here is an example of how to run the `massif` tool of `valgrind` to profile memory usage of the search component.

To set up, run the translator component:

{{{
./fast-downward.py --translate PROBLEM.PDDL
}}}

`massif` only works for dynamically linked binaries:

{{{
./build.py release64dynamic
}}}

To profile, run the search component manually under `valgrind` (substitute the appropriate search options):

{{{
valgrind --tool=massif --massif-out-file=massif.out \
    ./builds/release64dynamic/bin/downward --search "astar(blind())" < output.sas
}}}

To browse the profiling results:

{{{
sudo apt install massif-visualizer
massif-visualizer massif.out
}}}

Back to developer page.

Profiling

Profiling Running Time

Here is an example of how to run the callgrind tool of valgrind to profile the search component.

To set up, run the translator component:

./fast-downward.py --translate PROBLEM.PDDL

To profile, run the search component manually under valgrind (substitute the appropriate build and search options):

valgrind --tool=callgrind --callgrind-out-file=callgrind.out \
    --dump-instr=yes --collect-jumps=yes \
    ./builds/release64/bin/downward --search "astar(blind())" < output.sas

To browse the profiling results:

# either this:
kcachegrind callgrind.out

# or this:
qcachegrind callgrind.out

See section "Installing QCacheGrind" below if you have neither KCacheGrind nor QCacheGrind installed.

Profiling Cache Misses

Here is an example of how to run the cachegrind tool of valgrind to profile the CPU cache behaviour of the search component.

To set up, run the translator component:

./fast-downward.py --translate PROBLEM.PDDL

To profile, run the search component manually under valgrind (substitute the appropriate build and search options):

valgrind --tool=cachegrind --cachegrind-out-file=cachegrind.out \
    ./builds/release64/bin/downward --search "astar(blind())" < output.sas

To browse the profiling results:

# either this:
kcachegrind cachegrind.out

# or this:
qcachegrind cachegrind.out

See section "Installing QCacheGrind" below if you have neither KCacheGrind nor QCacheGrind installed.

Profiling Memory Usage

Here is an example of how to run the massif tool of valgrind to profile memory usage of the search component.

To set up, run the translator component:

./fast-downward.py --translate PROBLEM.PDDL

massif only works for dynamically linked binaries:

./build.py release64dynamic

To profile, run the search component manually under valgrind (substitute the appropriate search options):

valgrind --tool=massif --massif-out-file=massif.out \
    ./builds/release64dynamic/bin/downward --search "astar(blind())" < output.sas

To browse the profiling results:

sudo apt install massif-visualizer
massif-visualizer massif.out

Installing QCacheGrind

QCacheGrind is KCacheGrind without the KDE bindings and is part of the same source archive as KCacheGrind. You may want to try it if you would rather not install all the KDE dependencies that KCacheGrind brings in.

To download and build QCacheGrind:

sudo apt-get install qt5-default graphviz
# Download December 2016 release. Alternatively, check
# https://github.com/KDE/kcachegrind/releases for something more recent.
wget https://github.com/KDE/kcachegrind/archive/v16.12.0.tar.gz
tar xvzf v16.12.0.tar.gz
cd kcachegrind-16.12.0
qmake && make -j4

Then copy the executable qcachegrind/qcachegrind to your preferred place, for example:

cp qcachegrind/qcachegrind ~/bin/

All other files can be deleted. Alternatively, for a system-wide install that includes metadata for the desktop:

sudo install -m 755 qcachegrind/qcachegrind /usr/local/bin/
sudo install -m 644 qcachegrind/qcachegrind.desktop \
     /usr/local/share/applications/
sudo install -m 644 kcachegrind/hi32-app-kcachegrind.png \
    /usr/local/share/icons/hicolor/32x32/apps/kcachegrind.png
sudo install -m 644 kcachegrind/hi48-app-kcachegrind.png \
    /usr/local/share/icons/hicolor/48x48/apps/kcachegrind.png

FastDownward: ForDevelopers/Profiling (last edited 2019-01-18 15:05:28 by JendrikSeipp)