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

Fix minor HYPRE and ADIOS2 compilation issues #3022

Merged
merged 34 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ee90bee
CI: Enable HYPRE in builds
ZedThree Nov 7, 2024
e8adc3f
Fix use of private variable in HYPRE laplace solver
ZedThree Nov 7, 2024
403fd19
Delete (unused) duplicate private function
ZedThree Nov 7, 2024
ff63ff8
CMake: Error if ADIOS2 requested and not found
ZedThree Nov 7, 2024
171b7ae
Fix missing parameter from overridden virtual function
ZedThree Nov 7, 2024
237207b
CI: Fix ADIOS2 build not finding ADIOS2
ZedThree Nov 7, 2024
c3c7f46
CMake: Fix FindHYPRE for non-CMake builds
ZedThree Nov 7, 2024
ae8840a
Apply clang-format changes
ZedThree Nov 7, 2024
6398368
Fix hypre3d laplace solver for 3D metrics
ZedThree Nov 8, 2024
d23cff8
Fix a bunch of clang-tidy issues
ZedThree Nov 8, 2024
9c1cfc9
Remove a couple of unused private members
ZedThree Nov 8, 2024
31567f9
Hypre3D Laplacian: Save diagnostics using outputVars
bendudson Jan 9, 2025
9e765b6
ParallelTransform: Add missing space in error message
bendudson Jan 9, 2025
90332a8
BoundaryFactory: Fix default for parallel boundary regions
bendudson Jan 9, 2025
dc3b020
elm-pb example: Fix hypre input, save performance metrics
bendudson Jan 9, 2025
f46d0a6
Apply clang-format changes
bendudson Jan 9, 2025
6e1bd45
Merge branch 'next' into fix-hypre
bendudson Jan 17, 2025
07603f0
Disable hypre with 3D metrics
bendudson Jan 17, 2025
0012914
Testing: Missed 3D + hypre combination
bendudson Jan 17, 2025
e3a4e1e
OptionsNetCDF: verifyTimesteps, write override base class
bendudson Jan 17, 2025
a188682
tests/integrated: Fix hypre tests
bendudson Jan 17, 2025
9d8cae1
hypre_interface: Add print() method to HypreMatrix
bendudson Jan 17, 2025
518bd4b
Merge branch 'next-hypre3d-laplace' into fix-hypre
bendudson Jan 17, 2025
99bce95
Apply clang-format changes
bendudson Jan 17, 2025
72bdede
Merge branch 'next' into fix-hypre
ZedThree Jan 23, 2025
77ed8db
CMake: Ensure we find adios2 when linking against BOUT++
ZedThree Jan 23, 2025
d5c14c1
CMake: Reduce duplication in linking against adios2
ZedThree Jan 23, 2025
dd34789
Fix laplacexy2-hypre test failing silently
ZedThree Jan 23, 2025
acf1b5d
Change test hypre type to `gmres`
ZedThree Jan 23, 2025
f0aea43
Remove unused `x_outer_dirichlet` member from LaplaceXY2 hypre
ZedThree Jan 23, 2025
4172f1c
Remove unused header include
ZedThree Jan 23, 2025
e55611f
Use modern `output` API
ZedThree Jan 23, 2025
0590870
CMake: Ensure we find ADIOS2 if we downloaded it
ZedThree Jan 24, 2025
d32c70f
Remove coverage test from github workflow
bendudson Jan 24, 2025
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
43 changes: 8 additions & 35 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=OFF
-DBOUT_USE_ADIOS2=ON
-DBOUT_ENABLE_PYTHON=ON
-DADIOS2_ROOT=/home/runner/local/adios2
-DADIOS2_ROOT=/home/runner/local
-DSUNDIALS_ROOT=/home/runner/local
-DPETSC_DIR=/home/runner/local/petsc
-DSLEPC_DIR=/home/runner/local/slepc"
Expand All @@ -74,6 +75,7 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=ON
-DSUNDIALS_ROOT=/home/runner/local"
on_cron: false

Expand All @@ -86,6 +88,7 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=ON
-DSUNDIALS_ROOT=/home/runner/local"
on_cron: false

Expand All @@ -97,6 +100,7 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=ON
-DBOUT_BUILD_DOCS=OFF
-DSUNDIALS_ROOT=/home/runner/local"
omp_num_threads: 2
Expand All @@ -110,6 +114,7 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=OFF
-DBOUT_ENABLE_PYTHON=ON
-DSUNDIALS_ROOT=/home/runner/local"
omp_num_threads: 2
Expand All @@ -123,32 +128,15 @@ jobs:
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_USE_HYPRE=OFF
-DBOUT_ENABLE_PYTHON=ON
-DSUNDIALS_ROOT=/home/runner/local
-DPETSC_DIR=/home/runner/local/petsc
-DSLEPC_DIR=/home/runner/local/slepc"
build_petsc: -petsc
on_cron: false

