Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize MFEM's petsc/ slepc wrappers #1138

Merged
merged 48 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
619ed76
Let MFEM manage petsc/ slepc
chapman39 Jun 12, 2024
d506f94
Re-add guard checking if petsc/ slepc found for smoketest
chapman39 Jun 19, 2024
9a80e11
Check if petsc/ slepc dir exists
chapman39 Jun 19, 2024
4d8b45e
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 19, 2024
3d2e796
Patch mfem target with arpack libs/includes codevelop
chapman39 Jun 20, 2024
8a3a5c7
Add MFEM patch that resolves slepc link errors
chapman39 Jun 20, 2024
a4b5e92
remove newline
chapman39 Jun 20, 2024
d054d65
update output of petsc slepc smoketests
chapman39 Jun 20, 2024
3ffef43
Resolve null dereference errors
chapman39 Jun 20, 2024
d633c70
Find arpack working for serac install, add comments with links to issues
chapman39 Jun 21, 2024
11d73bb
Just check if the petsc/ slepc pkgs are found
chapman39 Jun 21, 2024
23d4c46
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 21, 2024
39f645b
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 21, 2024
63c3852
cz toss4 host configs
chapman39 Jun 21, 2024
a0dee55
rz toss4 host configs
chapman39 Jun 21, 2024
69bd52c
Merge branch 'feature/chapman39/mfem-petsc-wrapper' of github.com:LLN…
chapman39 Jun 21, 2024
dbfe2be
Fix slepc smoketest errors on clang
chapman39 Jun 21, 2024
b6a5794
style
chapman39 Jun 24, 2024
916a7be
ensure tests work on both blueos and toss4
chapman39 Jun 24, 2024
65590a0
resolve blueos petsc build issues
chapman39 Jun 24, 2024
c748045
consistent spacing
chapman39 Jun 24, 2024
77523f8
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 24, 2024
813eb4e
Re-add petsc with openmp
chapman39 Jun 24, 2024
8e3ef59
Merge branch 'feature/chapman39/mfem-petsc-wrapper' of github.com:LLN…
chapman39 Jun 24, 2024
3983175
blueos rz host config
chapman39 Jun 24, 2024
26f3d37
blueos cz host config
chapman39 Jun 24, 2024
7e7eb21
Merge branch 'feature/chapman39/mfem-petsc-wrapper' of github.com:LLN…
chapman39 Jun 24, 2024
1ba7558
fix ordering to show no diff
chapman39 Jun 24, 2024
ff593f7
Merge branch 'feature/chapman39/mfem-petsc-wrapper' of github.com:LLN…
chapman39 Jun 24, 2024
ab9bffe
space
chapman39 Jun 24, 2024
28278a8
Handle finding arpack cases: not config'ed with slepc, arpack has lib…
chapman39 Jun 24, 2024
67cbe3b
Add arpack lib which is needed by ubuntu
chapman39 Jun 25, 2024
96558f3
Fix test name
chapman39 Jun 25, 2024
5e99e1b
Remove cuda testing with petsc/ slepc wrappers
chapman39 Jun 25, 2024
4f1a06c
Attempt to fix linking order to resolve docker container tpl build er…
chapman39 Jun 26, 2024
27300f2
Resolve docker build issues by adding arpack flags to mfem, axom::mfe…
chapman39 Jun 27, 2024
49fe8be
Fix/ remove comments
chapman39 Jun 27, 2024
610c18a
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 27, 2024
9b0039a
Add diffutils
chapman39 Jun 27, 2024
8429d1b
Update docker host configs
chapman39 Jun 27, 2024
8b22740
Check if target exists with arpack
chapman39 Jun 27, 2024
fa8c1b3
Add issue with commented out cuda section
chapman39 Jun 27, 2024
547f49c
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jun 27, 2024
9c586d1
Merge remote-tracking branch 'origin/develop' into feature/chapman39/…
chapman39 Jul 1, 2024
7e6f456
improve arpack build, fix codevelop
chapman39 Jul 1, 2024
6088020
Check if petsc smoketest converged explicitly
chapman39 Jul 1, 2024
a0a53a8
use find_library for arpack
chapman39 Jul 1, 2024
3c9251e
Add comments about why SERAC_USE_PETSC/ SLEPC
chapman39 Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#

