This commit is contained in:
Siarhei Fedartsou 2024-10-29 18:06:43 +01:00
parent 7c1f0bf62f
commit 12163b0be9
4 changed files with 127 additions and 174 deletions

View File

@ -24,7 +24,7 @@ concurrency:
jobs: jobs:
windows-release-node: windows-release-node:
#needs: format-taginfo-docs needs: format-taginfo-docs
runs-on: windows-2022 runs-on: windows-2022
continue-on-error: false continue-on-error: false
env: env:
@ -51,11 +51,8 @@ jobs:
cd build cd build
python3 -m venv .venv python3 -m venv .venv
source .venv/Scripts/Activate source .venv/Scripts/Activate
python3 -m pip install conan==2.7.1 python3 -m pip install conan==2.7.1
conan profile detect --force conan profile detect --force
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON .. cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON ..
@ -657,130 +654,130 @@ jobs:
ccache -p ccache -p
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: self-hosted
# env: env:
# CCOMPILER: clang-16 CCOMPILER: clang-16
# CXXCOMPILER: clang++-16 CXXCOMPILER: clang++-16
# CC: clang-16 CC: clang-16
# CXX: clang++-16 CXX: clang++-16
# 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') }}
# steps: steps:
# - name: Checkout PR Branch - name: Checkout PR Branch
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
# path: pr path: pr
# - name: Activate virtualenv - name: Activate virtualenv
# run: | run: |
# python3 -m venv .venv python3 -m venv .venv
# source .venv/bin/activate source .venv/bin/activate
# echo PATH=$PATH >> $GITHUB_ENV echo PATH=$PATH >> $GITHUB_ENV
# pip install "conan==2.7.1" "requests==2.31.0" "numpy==1.26.4" pip install "conan==2.7.1" "requests==2.31.0" "numpy==1.26.4"
# - name: Prepare data - name: Prepare data
# run: | run: |
# if [ "$RUN_BIG_BENCHMARK" = "true" ]; then if [ "$RUN_BIG_BENCHMARK" = "true" ]; then
# rm -rf ~/data.osm.pbf rm -rf ~/data.osm.pbf
# wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet
# gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv
# else else
# if [ ! -f "~/data.osm.pbf" ]; then if [ ! -f "~/data.osm.pbf" ]; then
# wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf
# else else
# echo "Using cached data.osm.pbf" echo "Using cached data.osm.pbf"
# fi fi
# gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv
# fi fi
# - name: Prepare environment - name: Prepare environment
# run: | run: |
# echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
# mkdir -p $HOME/.ccache mkdir -p $HOME/.ccache
# ccache --zero-stats ccache --zero-stats
# ccache --max-size=256M ccache --max-size=256M
# - name: Checkout Base Branch - name: Checkout Base Branch
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# ref: ${{ github.event.pull_request.base.ref }} ref: ${{ github.event.pull_request.base.ref }}
# path: base path: base
# - name: Build Base Branch - name: Build Base Branch
# run: | run: |
# cd base cd base
# npm ci --ignore-scripts npm ci --ignore-scripts
# cd .. cd ..
# mkdir base/build mkdir base/build
# cd base/build cd base/build
# cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
# make -j$(nproc) make -j$(nproc)
# 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: |
# cd pr cd pr
# npm ci --ignore-scripts npm ci --ignore-scripts
# cd .. cd ..
# mkdir -p pr/build mkdir -p pr/build
# cd pr/build cd pr/build
# cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
# 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: | run: |
# # if by any chance it was mounted before(e.g. due to previous job failed), unmount it # if by any chance it was mounted before(e.g. due to previous job failed), unmount it
# sudo umount ~/benchmarks | true sudo umount ~/benchmarks | true
# rm -rf ~/benchmarks rm -rf ~/benchmarks
# mkdir -p ~/benchmarks mkdir -p ~/benchmarks
# # see https://llvm.org/docs/Benchmarking.html # see https://llvm.org/docs/Benchmarking.html
# - name: Run PR Benchmarks - name: Run PR Benchmarks
# run: | run: |
# sudo cset shield -c 2-3 -k on sudo cset shield -c 2-3 -k on
# sudo mount -t tmpfs -o size=4g none ~/benchmarks sudo mount -t tmpfs -o size=4g none ~/benchmarks
# cp -rf pr/build ~/benchmarks/build cp -rf pr/build ~/benchmarks/build
# cp -rf pr/lib ~/benchmarks/lib cp -rf pr/lib ~/benchmarks/lib
# mkdir -p ~/benchmarks/test mkdir -p ~/benchmarks/test
# cp -rf pr/test/data ~/benchmarks/test/data cp -rf pr/test/data ~/benchmarks/test/data
# cp -rf pr/profiles ~/benchmarks/profiles cp -rf pr/profiles ~/benchmarks/profiles
# 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 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
# sudo umount ~/benchmarks sudo umount ~/benchmarks
# sudo cset shield --reset sudo cset shield --reset
# - name: Run Base Benchmarks - name: Run Base Benchmarks
# run: | run: |
# sudo cset shield -c 2-3 -k on sudo cset shield -c 2-3 -k on
# sudo mount -t tmpfs -o size=4g none ~/benchmarks sudo mount -t tmpfs -o size=4g none ~/benchmarks
# cp -rf base/build ~/benchmarks/build cp -rf base/build ~/benchmarks/build
# cp -rf base/lib ~/benchmarks/lib cp -rf base/lib ~/benchmarks/lib
# mkdir -p ~/benchmarks/test mkdir -p ~/benchmarks/test
# cp -rf base/test/data ~/benchmarks/test/data cp -rf base/test/data ~/benchmarks/test/data
# cp -rf base/profiles ~/benchmarks/profiles cp -rf base/profiles ~/benchmarks/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/test/data/portugal_to_korea.json ]; then if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then
# cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json cp base/src/benchmarks/portugal_to_korea.json ~/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 -- 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 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
# sudo umount ~/benchmarks sudo umount ~/benchmarks
# sudo cset shield --reset sudo cset shield --reset
# - name: Post Benchmark Results - name: Post Benchmark Results
# run: | run: |
# python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results
# - name: Show CCache statistics - name: Show CCache statistics
# run: | run: |
# ccache -p ccache -p
# ccache -s ccache -s
# ci-complete: ci-complete:
# runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
# needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks] needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks]
# steps: steps:
# - run: echo "CI complete" - run: echo "CI complete"

