diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bdc5ee51225..0e10805327a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -102,6 +102,18 @@ no_rotation: - docker - linux +ubuntu-20.04-sanitizer: + <<: *global_job_definition + image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:a1192b35590a1a474c55fe1e9a1e6c25758454ea + stage: build + script: + - export myconfig=maxset with_cuda=true with_coverage=false with_static_analysis=true with_asan=true with_ubsan=true test_timeout=900 ASAN_OPTIONS="allocator_may_return_null=1" OMPI_CC=clang-9 OMPI_CXX=clang++-9 CC=clang-9 CXX=clang++-9 UBSAN_OPTIONS=suppressions=${CI_PROJECT_DIR}/maintainer/CI/ubsan.supp + - bash maintainer/CI/build_cmake.sh + timeout: 2h + tags: + - docker + - linux + ### Builds with different Distributions debian:10: diff --git a/CMakeLists.txt b/CMakeLists.txt index 74e393e7b30..86b96f7c225 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -375,7 +375,9 @@ endif() if(WITH_CLANG_TIDY) find_package(ClangTidy "${CMAKE_CXX_COMPILER_VERSION}" EXACT REQUIRED) - set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}") + set(CLANG_TIDY_EXCLUDES "[{name: boost/mpi/collectives/all_reduce.hpp}]") + set(CMAKE_CXX_CLANG_TIDY + "${CLANG_TIDY_EXE};--line-filter=${CLANG_TIDY_EXCLUDES}") endif() if(WITH_TESTS) diff --git a/maintainer/CI/ubsan.supp b/maintainer/CI/ubsan.supp new file mode 100644 index 00000000000..8b97055ac07 --- /dev/null +++ b/maintainer/CI/ubsan.supp @@ -0,0 +1,10 @@ +# Stuff occuring in boost directly +null:boost/serialization/singleton.hpp +null:boost/mpi/detail/binary_buffer_iprimitive.hpp +null:boost/mpi/communicator.hpp + +# Caused by boost MPI +null:stl_iterator.h + +# function calls with invalid pointers in Cython-generated code +function:python/espressomd/*.cpp diff --git a/src/core/clang_thrust_workaround.cuh b/src/core/clang_thrust_workaround.cuh new file mode 100644 index 00000000000..75d00dd6720 --- /dev/null +++ b/src/core/clang_thrust_workaround.cuh @@ -0,0 +1,20 @@ +// This works around a bug which prevents compilation of trhust with Clang +// https://github.com/thrust/thrust/issues/1032 (comment) + +#ifndef CLANG_THRUST_WORKAROUND_CUH +#define CLANG_THRUST_WORKAROUND_CUH + +#ifdef __clang__ +#ifndef THRUST_CUB_NS_PREFIX +#define THRUST_CUB_NS_PREFIX namespace thrust::cuda_cub { +#define THRUST_CUB_NS_POSTFIX } + +#include + +using namespace thrust::cuda_cub::cub; +#include +#include +#endif + +#endif +#endif diff --git a/src/core/cuda_wrapper.hpp b/src/core/cuda_wrapper.hpp index 90677f7c6b3..379a9f728f5 100644 --- a/src/core/cuda_wrapper.hpp +++ b/src/core/cuda_wrapper.hpp @@ -21,6 +21,7 @@ #if defined(__CUDACC__) +#include "clang_thrust_workaround.cuh" #include #endif diff --git a/src/python/espressomd/CMakeLists.txt b/src/python/espressomd/CMakeLists.txt index 5eda89913bc..f1169c76318 100644 --- a/src/python/espressomd/CMakeLists.txt +++ b/src/python/espressomd/CMakeLists.txt @@ -105,7 +105,7 @@ foreach(cython_file ${cython_SRC}) ${outputpath} PROPERTIES COMPILE_FLAGS - "-Wno-pedantic -Wno-cpp -Wno-strict-aliasing -Wno-maybe-uninitialized -Wno-unused-variable" + "-Wno-pedantic -Wno-cpp -Wno-strict-aliasing -Wno-maybe-uninitialized -Wno-unused-variable -Wno-deprecated-declarations" ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") @@ -113,7 +113,7 @@ foreach(cython_file ${cython_SRC}) ${outputpath} PROPERTIES COMPILE_FLAGS - "-Wno-pedantic -Wno-#warnings -Wno-sometimes-uninitialized -Wno-unused-variable" + "-Wno-pedantic -Wno-#warnings -Wno-sometimes-uninitialized -Wno-unused-variable -Wno-deprecated-declarations" ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set_source_files_properties(${outputpath} PROPERTIES COMPILE_FLAGS