- name: "Coverage"
os: ubuntu-latest
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCHECK=3
-DENABLE_COVERAGE=ON
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_HDF5=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_ENABLE_PYTHON=ON
-DSUNDIALS_ROOT=/home/runner/local"
unit_only: YES
on_cron: false
exclude:
# Don't run the coverage tests if the branch isn't master or next
- is_master_or_next: false
config:
name: "Coverage"
- is_cron: true
config:
on_cron: false
Expand Down Expand Up @@ -178,6 +166,7 @@ jobs:
slepc-dev
liblapack-dev
libparpack2-dev
libhypre-dev

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -210,22 +199,6 @@ jobs:
- name: Build BOUT++
run: UNIT_ONLY=${{ matrix.config.unit_only }} ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }}

- name: Capture coverage
if: ${{ matrix.config.name == 'Coverage' }}
# Explicitly run the coverage capture target, because
# ci_script.sh also does the upload, and we're going to do
# that ourselves in the next step
run: |
# Ensure that there is a corresponding .gcda file for every .gcno file
# This is to try and make the coverage report slightly more accurate
# It still won't include, e.g. any solvers we don't build with though
find . -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
make -C build code-coverage-capture

- name: Upload coverage
if: ${{ matrix.config.name == 'Coverage' }}
uses: codecov/codecov-action@v4

Fedora:
# This is its own job as it doesn't use most of the steps of the
# standard_tests
Expand Down
16 changes: 15 additions & 1 deletion bout++Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ elseif(EXISTS "@NCXX4_CONFIG@")
set(NCXX4_CONFIG "@NCXX4_CONFIG@")
elseif(EXISTS "@NCXX_BINARY_DIR@")
# If we downloaded netCDF-cxx4, then we need to add its build directory to our search paths
list(APPEND CMAKE_PREFIX_PATH "@NCXX_BINARY_DIR@")
list(APPEND CMAKE_PREFIX_PATH "@NCXX_BINARY_DIR@")
endif()
if(EXISTS "@PVODE_ROOT@")
set(PVODE_ROOT "@PVODE_ROOT@")
Expand All @@ -103,6 +103,12 @@ endif()
if(EXISTS "@Libuuid_ROOT@")
set(Libuuid_ROOT "@Libuuid_ROOT@")
endif()
if(EXISTS "@ADIOS2_ROOT@")
set(ADIOS2_ROOT "@ADIOS2_ROOT@")
elseif(EXISTS "@ADIOS2_BINARY_DIR@")
# If we downloaded ADIOS2, then we need to add its build directory to our search paths
list(APPEND CMAKE_PREFIX_PATH "@ADIOS2_BINARY_DIR@")
endif()

if(@BOUT_USE_SYSTEM_MPARK_VARIANT@)
set(mpark_variant_ROOT "@mpark_variant_ROOT@")
Expand All @@ -117,6 +123,11 @@ endif()

set(MPIEXEC_EXECUTABLE @MPIEXEC_EXECUTABLE@)
find_dependency(MPI @MPI_CXX_VERSION@ EXACT)
if (BOUT_HAS_ADIOS2 OR BOUT_HAS_HYPRE OR BOUT_HAS_SUNDIALS)
# These libraries may also require MPI_C
enable_language(C)
find_dependency(MPI COMPONENTS C)
endif()

if (BOUT_USE_OPENMP)
find_dependency(OpenMP)
Expand Down Expand Up @@ -158,5 +169,8 @@ endif()
if (BOUT_USE_UUID_SYSTEM_GENERATOR)
find_dependency(Libuuid)
endif()
if (BOUT_HAS_ADIOS2)
find_dependency(ADIOS2 @ADIOS2_VERSION@ EXACT)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/bout++Targets.cmake")
3 changes: 2 additions & 1 deletion cmake/FindHYPRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ include(FindPackageHandleStandardArgs)

find_package(HYPRE CONFIG QUIET)
if (HYPRE_FOUND)
message(STATUS "Found HYPRE: ${HYPRE_VERSION}")
return()
endif()

find_path(HYPRE_INCLUDE_DIR
NAMES HYPRE.h
DOC "HYPRE include directories"
REQUIRED
PATH_SUFFIXES include
PATH_SUFFIXES include include/hypre
)

