Commit 39ffffbf authored by GILLES Sebastien's avatar GILLES Sebastien

#1496 Add verrou analysis to CI.

parent af61d151
Pipeline #101050 passed with stages
in 30 minutes and 6 seconds
stages:
- build_and_test
- check_warnings
- verrou
- valgrind
- analysis
- generate_sonarqube
......
......@@ -98,6 +98,7 @@ if __name__ == "__main__":
print("include:")
print(" - local: '/ExternalTools/Gitlab-CI/common.yml'")
print(" - local: '/ExternalTools/Gitlab-CI/valgrind.yml'")
print(" - local: '/ExternalTools/Gitlab-CI/verrou.yml'")
print(" - local: '/ExternalTools/Gitlab-CI/analysis.yml'\n\n")
configuration_list = \
......
include:
- local: '/ExternalTools/Gitlab-CI/common.yml'
- local: '/ExternalTools/Gitlab-CI/valgrind.yml'
- local: '/ExternalTools/Gitlab-CI/verrou.yml'
- local: '/ExternalTools/Gitlab-CI/analysis.yml'
build_ubuntu_gcc_debug_several_shared_libraries:
......
......@@ -6,7 +6,7 @@
- cd build && python ../Scripts/CI/Valgrind/run_valgrind_${MODEL_NAME}.py
dependencies: []
cache:
key: "cache_${CI_PROJECT_ID}_${CI_COMMIT_REF_SLUG}_${MODEL_NAME}"
key: "cache_${CI_PROJECT_ID}_${CI_COMMIT_REF_SLUG}_valgrind_${MODEL_NAME}"
untracked: true
paths:
- build
......
.template_verrou: &template_verrou
stage: verrou
image: registry.gitlab.inria.fr/morefem/analysistools/verrou:latest
script:
- mkdir -p build
- cd build && python ../Scripts/CI/Verrou/run_verrou_${MODEL_NAME}.py
dependencies: []
cache:
key: "cache_${CI_PROJECT_ID}_${CI_COMMIT_REF_SLUG}_verrou_${MODEL_NAME}"
untracked: true
paths:
- build
artifacts:
name: "artifact_${CI_PROJECT_ID}_${CI_COMMIT_REF_SLUG}_${OS}-verrou-${MODEL_NAME}"
expire_in: 2 days
when: always
paths:
- verrou_${MODEL_NAME}.txt
only:
- develop@morefem/corelibrary/morefem
- /(verrou)/
- /(full_ci_analysis)/
allow_failure: true
verrou-elasticity:
extends: .template_verrou
variables:
MODEL_NAME: "elasticity"
tags: # arbitrary just to be sure to always select the same machine for a given build
- ubuntu
- gcc
- debug
verrou-heat:
extends: .template_verrou
variables:
MODEL_NAME: "heat"
tags: # arbitrary just to be sure to always select the same machine for a given build
- ubuntu
- gcc
- release
verrou-hyperelasticity:
extends: .template_verrou
variables:
MODEL_NAME: "hyperelasticity"
tags: # arbitrary just to be sure to always select the same machine for a given build
- fedora
- gcc
- debug
verrou-laplacian:
extends: .template_verrou
variables:
MODEL_NAME: "laplacian"
tags: # arbitrary just to be sure to always select the same machine for a given build
- fedora
- gcc
- release
verrou-rivlin_cube:
extends: .template_verrou
variables:
MODEL_NAME: "rivlin_cube"
tags: # arbitrary just to be sure to always select the same machine for a given build
- fedora
- clang
- debug
verrou-stokes:
extends: .template_verrou
variables:
MODEL_NAME: "stokes"
tags: # arbitrary just to be sure to always select the same machine for a given build
- fedora
- clang
- release
verrou-test_matrix_operations:
extends: .template_verrou
variables:
MODEL_NAME: "test_matrix_operations"
tags:
- large
- qlf-ci.inria.fr
\ No newline at end of file
......@@ -266,17 +266,17 @@ Each time you push code to your repository, CI should be kicked off. By default
There are additional optional steps also available in CI:
- One named 'valgrind', which runs Valgrind on the embedded models and on few tests.
- One named 'verrou', which runs [Verrou](https://github.com/edf-hpc/verrou) (a floating-point precision tool) on the embedded models and on few tests.
- One named 'analysis', which runs several static analysis tools. Another stage 'sonarqube' aggregates the results and put them on a [Sonarqube](https://sonarqube.inria.fr/sonarqube)] instance.
There are three ways to kick in these stages:
- Push onto 'develop' branch of the main project (reserved for the integrator - i.e. myself only for the time being).
- Push onto a branch which include 'valgrind' (for Valgrind) or 'sonarqube' (for the static analysis) in its name. Both may be combined: if you push to a branch named 10000_new_feature_sonarqube_valgrind all will be triggered.
- Push onto a branch which name include 'full_ci_analysis'. This will trigger everything. Currently it's equivalent to putting 'sonarqube' and 'valgrind' in the name of the branch, but if additional optional stages are added they will be automatically be encompassed there.
- Push onto a branch which include 'valgrind' (for Valgrind), 'sonarqube' (for the static analysis) or 'verrou' (for floating-point precision) in its name. Several may be combined: if you push to a branch named 10000_new_feature_sonarqube_valgrind both sonarqube and valgrind will be triggered (but not verrou),.
- Push onto a branch which name include 'full_ci_analysis'. This will trigger everything.
For the Sonarqube stage, you need to define the environment variable `SONARQUBE_LOGIN` in the gitlab fork of MoReFEM, and assign to it the token generated on your [Sonarqube account](https://sonarqube.inria.fr/sonarqube/account/security).
## Setting up CI for your fork
See <a href="Documentation/ContinuousIntegration/README.md">the dedicated README</a> to see how to set up the CI pipeline for your own fork.
......
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "Elasticity", "demo_2d_binary.lua")
#
RunVerrou("Sources/MoReFEM4Elasticity", lua_file, os.path.join(morefem_root_dir, "verrou_elasticity.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "Heat", "demo_input_heat.lua")
#
RunVerrou("Sources/MoReFEM4Heat", lua_file, os.path.join(morefem_root_dir, "memcheck_heat.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "Hyperelasticity", "demo_test.lua")
#
RunVerrou("Sources/MoReFEM4Hyperelasticity", lua_file, os.path.join(morefem_root_dir, "memcheck_hyperelasticity.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "Laplacian", "demo_input_laplacian.lua")
#
RunVerrou("Sources/MoReFEM4Laplacian", lua_file, os.path.join(morefem_root_dir, "memcheck_laplacian.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "RivlinCube", "demo_input_rivlin_cube_hexahedra.lua")
RunVerrou("Sources/MoReFEM4RivlinCube", lua_file, os.path.join(morefem_root_dir, "memcheck_rivlin_cube.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunValgrind
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
morefem_model_instances_dir = os.path.join(morefem_root_dir, "Sources", "ModelInstances")
lua_file = os.path.join(morefem_model_instances_dir, "Stokes", "demo.lua")
RunValgrind("Sources/MoReFEM4Stokes", lua_file, os.path.join(morefem_root_dir, "memcheck_stokes.txt"))
import os
from run_verrou_tools import MoReFEMRootDir, RunVerrou
if __name__ == "__main__":
morefem_root_dir = MoReFEMRootDir()
lua_file = os.path.join(morefem_root_dir, "Sources", "Test", "ThirdParty", "PETSc", "MatrixOperations", "demo.lua")
RunVerrou("Sources/MoReFEMTestPetscMatrixOperations", lua_file, os.path.join(morefem_root_dir, "memcheck_test_matrix_operations.txt"), is_model = False)
import os
import pathlib
import sys
import shutil
import subprocess
def MoReFEMRootDir():
"""Returns the path to the root dir of MoReFEM.
This uses up the fact the directory in which present script is stored is known.
"""
return pathlib.Path(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..").resolve()
class RunValgrind:
"""Compile the sources related to one executable and then run the Valgrind analysis on the executable.
\param[in] executable Executable to compile (e.g. MoReFEM4Elasticity).
\param[in] lua_file Lua file with the data required to run the model.
\param[in] output File in which output of the Valgrind analysis is written.
\param[in] is_model True if a model is involved, False otherwise.
"""
def __init__(self, executable, lua_file, output, is_model = True):
self.__executable = executable
self.__lua_file = lua_file
self.__output = output
self.__morefem_root_dir = MoReFEMRootDir()
self.__is_model = is_model
try:
self._callCMake()
self._compile()
self._runValgrind()
except subprocess.CalledProcessError as e:
print("Error in process: {}".format(e))
sys.exit(e.returncode)
def _callCMake(self):
morefem_cmake_dir = os.path.join(self.__morefem_root_dir, "cmake")
cmd = ("python",
f"{morefem_cmake_dir}/Scripts/configure_cmake.py",
f"--cache_file={morefem_cmake_dir}/PreCache/linux.cmake",
f'--cmake_args=-G Ninja',
"--third_party_directory=/opt",
'--mode=debug')
subprocess.run(cmd, shell = False).check_returncode()
def _compile(self):
cmd = ("ninja", self.__executable)
subprocess.run(cmd, shell = False).check_returncode()
def _runValgrind(self):
os.environ["MOREFEM_ROOT"] = str(self.__morefem_root_dir)
cmd = ["valgrind",
"--error-exitcode=1",
f"--log-file={self.__output}",
"--gen-suppressions=all",
"--show-leak-kinds=all",
"--show-reachable=yes",
"--track-origins=yes",
"--leak-check=full",
"--errors-for-leak-kinds=all",
"--suppressions=../ExternalTools/Valgrind/openmpi.suppr",
"--suppressions=../ExternalTools/Valgrind/libgomp.suppr",
"--suppressions=../ExternalTools/Valgrind/libc.suppr",
self.__executable,
"-i",
self.__lua_file,
"-e",
"MOREFEM_RESULT_DIR=Results"]
if self.__is_model:
cmd.append("--overwrite_directory")
subprocess.run(cmd, shell = False).check_returncode()
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