variables:
Clang_14_ImageName: 'seracllnl/tpls:clang-14_05-31-24_19h-38m'
GCC_13_ImageName: 'seracllnl/tpls:gcc-13_05-31-24_19h-38m'
Clang_14_ImageName: 'seracllnl/tpls:clang-14_06-27-24_19h-46m'
GCC_13_ImageName: 'seracllnl/tpls:gcc-13_06-27-24_19h-46m'

jobs:
- job: Build_and_Test
Expand Down
4 changes: 1 addition & 3 deletions cmake/SeracConfigHeader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ message(STATUS "Configuring Serac version ${SERAC_VERSION_FULL}")
#------------------------------------------------------------------------------
# Create variable for every TPL
#------------------------------------------------------------------------------
set(TPL_DEPS ADIAK AXOM CAMP CONDUIT CUDA FMT HDF5 LUA MFEM MPI TRIBOL CALIPER PETSC RAJA STRUMPACK SUNDIALS UMPIRE)
set(TPL_DEPS ADIAK AXOM CAMP CONDUIT CUDA FMT HDF5 LUA MFEM MPI TRIBOL CALIPER RAJA STRUMPACK SUNDIALS UMPIRE)
foreach(dep ${TPL_DEPS})
if( ${dep}_FOUND OR ENABLE_${dep} )
set(SERAC_USE_${dep} TRUE)
Expand Down Expand Up @@ -114,8 +114,6 @@ install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/serac-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/serac-config-version.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/thirdparty/FindPETSc.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/thirdparty/FindSLEPc.cmake
DESTINATION
${SERAC_INSTALL_CMAKE_MODULE_DIR}
)
Expand Down
16 changes: 1 addition & 15 deletions cmake/serac-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ if(NOT SERAC_FOUND)
set(SERAC_USE_HDF5 @SERAC_USE_HDF5@)
set(SERAC_USE_MFEM @SERAC_USE_MFEM@)
set(SERAC_USE_MPI @SERAC_USE_MPI@)
set(SERAC_USE_PETSC @SERAC_USE_PETSC@)
set(SERAC_USE_RAJA @SERAC_USE_RAJA@)
set(SERAC_USE_SLEPC @SERAC_USE_SLEPC@)
set(SERAC_USE_STRUMPACK @SERAC_USE_STRUMPACK@)
set(SERAC_USE_SUNDIALS @SERAC_USE_SUNDIALS@)
set(SERAC_USE_TRIBOL @SERAC_USE_TRIBOL@)
Expand All @@ -52,9 +50,7 @@ if(NOT SERAC_FOUND)
set(SERAC_CONDUIT_DIR "@CONDUIT_DIR@")
set(SERAC_HDF5_DIR "@HDF5_DIR@")
set(SERAC_MFEM_DIR "@MFEM_DIR@")
set(SERAC_PETSC_DIR "@PETSC_DIR@")
set(SERAC_RAJA_DIR "@RAJA_DIR@")
set(SERAC_SLEPC_DIR "@SLEPC_DIR@")
set(SERAC_STRUMPACK_DIR "@STRUMPACK_DIR@")
set(SERAC_SUNDIALS_DIR "@SUNDIALS_DIR@")
set(SERAC_TRIBOL_DIR "@TRIBOL_DIR@")
Expand All @@ -67,7 +63,7 @@ if(NOT SERAC_FOUND)
endif()

# Set to real variable unless user overrode it
foreach(dep ADIAK AXOM CAMP CALIPER CONDUIT HDF5 MFEM PETSC RAJA STRUMPACK SUNDIALS TRIBOL UMPIRE)
foreach(dep ADIAK AXOM CAMP CALIPER CONDUIT HDF5 MFEM RAJA STRUMPACK SUNDIALS TRIBOL UMPIRE)
if (NOT ${dep}_DIR)
set(${dep}_DIR "${SERAC_${dep}_DIR}")
endif()
Expand Down Expand Up @@ -155,16 +151,6 @@ if(NOT SERAC_FOUND)
find_dependency(tribol REQUIRED PATHS "${TRIBOL_DIR}/lib/cmake")
endif()

# PETSc
if(SERAC_USE_PETSC)
include("${CMAKE_CURRENT_LIST_DIR}/FindPETSc.cmake")
endif()

# SLEPc
if(SERAC_USE_SLEPC)
include("${CMAKE_CURRENT_LIST_DIR}/FindSLEPc.cmake")
endif()

