From a3d1cd259a625032dfc01b55b3c1c4177171a842 Mon Sep 17 00:00:00 2001 From: scivision Date: Wed, 1 May 2024 21:18:43 -0400 Subject: [PATCH] ScalaPACK optional --- CMakeLists.txt | 9 ++++++--- Readme_options.md | 9 +++++++++ cmake/mumps.cmake | 6 +++++- cmake/summary.cmake | 1 + options.cmake | 5 +++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd9c67c..690a8cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,13 +43,16 @@ find_package(Threads) if(parallel) find_package(MPI COMPONENTS C Fortran REQUIRED) - if(NOT DEFINED ENV{MKLROOT}) + if(NOT DEFINED ENV{MKLROOT} OR NOT scalapack) # oneMKL MKLConfig.cmake must be invoked only once include(cmake/lapack.cmake) endif() - include(cmake/scalapack.cmake) + set(NUMERIC_LIBS LAPACK::LAPACK) - set(NUMERIC_LIBS SCALAPACK::SCALAPACK LAPACK::LAPACK) + if(scalapack) + include(cmake/scalapack.cmake) + list(PREPEND NUMERIC_LIBS SCALAPACK::SCALAPACK) + endif() # avoid MPICH -fallow flag leakage set(NUMERIC_INC ${MPI_Fortran_INCLUDE_DIRS}) diff --git a/Readme_options.md b/Readme_options.md index 9b61014..526daea 100644 --- a/Readme_options.md +++ b/Readme_options.md @@ -29,6 +29,15 @@ HOWEVER, this requires all libraries INCLUDING MPI to be compiled with 64-bit in Otherwise, the program will crash at runtime with MPI errors. For example, oneAPI / oneMPI work, but default system installs of OpenMPI / MPICH will generally fail--the user will need to specially compile an MPI library with 64-bit integers. +## ScalaPACK + +ScalaPACK is only used for `parallel=on`. +ScalaPACK can be omitted with MUMPS ≥ 5.7.0 by option: + +```sh +cmake -Dscalapack=off +``` + ## MPI For systems where MPI, BLACS and SCALAPACK are not available, or where non-parallel execution is suitable, the default parallel can be disabled at CMake configure time by option: diff --git a/cmake/mumps.cmake b/cmake/mumps.cmake index 3b38577..f1ac19c 100644 --- a/cmake/mumps.cmake +++ b/cmake/mumps.cmake @@ -122,7 +122,10 @@ target_include_directories(mumps_common PUBLIC $ ) -target_compile_definitions(mumps_common PRIVATE ${ORDERING_DEFS}) +target_compile_definitions(mumps_common PRIVATE +${ORDERING_DEFS} +$<$,$>>:NOSCALAPACK> +) set(BLAS_HAVE_GEMMT FALSE) if(BLAS_HAVE_sGEMMT OR BLAS_HAVE_dGEMMT OR BLAS_HAVE_cGEMMT OR BLAS_HAVE_zGEMMT) target_compile_definitions(mumps_common PRIVATE $<$:GEMMT_AVAILABLE>) @@ -216,6 +219,7 @@ target_compile_definitions(${a}mumps PRIVATE MUMPS_ARITH=MUMPS_ARITH_${a} ${ORDERING_DEFS} $<$,$>:GEMMT_AVAILABLE> +$<$,$>>:NOSCALAPACK> ) target_include_directories(${a}mumps PUBLIC "$" diff --git a/cmake/summary.cmake b/cmake/summary.cmake index f6772ea..36e7407 100644 --- a/cmake/summary.cmake +++ b/cmake/summary.cmake @@ -3,6 +3,7 @@ add_feature_info(Parallel parallel "parallel MUMPS (using MPI and Scalapack)") add_feature_info(64-bit-integer intsize64 "use 64-bit integers in C and Fortran") add_feature_info(GEMMT BLAS_HAVE_GEMMT "use GEMMT for symmetric matrix-matrix multiplication") +add_feature_info(ScalaPACK scalapack "Scalapack linear algebra library https://www.netlib.org/scalapack/") add_feature_info(METIS metis "METIS graph partitioning https://github.com/KarypisLab/METIS") add_feature_info(parMETIS parmetis "parMETIS parallel graph partitioning") diff --git a/options.cmake b/options.cmake index 87237ba..8e1dc2e 100644 --- a/options.cmake +++ b/options.cmake @@ -10,6 +10,11 @@ option(parallel "parallel (use MPI)" ON) option(intsize64 "use 64-bit integers in C and Fortran") +option(scalapack "Use ScalaPACK to speed up the solution of linear systems" ON) +if(MUMPS_UPSTREAM_VERSION VERSION_LESS 5.7 AND NOT scalapack) + message(FATAL_ERROR "MUMPS version < 5.7 requires scalapack=on") +endif() + option(scotch "use Scotch orderings ") option(parmetis "use parallel METIS ordering")