From 1ba0f0b5d362165fd3d2fbe597b0f77192640cea 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 | 14 ++++++++++++-- 2 files changed, 13 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..596aa7ca1df 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,16 @@ 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 ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects//' /usr/lib/x86_64-linux-gnu/pkgconfig/mpich.pc ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/lib/x86_64-linux-gnu/pkgconfig/mpich.pc ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/bin/mpicc.mpich ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/bin/mpicxx.mpich ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/bin/mpif77.mpich ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/bin/mpif90.mpich ; \ + sed -i 's/-flto=auto -ffat-lto-objects -flto=auto//' /usr/bin/mpifort.mpich + # Leak suppression COPY lsan.supp /opt ENV LSAN_OPTIONS=suppressions=/opt/lsan.supp