View File

@ -22,6 +22,7 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
endif() endif()
option(ENABLE_CONAN "Use conan for dependencies" OFF)
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON) option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
option(BUILD_TOOLS "Build OSRM tools" OFF) option(BUILD_TOOLS "Build OSRM tools" OFF)
option(BUILD_PACKAGE "Build OSRM package" OFF) option(BUILD_PACKAGE "Build OSRM package" OFF)
@ -45,7 +46,6 @@ if (ENABLE_CONAN)
else() else()
set(CMAKE_TOOLCHAIN_FILE "./conan_toolchain.cmake") set(CMAKE_TOOLCHAIN_FILE "./conan_toolchain.cmake")
# message(STATUS "Conan install stdout: ${CONAN_EXECUTABLE} install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=${CMAKE_BUILD_TYPE}")
execute_process( execute_process(
COMMAND ${CONAN_EXECUTABLE} install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=${CMAKE_BUILD_TYPE} COMMAND ${CONAN_EXECUTABLE} install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=${CMAKE_BUILD_TYPE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@ -53,11 +53,9 @@ if (ENABLE_CONAN)
ERROR_VARIABLE conan_stderr ERROR_VARIABLE conan_stderr
RESULT_VARIABLE conan_install_result RESULT_VARIABLE conan_install_result
) )
message(STATUS "Conan install stdout: ${conan_stdout} ${CMAKE_BUILD_TYPE}")
message(STATUS "Conan install stderr: ${conan_stderr}")
if (NOT conan_install_result EQUAL 0) if (NOT conan_install_result EQUAL 0)
message(FATAL_ERROR "Conan install failed.") message(FATAL_ERROR "Conan install failed: ${conan_install_result}. Stderr: ${conan_stderr}. Stdout: ${conan_stdout}")
endif() endif()
endif() endif()
endif() endif()

View File

@ -1,42 +0,0 @@
var OSRM = require('.');
var monaco_mld_path = require('./test/nodejs/constants').mld_data_path;
var two_test_coordinates = require('./test/nodejs/constants').two_test_coordinates;
const { performance } = require('perf_hooks');
const osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
const numberOfRoutes = 10;
let completedRoutes = 0;
let totalTime = 0;
function benchmarkRoutes() {
const startTime = performance.now();
for (let i = 0; i < numberOfRoutes; i++) {
const options = {
coordinates: [two_test_coordinates[0], two_test_coordinates[1]],
annotations: ['distance']
};
for (let i = 0; i < 1000; ++i) {
options.coordinates.push(two_test_coordinates[i % 2], two_test_coordinates[(i + 1) % 2]);
}
osrm.table(options, function(err, route) {
if (err) {
console.error(err);
return;
}
completedRoutes++;
if (completedRoutes === numberOfRoutes) {
const endTime = performance.now();
totalTime = endTime - startTime;
console.log(`Total time for ${numberOfRoutes} routes: ${totalTime}ms`);
console.log(`Average time per route: ${totalTime / numberOfRoutes}ms`);
}
});
}
}
benchmarkRoutes();

View File

@ -126,7 +126,7 @@ add_executable(util-tests
${UtilTestsSources} ${UtilTestsSources}
$<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:MICROTAR>) $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:MICROTAR>)
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS AND NOT ENABLE_CONAN) if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_TEST_DYN_LINK) add_definitions(-DBOOST_TEST_DYN_LINK)
endif() endif()