diff --git a/cmake_modules/morse/find/FindMETIS.cmake b/cmake_modules/morse/find/FindMETIS.cmake index 89a8059046e0662faa3a2aa1d02471fafdc42612..e62bac7c96b57d8253fbe5f813f29011f44f3be5 100644 --- a/cmake_modules/morse/find/FindMETIS.cmake +++ b/cmake_modules/morse/find/FindMETIS.cmake @@ -169,6 +169,36 @@ else () endif() endif () +if(METIS_LIBRARIES) + # check a function to validate the find + set(CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}") + if (METIS_LIBRARY_DIRS) + set(CMAKE_REQUIRED_FLAGS "-L${METIS_LIBRARY_DIRS}") + endif() + + unset(METIS_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(METIS_NodeND METIS_WORKS) + mark_as_advanced(METIS_WORKS) + + if(METIS_WORKS) + set(METIS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + else() + if(NOT METIS_FIND_QUIETLY) + message(STATUS "Looking for METIS : test of METIS_NodeND with METIS library fails") + message(STATUS "METIS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") + message(STATUS "METIS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") + message(STATUS "METIS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") + message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") + message(STATUS "Looking for METIS : set METIS_LIBRARIES to NOTFOUND") + endif() + set(METIS_LIBRARIES "METIS_LIBRARIES-NOTFOUND") + endif() + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) +endif(METIS_LIBRARIES) # check that METIS has been found # --------------------------------- diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake index 303b503cb26180296c0f996a2c7cbba8e4e5f720..15407aeadaee8caab95eb76a521fd1906221520a 100644 --- a/cmake_modules/morse/find/FindPARMETIS.cmake +++ b/cmake_modules/morse/find/FindPARMETIS.cmake @@ -188,12 +188,43 @@ else () set(PARMETIS_LIBRARY_DIRS "PARMETIS_LIBRARY_DIRS-NOTFOUND") if (NOT PARMETIS_FIND_QUIETLY) message(STATUS "Looking for parmetis -- lib parmetis not found") - endif + endif() endif () +if(PARMETIS_LIBRARIES) + # check a function to validate the find + set(CMAKE_REQUIRED_INCLUDES "${PARMETIS_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${PARMETIS_LIBRARIES}") + if (PARMETIS_LIBRARY_DIRS) + set(CMAKE_REQUIRED_FLAGS "-L${PARMETIS_LIBRARY_DIRS}") + endif() + + unset(PARMETIS_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(ParMETIS_V3_NodeND PARMETIS_WORKS) + mark_as_advanced(PARMETIS_WORKS) + + if(PARMETIS_WORKS) + set(PARMETIS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + else() + if(NOT PARMETIS_FIND_QUIETLY) + message(STATUS "Looking for PARMETIS : test of ParMETIS_V3_NodeND with PARMETIS library fails") + message(STATUS "PARMETIS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") + message(STATUS "PARMETIS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") + message(STATUS "PARMETIS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") + message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") + message(STATUS "Looking for PARMETIS : set PARMETIS_LIBRARIES to NOTFOUND") + endif() + set(PARMETIS_LIBRARIES "PARMETIS_LIBRARIES-NOTFOUND") + endif() + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) +endif(PARMETIS_LIBRARIES) + # check that PARMETIS has been found -# --------------------------------- +# ---------------------------------- include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PARMETIS DEFAULT_MSG PARMETIS_LIBRARIES diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake index 104ab9f127611acf6fcabbb720f2b4a4258317eb..a5f0d9fecd4a0150d957b932c49e662447da9da5 100644 --- a/cmake_modules/morse/find/FindPTSCOTCH.cmake +++ b/cmake_modules/morse/find/FindPTSCOTCH.cmake @@ -78,6 +78,15 @@ if( PTSCOTCH_FIND_COMPONENTS ) endforeach() endif() +# PTSCOTCH may depend on Threads, try to find it +if (NOT THREADS_FOUND) + find_package(Threads) +endif() + +# PTSCOTCH may depend on MPI, try to find it +if (NOT MPI_FOUND) + find_package(MPI) +endif() # Looking for include # ------------------- @@ -180,7 +189,7 @@ else() PATH_SUFFIXES lib lib32 lib64) endforeach() else() - foreach(scotch_lib ${PTSCOTCH_libs_to_find}) + foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY NAMES ${ptscotch_lib} @@ -212,6 +221,48 @@ foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) endforeach() +if(PTSCOTCH_LIBRARIES) + # check a function to validate the find + set(CMAKE_REQUIRED_INCLUDES "${PTSCOTCH_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${PTSCOTCH_LIBRARIES}") + if(CMAKE_THREAD_LIBS_INIT) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + endif() + if (PTSCOTCH_LIBRARY_DIRS) + set(CMAKE_REQUIRED_FLAGS "-L${PTSCOTCH_LIBRARY_DIRS}") + endif() + if (MPI_FOUND) + list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") + if (MPI_C_LINK_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${MPI_C_LINK_FLAGS}") + endif() + list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") + endif() + + unset(PTSCOTCH_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(SCOTCH_dgraphInit PTSCOTCH_WORKS) + mark_as_advanced(PTSCOTCH_WORKS) + + if(PTSCOTCH_WORKS) + set(PTSCOTCH_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + else() + if(NOT PTSCOTCH_FIND_QUIETLY) + message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails") + message(STATUS "PTSCOTCH_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") + message(STATUS "PTSCOTCH_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") + message(STATUS "PTSCOTCH_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") + message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") + message(STATUS "Looking for PTSCOTCH : set PTSCOTCH_LIBRARIES to NOTFOUND") + endif() + set(PTSCOTCH_LIBRARIES "PTSCOTCH_LIBRARIES-NOTFOUND") + endif() + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) +endif(PTSCOTCH_LIBRARIES) + + # Check the size of SCOTCH_Num # --------------------------------- set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS}) diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake index fff744c098374508ce60d39be2f37885b8d48587..c96b4ddd079a269133a07cf646e6ebeecab22c5f 100644 --- a/cmake_modules/morse/find/FindQUARK.cmake +++ b/cmake_modules/morse/find/FindQUARK.cmake @@ -214,12 +214,12 @@ if(QUARK_LIBRARIES) set(QUARK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") else() if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for quark : test of QUARK_New with quark library fails") + message(STATUS "Looking for QUARK : test of QUARK_New with QUARK library fails") message(STATUS "QUARK_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") message(STATUS "QUARK_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") message(STATUS "QUARK_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for quark : set QUARK_LIBRARIES to NOTFOUND") + message(STATUS "Looking for QUARK : set QUARK_LIBRARIES to NOTFOUND") endif() set(QUARK_LIBRARIES "QUARK_LIBRARIES-NOTFOUND") endif() diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake index 39843035b2ec355179c6e7d5de0bbf42061b74f4..1726e4db970f1fdeddb77eaacdedbc2d1f6d92c4 100644 --- a/cmake_modules/morse/find/FindSCOTCH.cmake +++ b/cmake_modules/morse/find/FindSCOTCH.cmake @@ -71,6 +71,10 @@ if( SCOTCH_FIND_COMPONENTS ) endforeach() endif() +# PTSCOTCH may depend on Threads, try to find it +if (NOT THREADS_FOUND) + find_package(Threads) +endif() # Looking for include # ------------------- @@ -205,6 +209,41 @@ foreach(scotch_lib ${SCOTCH_libs_to_find}) endforeach() +if(SCOTCH_LIBRARIES) + # check a function to validate the find + set(CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}") + if(CMAKE_THREAD_LIBS_INIT) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + endif() + if (SCOTCH_LIBRARY_DIRS) + set(CMAKE_REQUIRED_FLAGS "-L${SCOTCH_LIBRARY_DIRS}") + endif() + + unset(SCOTCH_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(SCOTCH_graphInit SCOTCH_WORKS) + mark_as_advanced(SCOTCH_WORKS) + + if(SCOTCH_WORKS) + set(SCOTCH_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + else() + if(NOT SCOTCH_FIND_QUIETLY) + message(STATUS "Looking for SCOTCH : test of SCOTCH_graphInit with SCOTCH library fails") + message(STATUS "SCOTCH_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") + message(STATUS "SCOTCH_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") + message(STATUS "SCOTCH_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") + message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") + message(STATUS "Looking for SCOTCH : set SCOTCH_LIBRARIES to NOTFOUND") + endif() + set(SCOTCH_LIBRARIES "SCOTCH_LIBRARIES-NOTFOUND") + endif() + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) +endif(SCOTCH_LIBRARIES) + + # Check the size of SCOTCH_Num # --------------------------------- set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS}) diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake index 4979773111d664825521fbaa35754ef99eec3bad..d5319fa41cf18404bc40cbed9a5a8431c6671f29 100644 --- a/cmake_modules/morse/find/FindSTARPU.cmake +++ b/cmake_modules/morse/find/FindSTARPU.cmake @@ -169,6 +169,17 @@ if(PKG_CONFIG_EXECUTABLE) endif(PKG_CONFIG_EXECUTABLE) +# STARPU may depend on CUDA, try to find it +if (NOT CUDA_FOUND) + find_package(CUDA) +endif() + +# STARPU may depend on MPI, try to find it +if (NOT MPI_FOUND) + find_package(MPI) +endif() + + if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR ( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) )