]> https://gitweb.dealii.org/ - candi.git/commitdiff
only set MPI_CXX_COMPILER if requested
authorTimo Heister <timo.heister@gmail.com>
Mon, 28 Jun 2021 01:43:02 +0000 (21:43 -0400)
committerTimo Heister <timo.heister@gmail.com>
Mon, 28 Jun 2021 01:44:40 +0000 (21:44 -0400)
Setting the compiler wrapper in CMake instead of in CC and CXX is
recommended, but only works for recent CMake versions (one configuration
I tested requires CMake 3.20 for the intel compiler).
With 9.3.1 deal.II supports setting CXX=mpicxx again, so only do the
above when a setting in candi.cfg is specified.
Works around #202
and fixes feature introduced in #159

candi.cfg
deal.II-toolchain/packages/dealii.package

index 09cf13f7e295c960bf4050242dd95c967f5e1cc2..fded43e2cb9fbfd0267a37d17a2f76de61c7a78f 100644 (file)
--- a/candi.cfg
+++ b/candi.cfg
@@ -36,6 +36,12 @@ NATIVE_OPTIMIZATIONS=OFF
 # Option {ON|OFF}: Enable building of dealii examples?
 BUILD_EXAMPLES=ON
 
+# Option {ON|OFF}: Unset CXX and set the compiler as MPI_CXX_COMPILER when configuring deal.II
+#
+# This is recommended for very recent CMake versions but it currently is not reliable enough
+# to enable by default.
+USE_DEAL_II_CMAKE_MPI_COMPILER=OFF
+
 # Option {ON|OFF}: Run tests after installation?
 RUN_DEAL_II_TESTS=OFF
 
index 1175822be68fc0d7b5f4a896859835898982f6dd..3f490dbe7ca0fd889bf14c916fdaa1ac461385ec 100644 (file)
@@ -18,8 +18,6 @@ INSTALL_PATH=${ORIG_INSTALL_PATH}/deal.II-${VERSION}
 CONFOPTS=" \
 -D CMAKE_BUILD_TYPE=DebugRelease \
 -D DEAL_II_WITH_MPI:BOOL=ON \
--D MPI_CXX_COMPILER=${CXX} \
--D MPI_C_COMPILER=${CC} \
 -D DEAL_II_COMPONENT_DOCUMENTATION:BOOL=OFF \
 -D DEAL_II_WITH_LAPACK:BOOL=ON \
 -D DEAL_II_WITH_UMFPACK:BOOL=ON \
@@ -43,16 +41,22 @@ if [ ${NATIVE_OPTIMIZATIONS} = ON ]; then
       -D CMAKE_CXX_FLAGS='-march=native'"
 fi
 
+if [ ${USE_DEAL_II_CMAKE_MPI_COMPILER} = ON ]; then
+    # Disable CXX, CC for deal.II as recommended in
+    # https://github.com/dealii/dealii/issues/11478 and set MPI_*_COMPILER
+    # cmake variables. This only works for recent CMake versions.
+    CONFOPTS="${CONFOPTS} \
+    -D MPI_CXX_COMPILER=${CXX} \
+    -D MPI_C_COMPILER=${CC}"
+
+    unset CXX
+    unset CC
+fi
+
 # add the user-specified flags at the end (so things can be overriden):
 CONFOPTS="${CONFOPTS} \
 ${DEAL_II_CONFOPTS}"
 
-# Disable CXX, CC for deal.II as recommended in
-# https://github.com/dealii/dealii/issues/11478 . Note the we are
-# setting the MPI_*_COMPILER cmake variables above.
-unset CXX
-unset CC
-
 ################################################################################
 # Check if we hit cmake-3.10+ and deal.II v8.5.1 configure error (MPI / FindMPI)
 # cf. https://github.com/dealii/dealii/issues/5510

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.