feat(preconditioner): major work on preconditioner system
first preconditioner MVP
This commit is contained in:
@@ -5,6 +5,9 @@ set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
option(MEAN_FIELD_ENABLE_PROFILING "Enable low-overhead scoped profiling instrumentation" OFF)
|
||||
option(MEAN_FIELD_ENABLE_IPO "Enable interprocedural optimization in release builds" ON)
|
||||
|
||||
set(MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT 0 CACHE STRING
|
||||
"Uniform increment applied to every registered finite-element family order")
|
||||
if (NOT MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT MATCHES "^[0-9]+$")
|
||||
@@ -44,6 +47,7 @@ add_library(mean_field)
|
||||
target_compile_definitions(mean_field
|
||||
PUBLIC
|
||||
MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT=${MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT}
|
||||
MEAN_FIELD_ENABLE_PROFILING=$<BOOL:${MEAN_FIELD_ENABLE_PROFILING}>
|
||||
)
|
||||
|
||||
target_include_directories(mean_field
|
||||
@@ -53,6 +57,7 @@ target_include_directories(mean_field
|
||||
|
||||
target_sources(mean_field
|
||||
PRIVATE
|
||||
libmeanfield/impl/profile.cpp
|
||||
libmeanfield/impl/analysis/integral.cpp
|
||||
libmeanfield/impl/fem.cpp
|
||||
libmeanfield/impl/mapping/coefficients.cpp
|
||||
@@ -96,11 +101,21 @@ target_sources(mean_field
|
||||
libmeanfield/impl/seed/lane_emden.cpp
|
||||
libmeanfield/impl/seed/stellar_equilibrium_projection.cpp
|
||||
libmeanfield/impl/solver/preconditioning_diagnostics.cpp
|
||||
libmeanfield/impl/preconditioning/gravity_field.cpp
|
||||
libmeanfield/impl/operators/prepared_mass_normalization.cpp
|
||||
libmeanfield/impl/operators/prepared_central_density_stellar_equilibrium.cpp
|
||||
libmeanfield/impl/operators/prepared_stellar_equilibrium.cpp
|
||||
)
|
||||
|
||||
if (MEAN_FIELD_ENABLE_IPO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT mean_field_ipo_supported OUTPUT mean_field_ipo_error LANGUAGES CXX)
|
||||
if (NOT mean_field_ipo_supported)
|
||||
message(FATAL_ERROR "MEAN_FIELD_ENABLE_IPO was requested, but the compiler does not support it: ${mean_field_ipo_error}")
|
||||
endif ()
|
||||
set_property(TARGET mean_field PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
endif ()
|
||||
|
||||
target_sources(mean_field
|
||||
PUBLIC
|
||||
FILE_SET CXX_MODULES FILES
|
||||
@@ -131,6 +146,16 @@ target_sources(mean_field
|
||||
libmeanfield/interface/quadrature/mfem.cppm
|
||||
libmeanfield/interface/solver/fields.cppm
|
||||
libmeanfield/interface/solver/preconditioning_diagnostics.cppm
|
||||
libmeanfield/interface/preconditioning/backend.cppm
|
||||
libmeanfield/interface/preconditioning/backend_implementations.cppm
|
||||
libmeanfield/interface/preconditioning/gravity_field.cppm
|
||||
libmeanfield/interface/preconditioning/material_surface.cppm
|
||||
libmeanfield/interface/preconditioning/plan.cppm
|
||||
libmeanfield/interface/preconditioning/stellar_equilibrium.cppm
|
||||
libmeanfield/interface/preconditioning/stellar_structure.cppm
|
||||
libmeanfield/interface/preconditioning/specification_border.cppm
|
||||
libmeanfield/interface/preconditioning/equilibrium_coordinates.cppm
|
||||
libmeanfield/interface/preconditioning/preconditioning.cppm
|
||||
libmeanfield/interface/operators/gravity_field.cppm
|
||||
libmeanfield/interface/operators/gravity_field_jacobian.cppm
|
||||
libmeanfield/interface/operators/kernels/gravity_kernels.cppm
|
||||
@@ -177,6 +202,7 @@ target_sources(mean_field
|
||||
libmeanfield/interface/surface/dependencies.cppm
|
||||
libmeanfield/interface/surface/compiled.cppm
|
||||
libmeanfield/interface/surface/compiler.cppm
|
||||
libmeanfield/interface/material/thermodynamic_equations.cppm
|
||||
libmeanfield/interface/deformation/descriptors.cppm
|
||||
libmeanfield/interface/deformation/surface_prescription.cppm
|
||||
libmeanfield/interface/deformation/nodal_radial_surface.cppm
|
||||
@@ -240,6 +266,7 @@ add_executable(tests
|
||||
tests/mapping/domain_mapper.cpp
|
||||
tests/mapping/compactification/kelvin.cpp
|
||||
tests/utils/blocks.cpp
|
||||
tests/utils/profiling.cpp
|
||||
tests/operators/gravity_field.cpp
|
||||
tests/mapping/hdiv_mass_tensor.cpp
|
||||
tests/operators/prepared_hdiv_mass.cpp
|
||||
@@ -252,6 +279,7 @@ add_executable(tests
|
||||
tests/physics/equation_of_state_consumer_contracts.cpp
|
||||
tests/physics/polytropic_eos_relations.cpp
|
||||
tests/physics/equation_of_state_runtime_view.cpp
|
||||
tests/material/thermodynamic_equation_compilation.cpp
|
||||
tests/surface/constant_surface_compilation.cpp
|
||||
tests/operators/kernels/barotropic_closure_kernels.cpp
|
||||
tests/operators/prepared_barotropic_closure.cpp
|
||||
@@ -293,11 +321,32 @@ add_executable(tests
|
||||
tests/field/field_registry.cpp
|
||||
tests/field/field_mfem.cpp
|
||||
tests/field/field_dof_map.cpp
|
||||
tests/preconditioning/plan.cpp
|
||||
tests/preconditioning/backends.cpp
|
||||
tests/preconditioning/gravity_field.cpp
|
||||
tests/preconditioning/material_surface.cpp
|
||||
tests/preconditioning/stellar_structure.cpp
|
||||
tests/preconditioning/specification_border.cpp
|
||||
tests/preconditioning/equilibrium_coordinates.cpp
|
||||
tests/preconditioning/stellar_equilibrium.cpp
|
||||
tests/user-api/stellar_equilibrium.cpp
|
||||
tests/solver/preconditioning_diagnostics.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(tests PRIVATE mean_field test_mod Catch2::Catch2 Boost::boost)
|
||||
|
||||
add_executable(mpi_tests
|
||||
tests/mpi/mpi_test_main.cpp
|
||||
tests/mpi/distributed_execution.cpp
|
||||
tests/mpi/profiling.cpp
|
||||
)
|
||||
target_link_libraries(mpi_tests PRIVATE mean_field test_mod Catch2::Catch2 Boost::boost)
|
||||
|
||||
if (MEAN_FIELD_ENABLE_IPO)
|
||||
set_property(TARGET tests PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
set_property(TARGET mpi_tests PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
endif ()
|
||||
|
||||
add_library(experiment_mod)
|
||||
target_sources(experiment_mod
|
||||
PUBLIC
|
||||
@@ -313,7 +362,10 @@ target_link_libraries(experiment_mod
|
||||
|
||||
add_executable(experiments
|
||||
experiments/experiment_main.cpp
|
||||
experiments/full_stellar_preconditioning.cpp
|
||||
experiments/gravity_accuracy_budget.cpp
|
||||
experiments/gravity_preconditioning.cpp
|
||||
experiments/material_surface_preconditioning.cpp
|
||||
experiments/preconditioning_diagnostics.cpp
|
||||
)
|
||||
|
||||
@@ -335,6 +387,12 @@ target_link_libraries(stellar_null_space_experiments
|
||||
Boost::boost
|
||||
)
|
||||
|
||||
if (MEAN_FIELD_ENABLE_IPO)
|
||||
foreach (mean_field_ipo_target IN ITEMS test_mod experiment_mod experiments stellar_null_space_experiments)
|
||||
set_property(TARGET ${mean_field_ipo_target} PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
include (CTest)
|
||||
include (Catch)
|
||||
catch_discover_tests(
|
||||
@@ -342,3 +400,32 @@ catch_discover_tests(
|
||||
experiments
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
foreach (mean_field_mpi_ranks IN ITEMS 2 4)
|
||||
add_test(
|
||||
NAME mpi_${mean_field_mpi_ranks}_ranks
|
||||
COMMAND
|
||||
${MPIEXEC_EXECUTABLE}
|
||||
${MPIEXEC_NUMPROC_FLAG} ${mean_field_mpi_ranks}
|
||||
${MPIEXEC_PREFLAGS}
|
||||
$<TARGET_FILE:mpi_tests>
|
||||
${MPIEXEC_POSTFLAGS}
|
||||
"[mpi]"
|
||||
)
|
||||
set_tests_properties(
|
||||
mpi_${mean_field_mpi_ranks}_ranks
|
||||
PROPERTIES
|
||||
LABELS "mpi;distributed"
|
||||
PROCESSORS ${mean_field_mpi_ranks}
|
||||
RESOURCE_LOCK mean_field_mpi
|
||||
TIMEOUT 180
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
add_custom_target(
|
||||
check_mpi
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --label-regex "mpi"
|
||||
DEPENDS mpi_tests
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user