Skip to content

Commit

Permalink
Build MPICH to avoid LTO of the ubuntu package
Browse files Browse the repository at this point in the history
  • Loading branch information
alazzaro committed Jul 12, 2023
1 parent 0f1bff5 commit 1ba0f0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmake/CompilerConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 12 additions & 2 deletions tools/docker/Dockerfile.build-env-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ RUN set -ex ; \
g++ \
openmpi-bin \
libopenmpi-dev \
mpich \
libmpich-dev \
mpich \
libmpich-dev \
libopenblas-openmp-dev \
cmake \
ninja-build \
Expand Down Expand Up @@ -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

0 comments on commit 1ba0f0b

Please sign in to comment.