diff --git a/modules/find/FindMUMPS.cmake b/modules/find/FindMUMPS.cmake index f901df48e104f3b7c309c06b5f2686990ed69efd..814899bc200a9405dc6243ac07c7933617e4384c 100644 --- a/modules/find/FindMUMPS.cmake +++ b/modules/find/FindMUMPS.cmake @@ -31,6 +31,7 @@ # - METIS: to activate detection of MUMPS linked with METIS # - PARMETIS: to activate detection of MUMPS linked with PARMETIS # - OPENMP: to activate detection of MUMPS linked with OPENMP +# - BLASMT: to use multithreaded BLAS only # # This module finds headers and mumps library. # Results are reported in variables: @@ -82,6 +83,7 @@ set(MUMPS_LOOK_FOR_PTSCOTCH OFF) set(MUMPS_LOOK_FOR_METIS OFF) set(MUMPS_LOOK_FOR_PARMETIS OFF) set(MUMPS_LOOK_FOR_OPENMP OFF) +set(MUMPS_LOOK_FOR_BLASMT OFF) if( MUMPS_FIND_COMPONENTS ) foreach( component ${MUMPS_FIND_COMPONENTS} ) @@ -110,6 +112,9 @@ if( MUMPS_FIND_COMPONENTS ) if (${component} STREQUAL "OPENMP") set(MUMPS_LOOK_FOR_OPENMP ON) endif() + if (${component} STREQUAL "BLASMT") + set(MUMPS_LOOK_FOR_BLASMT ON) + endif() endforeach() endif() @@ -150,7 +155,7 @@ endif () if (NOT MUMPS_FIND_QUIETLY) message(STATUS "Looking for MUMPS - Try to detect BLAS") endif() -if (NOT BLASEXT_FOUND) +if (NOT BLAS_FOUND) if (MUMPS_FIND_REQUIRED) find_package(BLASEXT REQUIRED) else() @@ -341,16 +346,16 @@ else() set(MUMPS_${mumps_hdr}_DIRS "MUMPS_${mumps_hdr}_INCLUDE_DIRS-NOTFOUND") foreach(mumps_hdr ${MUMPS_hdrs_to_find}) find_path(MUMPS_${mumps_hdr}_DIRS - NAMES ${mumps_hdr} - HINTS ${MUMPS_DIR} - PATH_SUFFIXES "include") + NAMES ${mumps_hdr} + HINTS ${MUMPS_DIR} + PATH_SUFFIXES "include") endforeach() else() foreach(mumps_hdr ${MUMPS_hdrs_to_find}) set(MUMPS_${mumps_hdr}_DIRS "MUMPS_${mumps_hdr}_INCLUDE_DIRS-NOTFOUND") find_path(MUMPS_${mumps_hdr}_DIRS - NAMES ${mumps_hdr} - HINTS ${_inc_env}) + NAMES ${mumps_hdr} + HINTS ${_inc_env}) endforeach() endif() endif() @@ -434,16 +439,16 @@ else() foreach(mumps_lib ${MUMPS_libs_to_find}) set(MUMPS_${mumps_lib}_LIBRARY "MUMPS_${mumps_lib}_LIBRARY-NOTFOUND") find_library(MUMPS_${mumps_lib}_LIBRARY - NAMES ${mumps_lib} - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib lib32 lib64) + NAMES ${mumps_lib} + HINTS ${MUMPS_DIR} + PATH_SUFFIXES lib lib32 lib64) endforeach() else() foreach(mumps_lib ${MUMPS_libs_to_find}) set(MUMPS_${mumps_lib}_LIBRARY "MUMPS_${mumps_lib}_LIBRARY-NOTFOUND") find_library(MUMPS_${mumps_lib}_LIBRARY - NAMES ${mumps_lib} - HINTS ${_lib_env}) + NAMES ${mumps_lib} + HINTS ${_lib_env}) endforeach() endif() endif() @@ -579,7 +584,6 @@ if(MUMPS_LIBRARIES) endif() endforeach() set(REQUIRED_LIBS "${MUMPS_LIBRARIES}") - # SCALAPACK if (MUMPS_LOOK_FOR_MPI AND SCALAPACK_FOUND) if (SCALAPACK_INCLUDE_DIRS) @@ -587,7 +591,7 @@ if(MUMPS_LIBRARIES) endif() foreach(libdir ${SCALAPACK_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${SCALAPACK_LIBRARIES}") @@ -602,7 +606,7 @@ if(MUMPS_LIBRARIES) endif() if (MPI_Fortran_LINK_FLAGS) if (${MPI_Fortran_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_Fortran_LINK_FLAGS ${MPI_Fortran_LINK_FLAGS}) + string(REGEX REPLACE " -" "-" MPI_Fortran_LINK_FLAGS ${MPI_Fortran_LINK_FLAGS}) endif() list(APPEND REQUIRED_LDFLAGS "${MPI_Fortran_LINK_FLAGS}") endif() @@ -613,12 +617,20 @@ if(MUMPS_LIBRARIES) if (BLAS_INCLUDE_DIRS) list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) + if(MUMPS_LOOK_FOR_BLASMT) + set(_mumps_blas_lib ${BLAS_PAR_LIBRARIES}) + else() + set(_mumps_blas_lib ${BLAS_SEQ_LIBRARIES}) + endif() + if(NOT _mumps_blas_lib) + set(_mumps_blas_lib ${BLAS_LIBRARIES}) + endif() + foreach(libdir ${_mumps_blas_lib}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") + list(APPEND REQUIRED_LIBS "${_mumps_blas_lib}") if (BLAS_LINKER_FLAGS) list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") endif() @@ -630,7 +642,7 @@ if(MUMPS_LIBRARIES) endif() foreach(libdir ${SCOTCH_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}") @@ -642,7 +654,7 @@ if(MUMPS_LIBRARIES) endif() foreach(libdir ${PTSCOTCH_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}") @@ -654,7 +666,7 @@ if(MUMPS_LIBRARIES) endif() foreach(libdir ${METIS_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}") @@ -666,7 +678,7 @@ if(MUMPS_LIBRARIES) endif() foreach(libdir ${PARMETIS_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${PARMETIS_LIBRARIES}") @@ -746,8 +758,8 @@ if(MUMPS_LIBRARIES) message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") message(STATUS "Maybe MUMPS is linked with specific libraries. " - "Have you tried with COMPONENTS (MPI/SEQ, SCOTCH, PTSCOTCH, METIS, PARMETIS)? " - "See the explanation in FindMUMPS.cmake.") + "Have you tried with COMPONENTS (MPI/SEQ, SCOTCH, PTSCOTCH, METIS, PARMETIS)? " + "See the explanation in FindMUMPS.cmake.") endif() endif() diff --git a/modules/find/FindPASTIX.cmake b/modules/find/FindPASTIX.cmake index bb278e924e556cf909eb7674542bb90277b7dbbf..2d470ac6a76bd359807619cbb76c8e538966ccb0 100644 --- a/modules/find/FindPASTIX.cmake +++ b/modules/find/FindPASTIX.cmake @@ -35,6 +35,7 @@ # - SCOTCH: to activate detection of PASTIX linked with SCOTCH # - PTSCOTCH: to activate detection of PASTIX linked with SCOTCH # - METIS: to activate detection of PASTIX linked with SCOTCH +# - BLASMT: to use multithreaded BLAS only # # This module finds headers and pastix library. # Results are reported in variables: @@ -89,6 +90,7 @@ set(PASTIX_LOOK_FOR_STARPU_FXT OFF) set(PASTIX_LOOK_FOR_SCOTCH ON) set(PASTIX_LOOK_FOR_PTSCOTCH OFF) set(PASTIX_LOOK_FOR_METIS OFF) +set(PASTIX_LOOK_FOR_BLASMT OFF) if( PASTIX_FIND_COMPONENTS ) foreach( component ${PASTIX_FIND_COMPONENTS} ) @@ -124,6 +126,9 @@ if( PASTIX_FIND_COMPONENTS ) if (${component} STREQUAL "METIS") set(PASTIX_LOOK_FOR_METIS ON) endif() + if (${component} STREQUAL "BLASMT") + set(PASTIX_LOOK_FOR_BLASMT ON) + endif() endforeach() endif() @@ -165,7 +170,7 @@ if(UNIX OR WIN32) else() if (PASTIX_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") + "Are you sure to a have a C compiler installed?") endif() endif() endif() @@ -208,10 +213,12 @@ endif() if (NOT PASTIX_FIND_QUIETLY) message(STATUS "Looking for PASTIX - Try to detect BLAS") endif() -if (PASTIX_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) -else() - find_package(BLASEXT) +if (NOT BLAS_FOUND) + if (PASTIX_FIND_REQUIRED) + find_package(BLASEXT REQUIRED) + else() + find_package(BLASEXT) + endif() endif() # Optional dependencies @@ -446,16 +453,16 @@ else() foreach(pastix_lib ${PASTIX_libs_to_find}) set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND") find_library(PASTIX_${pastix_lib}_LIBRARY - NAMES ${pastix_lib} - HINTS ${PASTIX_DIR} - PATH_SUFFIXES lib lib32 lib64) + NAMES ${pastix_lib} + HINTS ${PASTIX_DIR} + PATH_SUFFIXES lib lib32 lib64) endforeach() else() foreach(pastix_lib ${PASTIX_libs_to_find}) set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND") find_library(PASTIX_${pastix_lib}_LIBRARY - NAMES ${pastix_lib} - HINTS ${_lib_env}) + NAMES ${pastix_lib} + HINTS ${_lib_env}) endforeach() endif() endif() @@ -514,11 +521,11 @@ if(PASTIX_LIBRARIES) list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}") elseif (STARPU_LIBRARIES) foreach(lib ${STARPU_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() + if (EXISTS ${lib} OR ${lib} MATCHES "^-") + list(APPEND REQUIRED_LIBS "${lib}") + else() + list(APPEND REQUIRED_LIBS "-l${lib}") + endif() endforeach() endif() endif() @@ -529,7 +536,7 @@ if(PASTIX_LIBRARIES) endif() foreach(libdir ${CUDA_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") @@ -541,7 +548,7 @@ if(PASTIX_LIBRARIES) endif() if (MPI_C_LINK_FLAGS) if (${MPI_C_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) + string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) endif() list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}") endif() @@ -554,14 +561,14 @@ if(PASTIX_LIBRARIES) endif() foreach(libdir ${HWLOC_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() foreach(lib ${HWLOC_LIBRARIES}) if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") + list(APPEND REQUIRED_LIBS "${lib}") else() - list(APPEND REQUIRED_LIBS "-l${lib}") + list(APPEND REQUIRED_LIBS "-l${lib}") endif() endforeach() endif() @@ -570,12 +577,20 @@ if(PASTIX_LIBRARIES) if (BLAS_INCLUDE_DIRS) list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) + if(PASTIX_LOOK_FOR_BLASMT) + set(_pastix_blas_lib ${BLAS_PAR_LIBRARIES}) + else() + set(_pastix_blas_lib ${BLAS_SEQ_LIBRARIES}) + endif() + if(NOT _pastix_blas_lib) + set(_pastix_blas_lib ${BLAS_LIBRARIES}) + endif() + foreach(libdir ${_pastix_blas_lib}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") + list(APPEND REQUIRED_LIBS "${_pastix_blas_lib}") if (BLAS_LINKER_FLAGS) list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") endif() @@ -587,7 +602,7 @@ if(PASTIX_LIBRARIES) endif() foreach(libdir ${SCOTCH_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}") @@ -599,7 +614,7 @@ if(PASTIX_LIBRARIES) endif() foreach(libdir ${PTSCOTCH_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}") @@ -611,7 +626,7 @@ if(PASTIX_LIBRARIES) endif() foreach(libdir ${METIS_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}") @@ -674,8 +689,8 @@ if(PASTIX_LIBRARIES) message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") message(STATUS "Maybe PASTIX is linked with specific libraries. " - "Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? " - "See the explanation in FindPASTIX.cmake.") + "Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? " + "See the explanation in FindPASTIX.cmake.") endif() endif() set(CMAKE_REQUIRED_INCLUDES)