Commit 3948a4aa authored by Niklas Eiling's avatar Niklas Eiling Committed by Markus Mirz
Browse files

CI: add profiling to gitlab ci

parent 194520fa
......@@ -73,6 +73,25 @@ build:linux:
tags:
- docker
build:linux-profiling:
stage: build
needs: ["docker:centos"]
script:
- mkdir -p build
- cd build
- cmake -DWITH_PROFILING=ON -DWITH_ASAN=ON -DWITH_CUDA=OFF -DWITH_SPDLOG_SUBMODULE=ON ..
- make -j 32
image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
cache:
paths:
- build
key: build-linux-profiling
artifacts:
paths:
- build
tags:
- docker
build:linux-cuda:
stage: build
needs: ["docker:centos"]
......@@ -216,6 +235,80 @@ test:jupyter:
paths:
- outputs/Examples/Notebooks/
test:cppcheck 1/2:
stage: test
needs: ["docker:centos"]
script:
- cppcheck --max-configs=32 -j 32 --error-exitcode=1 -q --std=c++11 -I Include/ -I models/Include/ Source/ Examples/ models/Source/ | tee cppcheck-error.log
image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
dependencies:
- docker:centos
tags:
- docker
artifacts:
when: on_failure
paths:
- cppcheck-error.log
expose_as: 'cppcheck-error'
test:cppcheck 2/2:
stage: test
needs: ["docker:centos"]
allow_failure: true
script:
- cppcheck --max-configs=32 -j 32 --error-exitcode=1 -q --enable=warning,performance,portability,information,missingInclude --std=c++11 -I Include/ -I models/Include/ Source/ Examples/ models/Source/ | tee cppcheck-warn.log
image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
dependencies:
- docker:centos
tags:
- docker
artifacts:
when: on_failure
paths:
- cppcheck-warn.log
expose_as: 'cppcheck-warn'
.test-examples:
stage: test
needs: ["build:linux-profiling"]
script:
- $TEST_BINARY_PATH/$TEST_BINARY $TEST_PARAM 2>&1 | tee output.log
- cat output.log |
sed -n -E -e 's/^.*Average step time. ([0-9]+\.[0-9]+)$/step-time \1/p' |
tee -a metrics.txt
- gprof $TEST_BINARY_PATH/$TEST_BINARY | gprof2dot -s | dot -Tpng -o profiling.png || true
image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
dependencies:
- build:linux-profiling
tags:
- docker
artifacts:
reports:
metrics: metrics.txt
paths:
- profiling.png
expose_as: 'test-examples'
test:examples 1/1:
extends: .test-examples
variables:
# Name of the test binary
TEST_BINARY: 'WSCC_9bus_mult_decoupled'
# Path where the test binary is located
TEST_BINARY_PATH: 'build/Examples/Cxx'
# Command line parameters for the test binary
TEST_PARAM: ''
test:examples 2/2:
extends: .test-examples
variables:
# Name of the test binary
TEST_BINARY: 'WSCC_9bus_mult_coupled'
# Path where the test binary is located
TEST_BINARY_PATH: 'build/Examples/Cxx'
# Command line parameters for the test binary
TEST_PARAM: ''
.remote-gpu:
stage: test
needs: ["build:linux-cuda"]
......@@ -264,7 +357,7 @@ test:jupyter:
tags:
- docker
test:cuda:
test:cuda 1/2:
extends: .remote-gpu
allow_failure: true
variables:
......@@ -277,6 +370,19 @@ test:cuda:
# Command line parameters for the test binary
TEST_PARAM: ''
test:cuda 2/2:
extends: .remote-gpu
allow_failure: true
variables:
# Name of the test binary
TEST_BINARY: 'WSCC_9bus_mult_coupled'
# Path where the test binary is located
TEST_BINARY_PATH: 'build/Examples/Cxx'
# Additional files that are necessary to run the application on the GPU node
TEST_FILE: ''
# Command line parameters for the test binary
TEST_PARAM: ''
# Stage deploy
##############################################################################
pages:
......
......@@ -70,6 +70,8 @@ option(WITH_EIGEN_SUBMODULE "Build with Eigen as submodule" OFF)
option(WITH_SPDLOG_SUBMODULE "Build with Spdlog as submodule" OFF)
option(WITH_CIM_SUBMODULE "Build with CIMpp as submodule" OFF)
option(WITH_PROFILING "Add `-pg` profiling flag to compiliation" OFF)
option(WITH_ASAN "Adds compiler flags to use the address sanitizer" OFF)
option(WITH_TSAN "Adds compiler flags to use the thread sanitizer" OFF)
find_package(Threads REQUIRED)
......@@ -96,6 +98,22 @@ if (WITH_PROFILING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
if (WITH_ASAN)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize-address-use-after-scope")
else()
message(WARNING "WITH_ASAN is only supported when using GCC")
endif()
endif()
if (WITH_TSAN)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
else()
message(WARNING "WITH_TSAN is only supported when using GCC")
endif()
endif()
find_package(Sundials)
find_package(OpenMP)
find_package(CUDA)
......
......@@ -59,13 +59,13 @@ void simulateDecoupled(std::list<fs::path> filenames, Int copies, Int threads, I
+ "_" + std::to_string(threads) + "_" + std::to_string(seq);
Logger::setLogDir("logs/"+simName);
CIM::Reader reader(simName, Logger::Level::off, Logger::Level::off);
CIM::Reader reader(simName, Logger::Level::off, Logger::Level::info);
SystemTopology sys = reader.loadCIM(60, filenames);
if (copies > 0)
multiply_decoupled(sys, copies, 12.5, 0.16, 1e-6);
Simulation sim(simName, Logger::Level::off);
Simulation sim(simName, Logger::Level::info);
sim.setSystem(sys);
sim.setTimeStep(0.0001);
sim.setFinalTime(0.5);
......
......@@ -17,6 +17,8 @@ RUN dnf -y update && \
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm && \
dnf config-manager --set-enabled PowerTools && \
dnf config-manager --set-enabled remi
# We probably want to remove this once EPEL fixes their repos
RUN dnf config-manager --enable Devel
# CUDA dependencies
RUN dnf -y install https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-repo-rhel8-10.2.89-1.x86_64.rpm && \
......@@ -55,7 +57,7 @@ RUN dnf -y install \
# Dependencies
RUN dnf --refresh -y install \
python3-devel \
python36-devel \
eigen3-devel \
libxml2-devel \
graphviz-devel \
......@@ -72,6 +74,13 @@ RUN dnf -y install \
libwebsockets-devel \
mosquitto-devel
# Profiling dependencies
RUN dnf -y install \
graphviz \
libasan \
cppcheck
RUN pip3 install gprof2dot
# Install CIMpp
RUN cd /tmp && \
git clone --recurse-submodules https://github.com/CIM-IEC/libcimpp.git && \
......
......@@ -56,7 +56,7 @@ void RealTimeSimulation::run(const Timer::StartClock::time_point &startAt) {
#endif
auto now_time = std::chrono::system_clock::to_time_t(startAt);
log->info("Starting simulation at {} (delta_T = {} seconds)",
mLog->info("Starting simulation at {} (delta_T = {} seconds)",
std::put_time(std::localtime(&now_time), "%F %T"),
std::chrono::duration_cast<std::chrono::seconds>(startAt - Timer::StartClock::now()).count());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment