Compare commits

..

2 Commits

Author SHA1 Message Date
Siarhei Fedartsou 9827e97968 Try using perf tool 2024-06-26 17:52:54 +02:00
Siarhei Fedartsou 30f2ecca6c Try using perf tool 2024-06-26 17:41:16 +02:00
2 changed files with 47 additions and 64 deletions
+44 -53
View File
@@ -636,19 +636,18 @@ jobs:
# ccache -s # ccache -s
benchmarks: benchmarks:
#if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
#needs: [format-taginfo-docs] # needs: [format-taginfo-docs]
runs-on: self-hosted runs-on: ubuntu-22.04
env: env:
CCOMPILER: gcc-13 CCOMPILER: clang-13
CXXCOMPILER: g++-13 CXXCOMPILER: clang++-13
CC: gcc-13 CC: clang-13
CXX: g++-13 CXX: clang++-13
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }} GITHUB_REPOSITORY: ${{ github.repository }}
RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }} RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }}
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
steps: steps:
- name: Enable data.osm.pbf cache - name: Enable data.osm.pbf cache
if: ${{ ! env.RUN_BIG_BENCHMARK }} if: ${{ ! env.RUN_BIG_BENCHMARK }}
@@ -679,8 +678,8 @@ jobs:
path: pr path: pr
- name: Install dependencies - name: Install dependencies
run: | run: |
python3 -m pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4" --break-system-packages python3 -m pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4"
#sudo apt-get update -y && sudo apt-get install ccache sudo apt-get update -y && sudo apt-get install ccache
- name: Prepare data - name: Prepare data
run: | run: |
if [ "$RUN_BIG_BENCHMARK" = "true" ]; then if [ "$RUN_BIG_BENCHMARK" = "true" ]; then
@@ -708,7 +707,6 @@ jobs:
path: base path: base
- name: Build Base Branch - name: Build Base Branch
run: | run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/sfedartsou/.conan/data/onetbb/2021.12.0/_/_/package/14d80dcc6e4fac53fcd6bcf3899648ac2c72c6aa/lib/"
mkdir base/build mkdir base/build
cd base/build cd base/build
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release .. cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release ..
@@ -716,57 +714,50 @@ jobs:
make -j$(nproc) benchmarks make -j$(nproc) benchmarks
cd .. cd ..
make -C test/data make -C test/data
- name: Build PR Branch # - name: Build PR Branch
run: | # run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/sfedartsou/.conan/data/onetbb/2021.12.0/_/_/package/14d80dcc6e4fac53fcd6bcf3899648ac2c72c6aa/lib/" # mkdir -p pr/build
mkdir -p pr/build # cd pr/build
cd pr/build # cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release ..
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release .. # make -j$(nproc)
make -j$(nproc) # make -j$(nproc) benchmarks
make -j$(nproc) benchmarks # cd ..
cd .. # make -C test/data
make -C test/data
# we run benchmarks in tmpfs to avoid impact of disk IO # we run benchmarks in tmpfs to avoid impact of disk IO
- name: Create folder for tmpfs - name: Create folder for tmpfs
run: mkdir -p ~/benchmarks_tmp run: mkdir -p /opt/benchmarks
- name: Run PR Benchmarks # - name: Run PR Benchmarks
run: | # run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/sfedartsou/.conan/data/onetbb/2021.12.0/_/_/package/14d80dcc6e4fac53fcd6bcf3899648ac2c72c6aa/lib/" # sudo mount -t tmpfs -o size=4g none /opt/benchmarks
sudo mount -t tmpfs -o size=4g none ~/benchmarks_tmp # cp -rf pr/build /opt/benchmarks/build
cp -rf pr/build ~/benchmarks_tmp/build # mkdir -p /opt/benchmarks/test
mkdir -p ~/benchmarks_tmp/test # cp -rf pr/test/data /opt/benchmarks/test/data
cp -rf pr/test/data ~/benchmarks_tmp/test/data # cp -rf pr/profiles /opt/benchmarks/profiles
cp -rf pr/profiles ~/benchmarks_tmp/profiles
sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks_tmp -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks_tmp/build -o ~/data.osm.pbf -g ~/gps_traces.csv # ./pr/scripts/ci/run_benchmarks.sh -f /opt/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b /opt/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sleep 10 # sudo umount /opt/benchmarks
# lsof ~/benchmarks_tmp
sudo umount ~/benchmarks_tmp
- name: Run Base Benchmarks - name: Run Base Benchmarks
run: | run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/sfedartsou/.conan/data/onetbb/2021.12.0/_/_/package/14d80dcc6e4fac53fcd6bcf3899648ac2c72c6aa/lib/" sudo mount -t tmpfs -o size=4g none /opt/benchmarks
sudo mount -t tmpfs -o size=4g none ~/benchmarks_tmp cp -rf base/build /opt/benchmarks/build
cp -rf pr/build ~/benchmarks_tmp/build mkdir -p /opt/benchmarks/test
mkdir -p ~/benchmarks_tmp/test cp -rf base/test/data /opt/benchmarks/test/data
cp -rf pr/test/data ~/benchmarks_tmp/test/data cp -rf base/profiles /opt/benchmarks/profiles
cp -rf pr/profiles ~/benchmarks_tmp/profiles
# TODO: remove it when base branch will have this file at needed location # TODO: remove it when base branch will have this file at needed location
if [ ! -f ~/benchmarks_tmp/test/data/portugal_to_korea.json ]; then if [ ! -f /opt/benchmarks/test/data/portugal_to_korea.json ]; then
cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks_tmp/test/data/portugal_to_korea.json cp base/src/benchmarks/portugal_to_korea.json /opt/benchmarks/test/data/portugal_to_korea.json
fi fi
# we intentionally use scripts from PR branch to be able to update them and see results in the same PR # we intentionally use scripts from PR branch to be able to update them and see results in the same PR
sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks_tmp -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks_tmp/build -o ~/data.osm.pbf -g ~/gps_traces.csv ./pr/scripts/ci/run_benchmarks.sh -f /opt/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b /opt/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sleep 10 sudo umount /opt/benchmarks
# lsof ~/benchmarks_tmp # - name: Post Benchmark Results
sudo umount ~/benchmarks_tmp # run: |
- name: Post Benchmark Results # python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results
run: | # - name: Show CCache statistics
python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results # run: |
- name: Show CCache statistics # ccache -p
run: | # ccache -s
ccache -p
ccache -s
# ci-complete: # ci-complete:
# runs-on: ubuntu-22.04 # runs-on: ubuntu-22.04
+3 -11
View File
@@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
set -eou pipefail set -eou pipefail
export LD_LIBRARY_PATH="/home/sfedartsou/.conan/data/onetbb/2021.12.0/_/_/package/14d80dcc6e4fac53fcd6bcf3899648ac2c72c6aa/lib/"
function usage { function usage {
echo "Usage: $0 -f <folder> -r <results_folder> -s <scripts_folder> -b <binaries_folder> -o <osm_pbf> -g <gps_traces>" echo "Usage: $0 -f <folder> -r <results_folder> -s <scripts_folder> -b <binaries_folder> -o <osm_pbf> -g <gps_traces>"
exit 1 exit 1
@@ -54,17 +52,11 @@ function measure_peak_ram_and_time {
function run_benchmarks_for_folder { function run_benchmarks_for_folder {
mkdir -p $RESULTS_FOLDER mkdir -p $RESULTS_FOLDER
rm -rf $RESULTS_FOLDER/*
BENCHMARKS_FOLDER="$BINARIES_FOLDER/src/benchmarks" BENCHMARKS_FOLDER="$BINARIES_FOLDER/src/benchmarks"
echo "Running match-bench MLD" echo "Running match-bench MLD"
perf stat -r 10 $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/mld/monaco.osrm" mld &> "$RESULTS_FOLDER/match_mld.bench" perf stat -r 1 $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/mld/monaco.osrm" mld #> "$RESULTS_FOLDER/match_mld.bench"
echo "Running match-bench CH" # echo "Running match-bench CH"
perf stat -r 10 $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/ch/monaco.osrm" ch &> "$RESULTS_FOLDER/match_ch.bench" # $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/ch/monaco.osrm" ch > "$RESULTS_FOLDER/match_ch.bench"
echo "Running match-bench MLD"
perf stat -r 10 $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/mld/monaco.osrm" mld &> "$RESULTS_FOLDER/match_mld2.bench"
echo "Running match-bench CH"
perf stat -r 10 $BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/ch/monaco.osrm" ch &> "$RESULTS_FOLDER/match_ch2.bench"
# echo "Running route-bench MLD" # echo "Running route-bench MLD"
# $BENCHMARKS_FOLDER/route-bench "$FOLDER/test/data/mld/monaco.osrm" mld > "$RESULTS_FOLDER/route_mld.bench" # $BENCHMARKS_FOLDER/route-bench "$FOLDER/test/data/mld/monaco.osrm" mld > "$RESULTS_FOLDER/route_mld.bench"
# echo "Running route-bench CH" # echo "Running route-bench CH"