find_library(HYPRE_LIBRARY
Expand Down
16 changes: 6 additions & 10 deletions cmake/SetupBOUTThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,12 @@ endif()
message(STATUS "NetCDF support: ${BOUT_USE_NETCDF}")
set(BOUT_HAS_NETCDF ${BOUT_USE_NETCDF})

option(BOUT_USE_ADIOS2 "Enable support for ADIOS output" ON)
option(BOUT_USE_ADIOS2 "Enable support for ADIOS output" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer if such feature would be automatically enabled if they are found.

option(BOUT_DOWNLOAD_ADIOS2 "Download and build ADIOS2" OFF)
if (BOUT_USE_ADIOS2)
enable_language(C)
find_package(MPI REQUIRED COMPONENTS C)

if (BOUT_DOWNLOAD_ADIOS2)
message(STATUS "Downloading and configuring ADIOS2")
include(FetchContent)
Expand All @@ -211,18 +214,11 @@ if (BOUT_USE_ADIOS2)
# Note: SST requires <rdma/fabric.h> but doesn't check at configure time
set(ADIOS2_USE_SST OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(adios2)
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi)
message(STATUS "ADIOS2 done configuring")
else()
find_package(ADIOS2)
if (ADIOS2_FOUND)
ENABLE_LANGUAGE(C)
find_package(MPI REQUIRED COMPONENTS C)
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi MPI::MPI_C)
else()
set(BOUT_USE_ADIOS2 OFF)
endif()
find_package(ADIOS2 REQUIRED)
endif()
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi MPI::MPI_C)
endif()
message(STATUS "ADIOS2 support: ${BOUT_USE_ADIOS2}")
set(BOUT_HAS_ADIOS2 ${BOUT_USE_ADIOS2})
Expand Down
69 changes: 15 additions & 54 deletions examples/elm-pb/data-hypre/BOUT.inp
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
wall_limit = 1.55 # wall time limit (in hours)

zperiod = 15 # Fraction of a torus to simulate
MZ = 16 # Number of points in Z

dump_format = "nc" # Dump file format. "nc" = NetCDF, "pdb" = PDB
restart_format = "nc" # Restart file format

[mesh]

staggergrids = false # Use staggered grids

file = "cbm18_dens8.grid_nx68ny64.nc" # Grid file

[mesh:paralleltransform]

type = shifted # Use shifted metric method
type = shiftedinterp

##################################################
# derivative methods

[mesh:ddx]

first = C4 # order of first x derivatives
second = C4 # order of second x derivatives
upwind = W3 # order of upwinding method W3 = Weno3
Expand All @@ -36,20 +28,6 @@ first = C4 # Z derivatives can be done using FFT
second = C4
upwind = W3

[output]
shiftoutput = true # Put the output into field-aligned coordinates

##################################################
# Laplacian inversion routines

[laplace]
type = hypre3d

flags = 0 # Flags for Laplacian inversion

rtol = 1e-09
atol = 1e-14

##################################################
# FFTs

Expand All @@ -63,23 +41,12 @@ fft_measurement_flag = measure # If using FFTW, perform tests to determine fast
[solver]

# mudq, mldq, mukeep, mlkeep preconditioner options
atol = 1e-08 # absolute tolerance
rtol = 1e-05 # relative tolerance
atol = 1.0e-8 # absolute tolerance
rtol = 1.0e-5 # relative tolerance

use_precon = false # Use preconditioner: User-supplied or BBD
use_jacobian = false # Use user-supplied Jacobian

mxstep = 5000 # Number of internal steps between outputs
adams_moulton = false # Use Adams-Moulton method (default is BDF)
func_iter = false # Functional iteration (default is Newton)
output_step = 1 # time between outputs
# settings file for BOUT++
# High-Beta reduced MHD case

##################################################
# Global settings used by the core code

nout = 40 # number of time-steps

##################################################
# settings for high-beta reduced MHD
Expand Down Expand Up @@ -116,7 +83,7 @@ diamag_phi0 = true # Balance ExB against Vd for stationary equilibrium
bm_exb_flag = 0
bm_mag_flag = 0
##################################################################
withflow = false # With flow or not
withflow = false # With flow or not
D_0 = 1.3e5 # differential potential
D_s = 20 # shear parameter
K_H_term = false # Contain K-H term
Expand All @@ -125,8 +92,8 @@ x0 = 0.855 # peak location
D_min = 3000 # constant
##################################################################

eHall = false # Include electron pressue effects in Ohm's law?
AA = 2.0 # ion mass in units of proton mass
eHall = false # Include electron pressure effects in Ohm's law?
AA = 2.0 # ion mass in units of proton mass

noshear = false # zero all shear

Expand Down Expand Up @@ -174,14 +141,14 @@ damp_t_const = 0.01 # Damping time constant

## Parallel pressure diffusion

