Skip to content

Commit

Permalink
ScalaPACK optional
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 2, 2024
1 parent 8d29b29 commit a3d1cd2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
9 changes: 9 additions & 0 deletions Readme_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion cmake/mumps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ target_include_directories(mumps_common PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_definitions(mumps_common PRIVATE ${ORDERING_DEFS})
target_compile_definitions(mumps_common PRIVATE
${ORDERING_DEFS}
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<NOT:$<BOOL:${scalapack}>>>: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 $<$<COMPILE_LANGUAGE:Fortran>:GEMMT_AVAILABLE>)
Expand Down Expand Up @@ -216,6 +219,7 @@ target_compile_definitions(${a}mumps PRIVATE
MUMPS_ARITH=MUMPS_ARITH_${a}
${ORDERING_DEFS}
$<$<AND:$<BOOL:${BLAS_HAVE_${a}GEMMT}>,$<COMPILE_LANGUAGE:Fortran>>:GEMMT_AVAILABLE>
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<NOT:$<BOOL:${scalapack}>>>:NOSCALAPACK>
)
target_include_directories(${a}mumps PUBLIC
"$<BUILD_INTERFACE:${mumps_SOURCE_DIR}/include;${NUMERIC_INC};${CMAKE_CURRENT_BINARY_DIR}/include>"
Expand Down
1 change: 1 addition & 0 deletions cmake/summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
5 changes: 5 additions & 0 deletions options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a3d1cd2

Please sign in to comment.