From c52174654639ef65c32ab5e31377d9ecc2558f65 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Wed, 6 Jun 2018 09:58:15 +0200 Subject: [PATCH] added automatic test script --- .gitlab-ci.yml | 61 ++++++ apps/benchmarks/PeriodicGranularGas/upload.py | 187 ++++++++++++++++++ 2 files changed, 248 insertions(+) create mode 100644 apps/benchmarks/PeriodicGranularGas/upload.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b86b04e7c..fe6e951ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1528,3 +1528,64 @@ conda-py35-linux: - apt-get update - apt-get install -y build-essential - conda build --python=3.5 --user=lssfau utilities/conda/walberla + + +############################################################################### +## ## +## Benchmarks ## +## ## +############################################################################### + +.benchmark_template: &benchmark_definition + script: + - apt-get update --fix-missing + - apt-get install -y python3-influxdb python3-git + - $CXX --version + - cmake --version + - ccache --version + - mpirun --version + - export CCACHE_BASEDIR=$CI_PROJECT_DIR + - mkdir $CI_PROJECT_DIR/build + - cd $CI_PROJECT_DIR/build + - cmake .. -DWALBERLA_BUFFER_DEBUG=OFF -DWALBERLA_BUILD_TESTS=OFF -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=OFF -DWALBERLA_BUILD_TOOLS=OFF -DWALBERLA_BUILD_WITH_MPI=ON -DWALBERLA_BUILD_WITH_CUDA=OFF -DWALBERLA_BUILD_WITH_PYTHON=OFF -DWALBERLA_BUILD_WITH_OPENMP=OFF -DCMAKE_BUILD_TYPE=RELEASE -DMPIEXEC_PREFLAGS=$MPIEXEC_PREFLAGS -DWALBERLA_DOUBLE_ACCURACY=ON -DWARNING_ERROR=ON -DWALBERLA_BUILD_WITH_METIS=OFF -DWALBERLA_BUILD_WITH_PARMETIS=OFF -DWALBERLA_OPTIMIZE_FOR_LOCALHOST=ON -DWALBERLA_BUILD_WITH_FASTMATH=ON -DWALBERLA_BUILD_WITH_LTO=ON + - cmake . -LAH + - cd apps/benchmarks/PeriodicGranularGas + - make -j 20 + - export PATH=$PATH:/usr/local/likwid/bin + - likwid-setFrequencies -t 0 + - likwid-setFrequencies -g performance + - likwid-setFrequencies -x 3.3 -y 3.3 # set frequency to 3.3 + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --DEM --syncNextNeighbor | tee PeriodicGranularGas_DEM_NN.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --DEM --syncShadowOwners | tee PeriodicGranularGas_DEM_SO.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --HCSITS --syncNextNeighbor --InelasticFrictionlessContact | tee PeriodicGranularGas_HCSITS_NN_IFC.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --HCSITS --syncNextNeighbor --ApproximateInelasticCoulombContactByDecoupling | tee PeriodicGranularGas_HCSITS_NN_AICCBD.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --HCSITS --syncNextNeighbor --InelasticCoulombContactByDecoupling | tee PeriodicGranularGas_HCSITS_NN_ICCBD.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --HCSITS --syncNextNeighbor --InelasticGeneralizedMaximumDissipationContact | tee PeriodicGranularGas_HCSITS_NN_IGMDC.txt + - mpirun --allow-run-as-root -np 8 --map-by core --bind-to core --report-bindings ./PeriodicGranularGas PeriodicGranularGas.cfg --HCSITS --syncShadowOwners --InelasticFrictionlessContact | tee PeriodicGranularGas_HCSITS_SO_IFC.txt + - python3 upload.py + only: + variables: + - $ENABLE_BENCHMARKS + tags: + - docker-benchmark + artifacts: + paths: + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_DEM_NN.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_DEM_SO.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_HCSITS_NN_IFC.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_HCSITS_NN_AICCBD.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_HCSITS_NN_ICCBD.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_HCSITS_NN_IGMDC.txt + - $CI_PROJECT_DIR/build/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas_HCSITS_SO_IFC.txt + +benchmark_intel17: + <<: *benchmark_definition + image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:17 + +benchmark_gcc7: + <<: *benchmark_definition + image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:7 + +benchmark_clang6: + <<: *benchmark_definition + image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:6.0 \ No newline at end of file diff --git a/apps/benchmarks/PeriodicGranularGas/upload.py b/apps/benchmarks/PeriodicGranularGas/upload.py new file mode 100644 index 000000000..799476c1d --- /dev/null +++ b/apps/benchmarks/PeriodicGranularGas/upload.py @@ -0,0 +1,187 @@ +import os +import time +import math +import random +import re +from influxdb import InfluxDBClient +from git import Repo + + +def main(): + try: + write_user_pw = os.environ["INFLUXDB_WRITE_USER"] + except KeyError: + import sys + print('Password for the InfluxDB write_user was not set.\n', + 'See https://docs.gitlab.com/ee/ci/variables/#secret-variables', file=sys.stderr) + exc_info = sys.exc_info() + raise exc_info[0].with_traceback(exc_info[1], exc_info[2]) + + client = InfluxDBClient('i10grafana.informatik.uni-erlangen.de', 8086, + 'pe', write_user_pw, 'pe') + + #repo = Repo(search_parent_directories=True) + #commit = repo.head.commit + + with open("PeriodicGranularGas_DEM_NN.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'DEM', + 'friction': 'Coulomb', + 'sync' : 'next neighbor' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_DEM_SO.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'DEM', + 'friction': 'Coulomb', + 'sync' : 'shadow owner' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_HCSITS_NN_IFC.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'HCSITS', + 'friction': 'InelasticFrictionlessContact', + 'sync' : 'next neighbor' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_HCSITS_NN_AICCBD.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'HCSITS', + 'friction': 'ApproximateInelasticCoulombContactByDecoupling', + 'sync' : 'next neighbor' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_HCSITS_NN_ICCBD.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'HCSITS', + 'friction': 'InelasticCoulombContactByDecoupling', + 'sync' : 'next neighbor' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_HCSITS_NN_IGMDC.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'HCSITS', + 'friction': 'InelasticGeneralizedMaximumDissipationContact', + 'sync' : 'next neighbor' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + #************************************************* + + with open("PeriodicGranularGas_HCSITS_SO_IFC.txt") as f: + s = f.read() + m = re.search('runtime: (\d*.\d*)', s) + + json_body = [ + { + 'measurement': 'pe_benchmark', + 'tags': { + 'host' : os.uname()[1], + 'image' : os.environ["DOCKER_IMAGE_NAME"], + 'model' : 'HCSITS', + 'friction': 'InelasticFrictionlessContact', + 'sync' : 'shadow owner' + }, + 'time': int(time.time()), + 'fields': {'runtime': float(m.group(1))} + } + ] + print(float(m.group(1))) + client.write_points(json_body, time_precision='s') + + +if __name__ == "__main__": + main() -- GitLab