diffusion_par = -1.0 # Parallel pressure diffusion (< 0 = none)
diffusion_par = -1.0 # Parallel pressure diffusion (< 0 = none)
diffusion_p4 = -1e-05 # parallel hyper-viscous diffusion for pressure (< 0 = none)
diffusion_u4 = 1e-05 # parallel hyper-viscous diffusion for vorticity (< 0 = none)
diffusion_u4 = -1e-05 # parallel hyper-viscous diffusion for vorticity (< 0 = none)
diffusion_a4 = -1e-05 # parallel hyper-viscous diffusion for vector potential (< 0 = none)

## heat source in pressure in watts

heating_P = -1 # heat power in watts (< 0 = none)
heating_P = -1 # heat power in watts (< 0 = none)
hp_width = 0.1 # heat width, in percentage of nx (< 0 = none)
hp_length = 0.3 # heat length in percentage of nx (< 0 = none)

Expand All @@ -205,22 +172,19 @@ su_lengthr = 0.1 # right edge sink length in percentage of nx (< 0 = none)
## Viscosity and Hyper-viscosity

viscos_par = -0.1 # Parallel viscosity (< 0 = none)
viscos_perp = -1.0 # Perpendicular
viscos_perp = -1.0 # Perpendicular viscosity (< 0 = none)
hyperviscos = -1.0 # Radial hyper viscosity

## Compressional terms (only when compress = true)
phi_curv = true # Include curvature*Grad(phi) in P equation
# gamma = 1.6666

[phiSolver]
#inner_boundary_flags = 1 + 2 + 128 # INVERT_DC_GRAD + INVERT_AC_GRAD + INVERT_BNDRY_ONE
#outer_boundary_flags = 1 + 2 + 128 # INVERT_DC_GRAD + INVERT_AC_GRAD + INVERT_BNDRY_ONE
inner_boundary_flags = 1 + 4 # INVERT_DC_GRAD + INVERT_AC_LAP
outer_boundary_flags = 1 + 4 # INVERT_DC_GRAD + INVERT_AC_LAP
type = hypre3d
inner_boundary_flags = 0 # Dirichlet
outer_boundary_flags = 0 # Dirichlet

[aparSolver]
#inner_boundary_flags = 1 + 2 + 128 # INVERT_DC_GRAD + INVERT_AC_GRAD + INVERT_BNDRY_ONE
#outer_boundary_flags = 1 + 2 + 128 # INVERT_DC_GRAD + INVERT_AC_GRAD + INVERT_BNDRY_ONE
inner_boundary_flags = 1 + 4 # INVERT_DC_GRAD + INVERT_AC_LAP
outer_boundary_flags = 1 + 4 # INVERT_DC_GRAD + INVERT_AC_LAP

Expand Down Expand Up @@ -271,12 +235,9 @@ bndry_ydown = free_o3
# Zero gradient in the core
bndry_core = neumann

[Vpar]

bndry_core = neumann

[phi]

bndry_xin = none
bndry_xout = none
bndry_target = neumann
#bndry_target = neumann

10 changes: 5 additions & 5 deletions examples/elm-pb/data/BOUT.inp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ diamag_phi0 = true # Balance ExB against Vd for stationary equilibrium
bm_exb_flag = 0
bm_mag_flag = 0
##################################################################
withflow = false # With flow or not
withflow = false # With flow or not
D_0 = 1.3e5 # differential potential
D_s = 20 # shear parameter
K_H_term = false # Contain K-H term
Expand All @@ -104,7 +104,7 @@ D_min = 3000 # constant
##################################################################

eHall = false # Include electron pressure effects in Ohm's law?
AA = 2.0 # ion mass in units of proton mass
AA = 2.0 # ion mass in units of proton mass

noshear = false # zero all shear

Expand Down Expand Up @@ -152,14 +152,14 @@ damp_t_const = 0.01 # Damping time constant

## Parallel pressure diffusion

diffusion_par = -1.0 # Parallel pressure diffusion (< 0 = none)
diffusion_par = -1.0 # Parallel pressure diffusion (< 0 = none)
diffusion_p4 = -1e-05 # parallel hyper-viscous diffusion for pressure (< 0 = none)
diffusion_u4 = -1e-05 # parallel hyper-viscous diffusion for vorticity (< 0 = none)
diffusion_u4 = -1e-05 # parallel hyper-viscous diffusion for vorticity (< 0 = none)
diffusion_a4 = -1e-05 # parallel hyper-viscous diffusion for vector potential (< 0 = none)

## heat source in pressure in watts

heating_P = -1 # heat power in watts (< 0 = none)
heating_P = -1 # heat power in watts (< 0 = none)
hp_width = 0.1 # heat width, in percentage of nx (< 0 = none)
hp_length = 0.3 # heat length in percentage of nx (< 0 = none)

Expand Down
Loading
Loading