From d31ab331af700cffcadc19e3853c953c80bd0ec5 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Wed, 2 Aug 2023 13:43:09 +0200 Subject: [PATCH 01/18] Fix cmake for installation to a location --- CMakeLists.txt | 46 +++++++++++++++++++++++++++++++++++++ cmake/libROMConfig.cmake.in | 19 +++++++++++++++ lib/CMakeLists.txt | 45 ++++++++++++++++++++++++++++++++---- 3 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 cmake/libROMConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index af9036360..cd79eda6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,11 +29,14 @@ project(libROM HOMEPAGE_URL "https://github.com/LLNL/libROM" LANGUAGES C CXX Fortran) +include(GNUInstallDirs) + set(libROM_CMAKE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(libROM_CMAKE_MODULE_PATH ${libROM_CMAKE_PATH}/modules) list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH}) option(USE_MFEM "Build libROM with MFEM" OFF) +option(USE_EXTERNAL_MFEM "Build libROM with external MFEM specified in -DMFEM_DIR" OFF) option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) @@ -111,6 +114,11 @@ find_package(Doxygen 1.8.5) find_package(GTest 1.6.0) +if (USE_EXTERNAL_MFEM) + find_library(MFEM mfem "${MFEM_DIR}/lib") + find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") +endif() + if (USE_MFEM) find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") @@ -301,3 +309,41 @@ if(DOXYGEN_FOUND) add_dependencies(doxygen_tagfile documentation) endif(DOXYGEN_FOUND) + +#------------------------------------------------------------------------------- +# Installation +# Configure CMake find_package() config files +#------------------------------------------------------------------------------- + +# Default option +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +include(CMakePackageConfigHelpers) + +# Extract the enabled languages required to use ROM +get_property(ROM_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + +configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" +INSTALL_DESTINATION + ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +PATH_VARS + ROM_ENABLED_LANGUAGES +) + +write_basic_package_version_file( + "${PROJECT_NAME}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + +install(FILES + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake +DESTINATION + ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + diff --git a/cmake/libROMConfig.cmake.in b/cmake/libROMConfig.cmake.in new file mode 100644 index 000000000..0f994a17c --- /dev/null +++ b/cmake/libROMConfig.cmake.in @@ -0,0 +1,19 @@ +## Some copyright problably goes here +## Some licence should problably go here + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Targets.cmake") + +check_required_components("@PROJECT_NAME@") +check_required_components("ROM") + +# Variables required for linking etc. +set(libROM_LIBRARIES ROM) +set(libROM_ENABLED_LANGUAGES "@ROM_ENABLED_LANGUAGES@") + +check_required_components("@PROJECT_NAME@") +check_required_components("ROM") + + +# Somehow the dependencies should go here -> Did not yet get this working \ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 677d1a799..bf354a810 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -66,7 +66,7 @@ list(APPEND source_files linalg/Options.h librom.h) -if (USE_MFEM) +if (USE_MFEM OR USE_EXTERNAL_MFEM) list(APPEND source_files mfem/PointwiseSnapshot.hpp mfem/PointwiseSnapshot.cpp @@ -129,12 +129,49 @@ target_link_libraries(ROM ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MFEM} ${HYPRE} ${PARMETIS} ${METIS} PRIVATE ${ZLIB_LIBRARIES} ZLIB::ZLIB) -target_include_directories(ROM PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories(ROM + PUBLIC ${MFEM_INCLUDES} ${HYPRE_INCLUDES} ${PARMETIS_INCLUDES} ${HDF5_C_INCLUDE_DIRS} ${MPI_C_INCLUDE_DIRS} ${MFEM_C_INCLUDE_DIRS} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + $ + $ # Same as below with installation of headers + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + +#------------------------------------------------------------------------------- +# Installation +#------------------------------------------------------------------------------- +# Set version information +set_target_properties(ROM + PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) + +# Default option +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +install(TARGETS ROM + EXPORT libROM_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +# Target information about that artefact +install(EXPORT libROM_Targets + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libROM +) + +# Install headers +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING + PATTERN *.h + PATTERN *.inl + PATTERN *.hpp + PATTERN *.ih +) + From e09d264f5f4dc80201943876518af9b5fb8ebf68 Mon Sep 17 00:00:00 2001 From: Jacob Lotz Date: Wed, 30 Aug 2023 09:10:53 +0200 Subject: [PATCH 02/18] Added license to libROMConfig.cmake.in --- cmake/libROMConfig.cmake.in | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/libROMConfig.cmake.in b/cmake/libROMConfig.cmake.in index 0f994a17c..d42c7cd97 100644 --- a/cmake/libROMConfig.cmake.in +++ b/cmake/libROMConfig.cmake.in @@ -1,5 +1,12 @@ -## Some copyright problably goes here -## Some licence should problably go here +############################################################################### +# +# Copyright (c) 2013-2023, Lawrence Livermore National Security, LLC +# and other libROM project developers. See the top-level COPYRIGHT +# file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +# +############################################################################### @PACKAGE_INIT@ @@ -16,4 +23,4 @@ check_required_components("@PROJECT_NAME@") check_required_components("ROM") -# Somehow the dependencies should go here -> Did not yet get this working \ No newline at end of file +# Somehow the dependencies should go here -> Did not yet get this working From 0cd33312867f459ed20b78348ff914ac82207fe7 Mon Sep 17 00:00:00 2001 From: Jacob Lotz Date: Thu, 31 Aug 2023 14:12:57 +0200 Subject: [PATCH 03/18] Streamlined input options --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd79eda6c..2dd406c89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,11 +36,19 @@ set(libROM_CMAKE_MODULE_PATH ${libROM_CMAKE_PATH}/modules) list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH}) option(USE_MFEM "Build libROM with MFEM" OFF) -option(USE_EXTERNAL_MFEM "Build libROM with external MFEM specified in -DMFEM_DIR" OFF) option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) +# Check if external MFEM dir is defined in cmake option "-DMFEM_DIR" +if(MFEM_DIR STREQUAL "") + set(USE_EXTERNAL_MFEM OFF) +else() + set(USE_EXTERNAL_MFEM ON) +endif() +message("---------MFEM_DIR=${MFEM_DIR}") +message("---------USE_EXTERNAL_MFEM=${USE_EXTERNAL_MFEM}") + ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR From 7eb30d2c1e05128d248062cb9f1307e8e6939da4 Mon Sep 17 00:00:00 2001 From: Jacob Lotz Date: Thu, 31 Aug 2023 14:37:07 +0200 Subject: [PATCH 04/18] Proposition for construction for finding MFEM. --- CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dd406c89..7220486d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,14 +40,12 @@ option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) -# Check if external MFEM dir is defined in cmake option "-DMFEM_DIR" +# Check if external MFEM directory is defined in cmake option "-DMFEM_DIR" if(MFEM_DIR STREQUAL "") set(USE_EXTERNAL_MFEM OFF) else() set(USE_EXTERNAL_MFEM ON) endif() -message("---------MFEM_DIR=${MFEM_DIR}") -message("---------USE_EXTERNAL_MFEM=${USE_EXTERNAL_MFEM}") ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated @@ -125,9 +123,7 @@ find_package(GTest 1.6.0) if (USE_EXTERNAL_MFEM) find_library(MFEM mfem "${MFEM_DIR}/lib") find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") -endif() - -if (USE_MFEM) +elseif (USE_MFEM) find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") From 311cd88c95390bd6d8884a7a6e1635c7f8b0d510 Mon Sep 17 00:00:00 2001 From: Jacob Lotz Date: Thu, 31 Aug 2023 16:52:29 +0200 Subject: [PATCH 05/18] fix check for internal or enxternal MFEM --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7220486d5..d29fc7e6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) # Check if external MFEM directory is defined in cmake option "-DMFEM_DIR" -if(MFEM_DIR STREQUAL "") +if(MFEM_DIR MATCHES "") set(USE_EXTERNAL_MFEM OFF) else() set(USE_EXTERNAL_MFEM ON) From 816fcee0928b08b029e90aef9f954d6f64a5eb58 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Wed, 11 Oct 2023 14:27:12 +0200 Subject: [PATCH 06/18] fix bug in cmakelists in string compare --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50d09dda3..513d6bb9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) # Check if external MFEM directory is defined in cmake option "-DMFEM_DIR" -if(MFEM_DIR MATCHES "") +if(MFEM_DIR STREQUAL "") set(USE_EXTERNAL_MFEM OFF) else() set(USE_EXTERNAL_MFEM ON) From 6266504f524cdb21a3f78102f0d70938f6f2d12f Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:18:32 +0200 Subject: [PATCH 07/18] fix testing --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 513d6bb9c..246fff996 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,9 +121,11 @@ find_package(Doxygen 1.8.5) find_package(GTest 1.6.0) if (USE_EXTERNAL_MFEM) + message(--------- USING option 2) find_library(MFEM mfem "${MFEM_DIR}/lib") find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") elseif (USE_MFEM) + message(--------- USING option 1) find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") From 71df74cf00b4eda2b97bc232739fa2b4de93186f Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:21:47 +0200 Subject: [PATCH 08/18] Fix testing 2 --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 246fff996..31235a8d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,8 @@ else() set(USE_EXTERNAL_MFEM ON) endif() +set(USE_EXTERNAL_MFEM OFF) + ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR From e67d36ad4612f3228e8994e51116966ec621eb76 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:36:40 +0200 Subject: [PATCH 09/18] Fix testing 2 --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31235a8d5..7123b9d7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,14 +41,21 @@ option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) # Check if external MFEM directory is defined in cmake option "-DMFEM_DIR" -if(MFEM_DIR STREQUAL "") +#if(MFEM_DIR STREQUAL "") +# set(USE_EXTERNAL_MFEM OFF) +#else() +# set(USE_EXTERNAL_MFEM ON) +#endif() + +#set(USE_EXTERNAL_MFEM OFF) + +string(COMPARE EQUAL "${MFEM_DIR}" "" result) +if(result) set(USE_EXTERNAL_MFEM OFF) else() set(USE_EXTERNAL_MFEM ON) endif() -set(USE_EXTERNAL_MFEM OFF) - ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR From 3b88a78f633c1409dd550936fb578bf8c1d494a9 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:40:50 +0200 Subject: [PATCH 10/18] fix testing 3 --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7123b9d7b..fa82f5f05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ option(ENABLE_EXAMPLES "Build examples and regression tests" ON) #set(USE_EXTERNAL_MFEM OFF) string(COMPARE EQUAL "${MFEM_DIR}" "" result) +message(---- MFEM_DIR = "${MFEM_DIR}") +message(---- result = "${result}") if(result) set(USE_EXTERNAL_MFEM OFF) else() From 11802878a4234ea35a8c17fd576d62d42e407e41 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:43:37 +0200 Subject: [PATCH 11/18] Fix testing 4 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa82f5f05..c5c4ed8de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,9 @@ string(COMPARE EQUAL "${MFEM_DIR}" "" result) message(---- MFEM_DIR = "${MFEM_DIR}") message(---- result = "${result}") if(result) - set(USE_EXTERNAL_MFEM OFF) -else() set(USE_EXTERNAL_MFEM ON) +else() + set(USE_EXTERNAL_MFEM OFF) endif() ## Set a bunch of variables to generate a configure header From 6db4f60d516cc0fb9428c5df0740aae1eaa40b03 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:51:12 +0200 Subject: [PATCH 12/18] Fix testing 5 --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5c4ed8de..e2187d036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,11 @@ string(COMPARE EQUAL "${MFEM_DIR}" "" result) message(---- MFEM_DIR = "${MFEM_DIR}") message(---- result = "${result}") if(result) - set(USE_EXTERNAL_MFEM ON) -else() set(USE_EXTERNAL_MFEM OFF) + message(---- NOT Using external MFEM) +else() + set(USE_EXTERNAL_MFEM ON) + message(---- Using external MFEM) endif() ## Set a bunch of variables to generate a configure header From 35be353565c1f03dcfaf78cfcd1d506c518f8f90 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 10:54:45 +0200 Subject: [PATCH 13/18] Fix testing 6 --- CMakeLists.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2187d036..838b9208e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,19 @@ project(libROM include(GNUInstallDirs) + +string(COMPARE EQUAL "${MFEM_DIR}" "" result) +message(---- MFEM_DIR = "${MFEM_DIR}") +message(---- result = "${result}") +if(result) + set(USE_EXTERNAL_MFEM OFF) + message(---- NOT Using external MFEM) +else() + set(USE_EXTERNAL_MFEM ON) + message(---- Using external MFEM) +endif() + + set(libROM_CMAKE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(libROM_CMAKE_MODULE_PATH ${libROM_CMAKE_PATH}/modules) list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH}) @@ -49,16 +62,7 @@ option(ENABLE_EXAMPLES "Build examples and regression tests" ON) #set(USE_EXTERNAL_MFEM OFF) -string(COMPARE EQUAL "${MFEM_DIR}" "" result) -message(---- MFEM_DIR = "${MFEM_DIR}") -message(---- result = "${result}") -if(result) - set(USE_EXTERNAL_MFEM OFF) - message(---- NOT Using external MFEM) -else() - set(USE_EXTERNAL_MFEM ON) - message(---- Using external MFEM) -endif() + ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated From 3c5840df8a78d47198f8b138ea54d69f06b5b12a Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 11:23:56 +0200 Subject: [PATCH 14/18] Fix testing 7 --- CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 838b9208e..24fb22fae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,20 +137,40 @@ find_package(Doxygen 1.8.5) find_package(GTest 1.6.0) -if (USE_EXTERNAL_MFEM) - message(--------- USING option 2) - find_library(MFEM mfem "${MFEM_DIR}/lib") - find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") -elseif (USE_MFEM) - message(--------- USING option 1) - find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") - find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") - find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") - find_library(METIS metis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis" "${METIS_DIR}/lib") - find_path(MFEM_INCLUDES mfem.hpp "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/include") - find_path(HYPRE_INCLUDES HYPRE.h "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include" "${HYPRE_DIR}/include") - find_path(PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include" "${PARMETIS_DIR}/metis/include") -endif() +#if (USE_EXTERNAL_MFEM) +# message(--------- USING option 2) +# find_library(MFEM mfem "${MFEM_DIR}/lib") +# find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") +#elseif (USE_MFEM) +# message(--------- USING option 1) +# find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") +# find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") +# find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") +# find_library(METIS metis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis" "${METIS_DIR}/lib") +# find_path(MFEM_INCLUDES mfem.hpp "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/include") +# find_path(HYPRE_INCLUDES HYPRE.h "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include" "${HYPRE_DIR}/include") +# find_path(PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include" "${PARMETIS_DIR}/metis/include") +#endif() + +#if (USE_EXTERNAL_MFEM) +# message(--------- USING option 2) +# find_library(MFEM mfem "${MFEM_DIR}/lib") +# find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") + +# message(--------- USING option 1) + find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + + find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") + find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") + + find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") + + find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") + find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") + +#endif() + add_subdirectory(lib) From fb9bddd987a55c5aee30224a632edb990f6a2025 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 11:54:13 +0200 Subject: [PATCH 15/18] Fix testing 8 --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24fb22fae..32ae18708 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,18 +160,23 @@ find_package(GTest 1.6.0) # message(--------- USING option 1) find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + message("Found MFEM in ${MFEM}") + message("Found MFEM_INCLUDES in ${MFEM_INCLUDES}") find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") + message("Found HYPRE in ${HYPRE}") + message("Found HYPRE_INCLUDES in ${HYPRE_INCLUDES}") find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") + message("Found METIS in ${METIS}") find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") - find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") - + find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") + message("Found PARMETIS in ${PARMETIS}") + message("Found PARMETIS_INCLUDES in ${PARMETIS_INCLUDES}") #endif() - add_subdirectory(lib) # Use the C++11 standard as an entire feature instead of From f9167d4651b77f4d06db9f1e97f30fb3c417b50b Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 12:04:56 +0200 Subject: [PATCH 16/18] clean up --- CMakeLists.txt | 82 ++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32ae18708..ca17bb04c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,19 +31,6 @@ project(libROM include(GNUInstallDirs) - -string(COMPARE EQUAL "${MFEM_DIR}" "" result) -message(---- MFEM_DIR = "${MFEM_DIR}") -message(---- result = "${result}") -if(result) - set(USE_EXTERNAL_MFEM OFF) - message(---- NOT Using external MFEM) -else() - set(USE_EXTERNAL_MFEM ON) - message(---- Using external MFEM) -endif() - - set(libROM_CMAKE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(libROM_CMAKE_MODULE_PATH ${libROM_CMAKE_PATH}/modules) list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH}) @@ -53,17 +40,6 @@ option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) -# Check if external MFEM directory is defined in cmake option "-DMFEM_DIR" -#if(MFEM_DIR STREQUAL "") -# set(USE_EXTERNAL_MFEM OFF) -#else() -# set(USE_EXTERNAL_MFEM ON) -#endif() - -#set(USE_EXTERNAL_MFEM OFF) - - - ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR @@ -137,45 +113,25 @@ find_package(Doxygen 1.8.5) find_package(GTest 1.6.0) -#if (USE_EXTERNAL_MFEM) -# message(--------- USING option 2) -# find_library(MFEM mfem "${MFEM_DIR}/lib") -# find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") -#elseif (USE_MFEM) -# message(--------- USING option 1) -# find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") -# find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") -# find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") -# find_library(METIS metis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis" "${METIS_DIR}/lib") -# find_path(MFEM_INCLUDES mfem.hpp "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/include") -# find_path(HYPRE_INCLUDES HYPRE.h "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include" "${HYPRE_DIR}/include") -# find_path(PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include" "${PARMETIS_DIR}/metis/include") -#endif() - -#if (USE_EXTERNAL_MFEM) -# message(--------- USING option 2) -# find_library(MFEM mfem "${MFEM_DIR}/lib") -# find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") - -# message(--------- USING option 1) - find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") - find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") - message("Found MFEM in ${MFEM}") - message("Found MFEM_INCLUDES in ${MFEM_INCLUDES}") - - find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") - find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") - message("Found HYPRE in ${HYPRE}") - message("Found HYPRE_INCLUDES in ${HYPRE_INCLUDES}") - - find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") - message("Found METIS in ${METIS}") - - find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") - find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") - message("Found PARMETIS in ${PARMETIS}") - message("Found PARMETIS_INCLUDES in ${PARMETIS_INCLUDES}") -#endif() +# Print the locations of the following libraries as it can be beneficial +# to specify them manually. Use for instance "-DMFEM_DIR=dir" as cmake input option. +find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") +find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") +message("Found MFEM in: ${MFEM}") +message("Found MFEM_INCLUDES in: ${MFEM_INCLUDES}") + +find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") +find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") +message("Found HYPRE in: ${HYPRE}") +message("Found HYPRE_INCLUDES in: ${HYPRE_INCLUDES}") + +find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") +message("Found METIS in: ${METIS}") + +find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") +find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") +message("Found PARMETIS in: ${PARMETIS}") +message("Found PARMETIS_INCLUDES in: ${PARMETIS_INCLUDES}") add_subdirectory(lib) From 09cc80a8388f4690768391df7bc4e7b9fe3fc317 Mon Sep 17 00:00:00 2001 From: JacobLotz Date: Thu, 12 Oct 2023 12:11:13 +0200 Subject: [PATCH 17/18] more clean up and some doc --- CMakeLists.txt | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca17bb04c..9e583ab90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,24 +114,27 @@ find_package(Doxygen 1.8.5) find_package(GTest 1.6.0) # Print the locations of the following libraries as it can be beneficial -# to specify them manually. Use for instance "-DMFEM_DIR=dir" as cmake input option. -find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") -find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") -message("Found MFEM in: ${MFEM}") -message("Found MFEM_INCLUDES in: ${MFEM_INCLUDES}") - -find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") -find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") -message("Found HYPRE in: ${HYPRE}") -message("Found HYPRE_INCLUDES in: ${HYPRE_INCLUDES}") - -find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") -message("Found METIS in: ${METIS}") - -find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") -find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") -message("Found PARMETIS in: ${PARMETIS}") -message("Found PARMETIS_INCLUDES in: ${PARMETIS_INCLUDES}") +# to specify them manually. Use for instance "-DMFEM_DIR=dir" as cmake +# input option to specify an external location for MFEM. +if (USE_MFEM) + find_library(MFEM mfem "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + message("Found MFEM in: ${MFEM}") + message("Found MFEM_INCLUDES in: ${MFEM_INCLUDES}") + + find_library(HYPRE HYPRE "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") + find_path(HYPRE_INCLUDES HYPRE.h "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") + message("Found HYPRE in: ${HYPRE}") + message("Found HYPRE_INCLUDES in: ${HYPRE_INCLUDES}") + + find_library(METIS metis "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") + message("Found METIS in: ${METIS}") + + find_library(PARMETIS parmetis "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") + find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") + message("Found PARMETIS in: ${PARMETIS}") + message("Found PARMETIS_INCLUDES in: ${PARMETIS_INCLUDES}") +endif() add_subdirectory(lib) From 8701ef205196528a036170013f0c18762ee18197 Mon Sep 17 00:00:00 2001 From: Jacob Lotz Date: Sun, 15 Sep 2024 13:17:43 +0200 Subject: [PATCH 18/18] Apply fix for hyper reduction from https://github.com/LLNL/libROM/pull/258 here as well --- lib/mfem/SampleMesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mfem/SampleMesh.cpp b/lib/mfem/SampleMesh.cpp index cd5df7c52..278de36af 100644 --- a/lib/mfem/SampleMesh.cpp +++ b/lib/mfem/SampleMesh.cpp @@ -883,8 +883,8 @@ void Finish_s2sp_augmented(const int rank, const int nprocs, { if (s2sp_[i] == -1) s2sp_[i] = s2sp[i]; - - MFEM_VERIFY(s2sp_[i] >= 0 && s2sp_[i] == s2sp[i], ""); + else + MFEM_VERIFY(s2sp_[i] == s2sp[i], "Consistency check"); } } }