Skip to content

Commit e5e25a1

Browse files
Configure self-hosted runner for benchmarks job (#6975)
1 parent 84f12c7 commit e5e25a1

File tree

1 file changed

+36
-52
lines changed

1 file changed

+36
-52
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ jobs:
653653
benchmarks:
654654
if: github.event_name == 'pull_request'
655655
needs: [format-taginfo-docs]
656-
runs-on: ubuntu-24.04
656+
runs-on: self-hosted
657657
env:
658658
CCOMPILER: clang-16
659659
CXXCOMPILER: clang++-16
@@ -664,42 +664,17 @@ jobs:
664664
GITHUB_REPOSITORY: ${{ github.repository }}
665665
RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }}
666666
steps:
667-
- name: Enable data.osm.pbf cache
668-
if: ${{ ! env.RUN_BIG_BENCHMARK }}
669-
uses: actions/cache@v4
670-
with:
671-
path: ~/data.osm.pbf
672-
key: v1-data-osm-pbf
673-
restore-keys: |
674-
v1-data-osm-pbf
675-
- name: Use Node 20
676-
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
677-
uses: actions/setup-node@v4
678-
with:
679-
node-version: 20
680-
- name: Enable compiler cache
681-
uses: actions/cache@v4
682-
with:
683-
path: ~/.ccache
684-
key: v1-ccache-benchmarks-${{ github.sha }}
685-
restore-keys: |
686-
v1-ccache-benchmarks-
687-
- name: Enable Conan cache
688-
uses: actions/cache@v4
689-
with:
690-
path: ~/.conan
691-
key: v1-conan-benchmarks-${{ github.sha }}
692-
restore-keys: |
693-
v1-conan-benchmarks-
694667
- name: Checkout PR Branch
695668
uses: actions/checkout@v4
696669
with:
697670
ref: ${{ github.head_ref }}
698671
path: pr
699-
- name: Install dependencies
700-
run: |
701-
python3 -m pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4" --break-system-packages
702-
sudo apt-get update -y && sudo apt-get install ccache
672+
- name: Activate virtualenv
673+
run: |
674+
python3 -m venv .venv
675+
source .venv/bin/activate
676+
echo PATH=$PATH >> $GITHUB_ENV
677+
pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4"
703678
- name: Prepare data
704679
run: |
705680
if [ "$RUN_BIG_BENCHMARK" = "true" ]; then
@@ -751,34 +726,43 @@ jobs:
751726
make -C test/data
752727
# we run benchmarks in tmpfs to avoid impact of disk IO
753728
- name: Create folder for tmpfs
754-
run: mkdir -p /opt/benchmarks
729+
run: |
730+
# if by any chance it was mounted before(e.g. due to previous job failed), unmount it
731+
sudo umount ~/benchmarks | true
732+
rm -rf ~/benchmarks
733+
mkdir -p ~/benchmarks
734+
# see https://llvm.org/docs/Benchmarking.html
755735
- name: Run PR Benchmarks
756736
run: |
757-
sudo mount -t tmpfs -o size=4g none /opt/benchmarks
758-
cp -rf pr/build /opt/benchmarks/build
759-
cp -rf pr/lib /opt/benchmarks/lib
760-
mkdir -p /opt/benchmarks/test
761-
cp -rf pr/test/data /opt/benchmarks/test/data
762-
cp -rf pr/profiles /opt/benchmarks/profiles
763-
764-
./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
765-
sudo umount /opt/benchmarks
737+
sudo cset shield -c 2-3 -k on
738+
sudo mount -t tmpfs -o size=4g none ~/benchmarks
739+
cp -rf pr/build ~/benchmarks/build
740+
cp -rf pr/lib ~/benchmarks/lib
741+
mkdir -p ~/benchmarks/test
742+
cp -rf pr/test/data ~/benchmarks/test/data
743+
cp -rf pr/profiles ~/benchmarks/profiles
744+
745+
sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
746+
sudo umount ~/benchmarks
747+
sudo cset shield --reset
766748
- name: Run Base Benchmarks
767749
run: |
768-
sudo mount -t tmpfs -o size=4g none /opt/benchmarks
769-
cp -rf base/build /opt/benchmarks/build
770-
cp -rf base/lib /opt/benchmarks/lib
771-
mkdir -p /opt/benchmarks/test
772-
cp -rf base/test/data /opt/benchmarks/test/data
773-
cp -rf base/profiles /opt/benchmarks/profiles
750+
sudo cset shield -c 2-3 -k on
751+
sudo mount -t tmpfs -o size=4g none ~/benchmarks
752+
cp -rf base/build ~/benchmarks/build
753+
cp -rf base/lib ~/benchmarks/lib
754+
mkdir -p ~/benchmarks/test
755+
cp -rf base/test/data ~/benchmarks/test/data
756+
cp -rf base/profiles ~/benchmarks/profiles
774757
775758
# TODO: remove it when base branch will have this file at needed location
776-
if [ ! -f /opt/benchmarks/test/data/portugal_to_korea.json ]; then
777-
cp base/src/benchmarks/portugal_to_korea.json /opt/benchmarks/test/data/portugal_to_korea.json
759+
if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then
760+
cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json
778761
fi
779762
# we intentionally use scripts from PR branch to be able to update them and see results in the same PR
780-
./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
781-
sudo umount /opt/benchmarks
763+
sudo cset shield --exec -- cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
764+
sudo umount ~/benchmarks
765+
sudo cset shield --reset
782766
- name: Post Benchmark Results
783767
run: |
784768
python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results

0 commit comments

Comments
 (0)