# SUNDIALS
if(SERAC_USE_SUNDIALS)
find_dependency(SUNDIALS REQUIRED NO_DEFAULT_PATH PATHS "${SUNDIALS_DIR}")
Expand Down
45 changes: 45 additions & 0 deletions cmake/thirdparty/FindARPACK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2019-2024, Lawrence Livermore National Security, LLC and
# other Serac Project Developers. See the top-level LICENSE file for
# details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
#
# Defines the following:
# ARPACK_FOUND
# ARPACK_INCLUDE_DIRS
# ARPACK_LIBRARIES

# Set ARPACK_DIR to specify the prefix of ARPACK installation

if (NOT EXISTS "${ARPACK_DIR}")
message(FATAL_ERROR "Given ARPACK_DIR does not exist: ${ARPACK_DIR}")
endif()

if (NOT IS_DIRECTORY "${ARPACK_DIR}")
message(FATAL_ERROR "Given ARPACK_DIR is not a directory: ${ARPACK_DIR}")
endif()

# Find include dirs
find_path(ARPACK_INCLUDE_DIRS
NAMES arpackdef.h
PATHS ${ARPACK_DIR}/include/arpack-ng
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)

# Find libraries
find_library(ARPACK_LIBRARIES
NAMES parpack
PATHS ${ARPACK_DIR}/lib
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ARPACK DEFAULT_MSG ARPACK_LIBRARIES ARPACK_INCLUDE_DIRS)
67 changes: 0 additions & 67 deletions cmake/thirdparty/FindPETSc.cmake

This file was deleted.

47 changes: 0 additions & 47 deletions cmake/thirdparty/FindSLEPc.cmake

This file was deleted.

115 changes: 77 additions & 38 deletions cmake/thirdparty/SetupSeracThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,51 @@ if (NOT SERAC_THIRD_PARTY_LIBRARIES_FOUND)
endif()
message(STATUS "Sundials support is ${SERAC_USE_SUNDIALS}")

#------------------------------------------------------------------------------
# PETSc
#------------------------------------------------------------------------------
if (PETSC_DIR)
serac_assert_is_directory(DIR_VARIABLE PETSC_DIR)
# NOTE: PETSc is built and used through MFEM
set(SERAC_USE_PETSC ON CACHE BOOL "")
chapman39 marked this conversation as resolved.
Show resolved Hide resolved

# Note: MFEM *does not* set PETSC_FOUND itself, likely because we skip petsc build tests
set(PETSC_FOUND TRUE)
else()
set(SERAC_USE_PETSC OFF CACHE BOOL "")
set(PETSC_FOUND FALSE)
endif()
message(STATUS "PETSc support is ${SERAC_USE_PETSC}")

