From 6261a60853d2674a3695694b62fbdc8fbf47fdcf Mon Sep 17 00:00:00 2001 From: Alfio Lazzaro Date: Wed, 12 Jul 2023 13:07:48 +0200 Subject: [PATCH] Build MPICH to avoid LTO of the ubuntu package --- cmake/CompilerConfiguration.cmake | 2 +- tools/docker/Dockerfile.build-env-ubuntu | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/CompilerConfiguration.cmake b/cmake/CompilerConfiguration.cmake index 8e4b2edec54..4896a624590 100644 --- a/cmake/CompilerConfiguration.cmake +++ b/cmake/CompilerConfiguration.cmake @@ -6,7 +6,7 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") # requires for 10+ for the MPI wrap module endif () set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -funroll-loops") - set(CMAKE_Fortran_FLAGS_COVERAGE "-O0 -g --coverage -fno-omit-frame-pointer -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace -finit-real=snan -finit-integer=-42 -finit-derived -Werror=realloc-lhs -finline-matmul-limit=0 -Werror") + set(CMAKE_Fortran_FLAGS_COVERAGE "-O0 -g --coverage -fno-omit-frame-pointer -fcheck=all,no-array-temps -ffpe-trap=invalid,zero,overflow -fbacktrace -finit-real=snan -finit-integer=-42 -finit-derived -Werror=realloc-lhs -finline-matmul-limit=0 -Werror") set(CMAKE_Fortran_FLAGS_DEBUG "-O2 -ggdb -fno-omit-frame-pointer -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace -finit-real=snan -finit-integer=-42 -finit-derived -finline-matmul-limit=0 -fsanitize=undefined -fsanitize=address -fsanitize-recover=all -Wall -Wextra -Werror -Werror=realloc-lhs -Wno-error=array-temporaries -Wno-error=compare-reals -Wno-error=function-elimination -Wno-error=surprising") if ((NOT (USE_MPI)) OR (NOT ("${MPI_Fortran_LIBRARY_VERSION_STRING}" MATCHES "Open MPI"))) set(CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_COVERAGE} -fsanitize=leak") diff --git a/tools/docker/Dockerfile.build-env-ubuntu b/tools/docker/Dockerfile.build-env-ubuntu index c038f2e9cf0..73c935dec18 100644 --- a/tools/docker/Dockerfile.build-env-ubuntu +++ b/tools/docker/Dockerfile.build-env-ubuntu @@ -29,8 +29,8 @@ RUN set -ex ; \ g++ \ openmpi-bin \ libopenmpi-dev \ - mpich \ - libmpich-dev \ + mpich \ + libmpich-dev \ libopenblas-openmp-dev \ cmake \ ninja-build \ @@ -64,6 +64,12 @@ RUN set -ex ; \ ENV PKG_CONFIG_PATH="/opt/libxsmm/lib:${PKG_CONFIG_PATH}" +# Remove LTO for MPICH (default now in Ubuntu >=22) +RUN set -ex ; \ + for ff in /usr/lib/x86_64-linux-gnu/pkgconfig/mpich.pc /usr/bin/mpicc.mpich /usr/bin/mpicxx.mpich /usr/bin/mpif77.mpich /usr/bin/mpif90.mpich /usr/bin/mpifort.mpich; do \ + sed -i -e 's/-flto=auto//g' -e 's/-ffat-lto-objects//g' ${ff}; \ + done + # Leak suppression COPY lsan.supp /opt ENV LSAN_OPTIONS=suppressions=/opt/lsan.supp