#------------------------------------------------------------------------------
# SLEPc
#------------------------------------------------------------------------------
if (SLEPC_DIR AND SERAC_USE_PETSC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be inside of the if(PETSC_DIR) section like below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that is what the SERAC_USE_PETSC does...

serac_assert_is_directory(DIR_VARIABLE SLEPC_DIR)
# NOTE: SLEPc is built and used through MFEM
set(SERAC_USE_SLEPC ON CACHE BOOL "")

# Note: MFEM sets SLEPC_FOUND itself
if (NOT SERAC_ENABLE_CODEVELOP)
set(SLEPC_FOUND TRUE)
endif()
else()
set(SERAC_USE_SLEPC OFF CACHE BOOL "")
set(SLEPC_FOUND FALSE)
endif()
message(STATUS "SLEPc support is ${SERAC_USE_SLEPC}")

#------------------------------------------------------------------------------
# ARPACK
#------------------------------------------------------------------------------
if (ARPACK_DIR AND SERAC_USE_SLEPC)
serac_assert_is_directory(DIR_VARIABLE ARPACK_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/FindARPACK.cmake)
else()
set(ARPACK_FOUND FALSE)
endif()
message(STATUS "ARPACK support is ${ARPACK_FOUND}")

#------------------------------------------------------------------------------
# MFEM
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -182,8 +227,21 @@ if (NOT SERAC_THIRD_PARTY_LIBRARIES_FOUND)
set(ParMETIS_DIR ${PARMETIS_DIR} CACHE PATH "")
endif()
set(MFEM_USE_OPENMP ${ENABLE_OPENMP} CACHE BOOL "")
set(MFEM_USE_PETSC OFF CACHE BOOL "")
set(MFEM_USE_SLEPC OFF CACHE BOOL "")

if(PETSC_DIR)
set(MFEM_USE_PETSC ON CACHE BOOL "")
set(PETSC_ARCH "" CACHE STRING "")
set(PETSC_EXECUTABLE_RUNS "ON" CACHE BOOL "")
if(SLEPC_DIR)
set(MFEM_USE_SLEPC ON CACHE BOOL "")
set(SLEPC_ARCH "" CACHE STRING "")
set(SLEPC_VERSION_OK "TRUE" CACHE BOOL "")
endif()
else()
set(MFEM_USE_PETSC OFF CACHE BOOL "")
set(MFEM_USE_SLEPC OFF CACHE BOOL "")
endif()

set(MFEM_USE_RAJA OFF CACHE BOOL "")
set(MFEM_USE_SUNDIALS ${SERAC_USE_SUNDIALS} CACHE BOOL "")
if(SUPERLUDIST_DIR)
Expand Down Expand Up @@ -267,38 +325,6 @@ if (NOT SERAC_THIRD_PARTY_LIBRARIES_FOUND)
set(MFEM_BUILT_WITH_CMAKE TRUE)
endif()

#------------------------------------------------------------------------------
# PETSc
#------------------------------------------------------------------------------
if(PETSC_DIR)
serac_assert_is_directory(DIR_VARIABLE PETSC_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/FindPETSc.cmake)
serac_assert_find_succeeded(PROJECT_NAME PETSc
TARGET PkgConfig::PETSC
DIR_VARIABLE PETSC_DIR)
message(STATUS "PETSc support is ON")
set(PETSC_FOUND TRUE)
else()
message(STATUS "PETSc support is OFF")
set(PETSC_FOUND FALSE)
endif()

#------------------------------------------------------------------------------
# SLEPC
#------------------------------------------------------------------------------
if(SLEPC_DIR)
serac_assert_is_directory(DIR_VARIABLE SLEPC_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/FindSLEPc.cmake)
serac_assert_find_succeeded(PROJECT_NAME SLEPC
TARGET PkgConfig::SLEPC
DIR_VARIABLE SLEPC_DIR)
message(STATUS "SLEPc support is ON")
set(SLEPC_FOUND TRUE)
else()
message(STATUS "SLEPc support is OFF")
set(SLEPC_FOUND FALSE)
endif()

#------------------------------------------------------------------------------
# Axom
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -489,14 +515,14 @@ if (NOT SERAC_THIRD_PARTY_LIBRARIES_FOUND)
# MPI library/directory but in some cases Spack cannot determine
# the correct MPI lib directory. This guards against that.
# https://github.com/spack/spack/issues/24685
set(_mfem_targets
mfem
axom::mfem
tribol::mfem)
if(STRUMPACK_DIR)
list(GET MPI_C_LIBRARIES 0 _first_mpi_lib)
get_filename_component(_mpi_lib_dir ${_first_mpi_lib} DIRECTORY)

set(_mfem_targets
mfem
axom::mfem
tribol::mfem)
foreach(_target ${_mfem_targets})
if(TARGET ${_target})
message(STATUS "Adding MPI link directory to target [${_target}]")
Expand All @@ -505,6 +531,19 @@ if (NOT SERAC_THIRD_PARTY_LIBRARIES_FOUND)
endforeach()
endif()

# Add missing ARPACK flags needed by SLEPc by injecting them into the MFEM targets.
# https://github.com/mfem/mfem/issues/4364
if (ARPACK_FOUND)
foreach(_target ${_mfem_targets})
if(TARGET ${_target})
message(STATUS "Adding arpack libraries and include dirs to target [${_target}]")
target_include_directories(${_target} INTERFACE ${ARPACK_INCLUDE_DIRS})
target_link_libraries(${_target} INTERFACE ${ARPACK_LIBRARIES})
endif()
endforeach()
endif()
unset(_mfem_targets)

# Restore cleared Adiak/Caliper directories, reason at top of file.
set(ADIAK_DIR ${_adiak_dir} CACHE PATH "" FORCE)
set(CALIPER_DIR ${_caliper_dir} CACHE PATH "" FORCE)
Expand Down
Loading