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

Add Array<int> to options, additional limiters for grids #2721

Closed
wants to merge 140 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
580e784
make executable dir optional
dschwoerer Feb 17, 2023
8b76a8f
Fall back to using $PATH to find bout-squashoutput
dschwoerer Feb 17, 2023
8cdba94
Error early with in-source-builds
dschwoerer Feb 17, 2023
1230989
Merge pull request #2659 from boutproject/squash-optional
bendudson Feb 17, 2023
36cabdf
Declare variable as unused to avoid warning
dschwoerer Feb 20, 2023
2af404d
Avoid no-return warning in pvode
dschwoerer Feb 20, 2023
e593a99
Avoid PVEC_REAL_MPI_TYPE redifinition warning
dschwoerer Feb 20, 2023
725bb74
Avoid iter not used warning
dschwoerer Feb 20, 2023
a057a65
Apply clang-format changes
dschwoerer Feb 20, 2023
668de4d
Allow in-source-builds, but recommend against
dschwoerer Feb 20, 2023
636eb56
Fix: highlight code
dschwoerer Feb 22, 2023
ba77dd7
Fix: all boutpp members are imported
dschwoerer Feb 22, 2023
fd35030
Fix more references that should be code
dschwoerer Feb 22, 2023
87fa772
Fix: code needs to be separated by an empty line
dschwoerer Feb 22, 2023
88956a0
RTD: Add more modules for mock
dschwoerer Feb 22, 2023
e3ce78b
Fix some warnings in output header
ZedThree Feb 22, 2023
d60a5a2
Fix deprecated header includes
ZedThree Feb 22, 2023
6e6f09f
Merge pull request #2666 from boutproject/fix-bad-merge
ZedThree Feb 22, 2023
b52812d
Merge branch 'master' into output-warning
ZedThree Feb 22, 2023
4c05600
Some fixes for tokamak-2fluid example
ZedThree Feb 22, 2023
e004276
Apply clang-format changes
ZedThree Feb 22, 2023
f1b2e04
Do not check for PVEC_REAL_MPI_TYPE change
dschwoerer Feb 22, 2023
bee8eeb
Fix versions after release
dschwoerer Feb 23, 2023
754b601
Merge pull request #2669 from boutproject/master-version
ZedThree Feb 23, 2023
4026a88
Merge pull request #2664 from boutproject/master-docs-boutpp
ZedThree Feb 23, 2023
37939b1
Merge pull request #2661 from boutproject/output-warning
ZedThree Feb 23, 2023
9171e9e
Fix typos
dschwoerer Feb 24, 2023
6121888
Explicitly cast to void*
dschwoerer Mar 14, 2023
aa242f8
Update signature to match upstream
dschwoerer Mar 14, 2023
759c0cb
Apply clang-format changes
dschwoerer Mar 14, 2023
1d54a14
Merge branch 'master' into cast-sagitter
dschwoerer Mar 14, 2023
7bc1260
Ensure to pass a pointer
dschwoerer Mar 15, 2023
d48acbe
MPI_Comm is a pointer type
dschwoerer Mar 16, 2023
47a70ed
Return reference
dschwoerer Mar 16, 2023
c31e948
Pass pointer to to SUNContext
dschwoerer Mar 16, 2023
557ac38
Merge pull request #2668 from boutproject/tokamak-2fluid-fixes
bendudson Mar 16, 2023
f0cc784
Merge pull request #2660 from boutproject/cmake-insource
bendudson Mar 16, 2023
4a28892
Update bundled boututils and boutdata
dschwoerer Feb 17, 2023
f54a2ac
Add checking bundled libs to release schedule
dschwoerer Feb 17, 2023
b511ccb
install natsort for CI
dschwoerer Feb 17, 2023
73f5d4d
Workaround for test-restart-io for recent boututils
dschwoerer Mar 15, 2023
fefd31c
update boutdata to include fix for yindex_global
dschwoerer Mar 17, 2023
7f5e7c7
CI: switch to openmpi for fedora GHA
dschwoerer Mar 22, 2023
8cc5ee6
If we are on a tag, we should use that as version
dschwoerer Mar 22, 2023
6ababba
Merge pull request #2683 from boutproject/use-tag-version
ZedThree Mar 22, 2023
9949e41
Do not assign in if statement
dschwoerer Mar 23, 2023
1d6b6b1
Fix type in printf format string
dschwoerer Mar 23, 2023
e21b0df
Revert "Workaround for test-restart-io for recent boututils"
dschwoerer Mar 23, 2023
5b83ddb
Fall back to pkgconfig for finding netcdf-cxx4
dschwoerer Mar 23, 2023
c04a11a
cmake does not need {} for blocks
dschwoerer Mar 23, 2023
4e01fc3
Switch to updated boututils
dschwoerer Mar 23, 2023
7cbbf54
Recommend `requirements.txt` for dependencies
dschwoerer Mar 23, 2023
e50112e
Build html docs by default
dschwoerer Mar 23, 2023
4e640f7
Do not ignore doxygen errors if explicitly requested
dschwoerer Mar 23, 2023
50a7195
Merge pull request #2689 from boutproject/manual-requirements
ZedThree Mar 23, 2023
2b85c8b
Do not recommend `--user` for `pip`
dschwoerer Mar 23, 2023
9b1fe87
Update docs to updated defaults
dschwoerer Mar 23, 2023
bd28f65
Merge pull request #2682 from boutproject/fedora-ci-openmpi
ZedThree Mar 23, 2023
2bc8713
Merge pull request #2684 from boutproject/pvode-warnings
ZedThree Mar 23, 2023
e23b828
Remove default arguments
dschwoerer Mar 23, 2023
9180d28
Apply clang-format changes
dschwoerer Mar 23, 2023
b6b2ca4
Merge branch 'master' into cast-sagitter
dschwoerer Mar 23, 2023
94ab01a
Merge pull request #2685 from boutproject/netcdf4-test
dschwoerer Mar 23, 2023
78ddff5
Merge pull request #2679 from boutproject/issue2663
dschwoerer Mar 23, 2023
60ae42b
Merge pull request #2657 from boutproject/bundled-py
ZedThree Mar 23, 2023
a4aa866
Do not fail if numbers are only almost equal
dschwoerer Mar 29, 2023
b0adf3f
Remove unused vsnprintf macro
dschwoerer Mar 29, 2023
2f30d2b
Apply clang-format changes
dschwoerer Mar 29, 2023
0eea867
Increase limit for isUniform
dschwoerer Mar 29, 2023
0afa74e
Improve error message in case field is not uniform
dschwoerer Mar 29, 2023
f01db83
CI: do not run on removed old ubuntu
dschwoerer Apr 19, 2023
33315d8
CI: move some runs to ubunutu-latest
dschwoerer Apr 19, 2023
b507ce7
CI: Update paths for ubuntu 20.04
dschwoerer Apr 19, 2023
85ea857
CI: fix slepc path
dschwoerer Apr 19, 2023
bcb302f
CI: fix petsc path
dschwoerer Apr 19, 2023
c635f25
CI: Drop coverage build OS down to ubuntu-20.04
ZedThree Apr 19, 2023
5379417
Merge pull request #2693 from boutproject/almost-equal
ZedThree Apr 19, 2023
1a12bfc
Merge pull request #2690 from boutproject/manual-requirements
ZedThree Apr 19, 2023
00ee409
Merge pull request #2678 from boutproject/cast-sagitter
ZedThree Apr 19, 2023
6c31487
Link against PkgConfig's imported target for netCDF
ZedThree Apr 19, 2023
33d6a01
Merge pull request #2695 from boutproject/ci-fix-master
ZedThree Apr 19, 2023
419a7e7
CMake: Fix setting `CONFIG_LDFLAGS` for netCDF from PkgConfig
ZedThree Apr 20, 2023
24498ce
Merge pull request #2686 from boutproject/cmake-netcdf-pkgconfig
ZedThree Apr 20, 2023
a54b51d
Docs: Fix default branch for "suggest edit"
ZedThree Apr 21, 2023
6a1ec40
Docs: Update copyright year
ZedThree Apr 21, 2023
232e77e
Merge pull request #2697 from boutproject/docs-fix-default-branch
ZedThree Apr 26, 2023
7617cc3
Remove last uses of `bout::globals::dump`
ZedThree Apr 26, 2023
3051629
Apply clang-format changes
ZedThree Apr 26, 2023
333dfc4
paralleltransform is a section
dschwoerer Apr 27, 2023
f73b1ed
CI: Add testing with new PETSc
dschwoerer Nov 17, 2022
6c0d6b4
Call PCGAMGSetSymGraph only with old PETSc
dschwoerer Nov 17, 2022
4fd461c
Do not specify that the matrix is symmetric
dschwoerer Nov 21, 2022
4386870
CI: Specify that it uses cmake
dschwoerer Nov 21, 2022
ec1678b
CI: Fix path for checking installation
dschwoerer Nov 21, 2022
b04c939
PETSC_DEFAULT is enum, and cannot be used as Options type
dschwoerer Apr 26, 2023
6e37df3
Make sure `PETSC_DEFAULT` is `int` when using it in `Options`
ZedThree Apr 28, 2023
b75942d
Replace deprecated `PETSC_NULL` with `nullptr`
ZedThree Apr 28, 2023
28e8760
Replace calls to PETSc printf functions with `Output`
ZedThree Apr 28, 2023
64735e5
Use default inner preconditioner for laplace-petsc3d test
ZedThree Apr 28, 2023
0f96be9
Include failure reason for PETSc solvers
ZedThree Apr 28, 2023
5fbf1e0
Use references instead of pointers in setting `Options`
ZedThree Apr 28, 2023
3f60cd6
Fix unit test for recent changes in PETSc
ZedThree Apr 28, 2023
de1f258
Apply clang-format changes
ZedThree Apr 28, 2023
7e42ddc
CI: Build latest SLEPc with latest PETSc
ZedThree Apr 28, 2023
128b38e
Clang-tidy fixes
ZedThree Apr 28, 2023
4f9843f
CI: Unset SLEPC variables before building slepc
ZedThree Apr 28, 2023
78dbc0f
CI: Set SLEPC vars when building slepc
ZedThree Apr 28, 2023
58143eb
Update `make dist` invocation
dschwoerer May 2, 2023
d1f23c0
Merge pull request #2704 from boutproject/petsc-3-19
ZedThree May 2, 2023
f491455
Merge pull request #2699 from boutproject/fix-globals-dump
ZedThree May 2, 2023
8fbaad7
Do not run PETSc and SLEPc in cmake step
dschwoerer May 3, 2023
a22ffa2
remove more unused code
dschwoerer May 3, 2023
e232d34
Fix findPetsc.cmake
dschwoerer May 3, 2023
8365ee2
The additional check is not needed
dschwoerer May 3, 2023
ff9c7b9
Apply clang-format changes
dschwoerer May 3, 2023
3d6cb4b
Merge pull request #2711 from boutproject/transform-no-extra-master
ZedThree May 4, 2023
fa83d8e
Get mesh outputs after physics init
bendudson May 20, 2023
17f728f
Merge pull request #2714 from boutproject/mesh-outputvars
bendudson May 23, 2023
07f7b8f
beuler: Fix stencils, pre-allocation and hypre defaults
bendudson May 25, 2023
6e3ed0a
cvode solver: Add linear and nonlinear convergence options
bendudson May 25, 2023
5c7365b
Solver documentation
bendudson May 25, 2023
6875ea1
Apply clang-format changes
bendudson May 25, 2023
ece5b3f
snes solver: Check if PETSc has Hypre
bendudson May 25, 2023
bfe8f7c
beuler: Recalculate Jacobian on solver failure
bendudson May 25, 2023
7152948
Set PETSc options before initialize
bendudson May 25, 2023
7a24114
Remove _TEST_ variables
dschwoerer May 30, 2023
ebca99b
Remove unchecked petsc_test_runs
dschwoerer May 30, 2023
af75e7f
Ensure we can compile PETSc
dschwoerer Jun 5, 2023
e0b24eb
Update src/solver/impls/snes/snes.cxx
bendudson Jun 13, 2023
54f5a89
Update src/solver/impls/snes/snes.cxx
bendudson Jun 13, 2023
ce059a7
Update src/solver/impls/snes/snes.cxx
bendudson Jun 13, 2023
3084bfb
Merge pull request #2716 from boutproject/solver-improvements
bendudson Jun 13, 2023
3500bd0
Merge pull request #2709 from boutproject/slepc-cmake
bendudson Jun 14, 2023
cc9c86d
Merge pull request #2707 from boutproject/dschwoerer-make-dist
ZedThree Jun 14, 2023
cbd197e
Merge pull request #2702 from boutproject/dschwoerer-patch-1
ZedThree Jun 14, 2023
4342888
Merge branch 'next' into v5.1.0-rc
ZedThree Jun 14, 2023
9d7f620
Add Array<int> to Options
bendudson Jun 14, 2023
c8e3dd0
GridFile: Check sizes, allocate vector ints
bendudson Jun 15, 2023
2e9f495
Add limiters in input mesh
bendudson Jun 15, 2023
416dffa
Apply clang-format changes
bendudson Jun 15, 2023
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
60 changes: 60 additions & 0 deletions .build_petsc_for_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -e

if test $BUILD_PETSC ; then
if [[ ! -d $HOME/local/petsc/include/petsc ]]; then
echo "****************************************"
echo "Building PETSc"
echo "****************************************"

git clone -b release https://gitlab.com/petsc/petsc.git petsc --depth=1

unset PETSC_DIR
unset PETSC_ARCH

pushd petsc
./configure \
--with-mpi=yes \
--with-precision=double \
--with-scalar-type=real \
--with-shared-libraries=1 \
--with-debugging=0 \
{C,CXX,F}OPTFLAGS="-O3 -march=native" \
--prefix=$HOME/local/petsc

make && make install
popd

echo "****************************************"
echo " Finished building PETSc"
echo "****************************************"

echo "****************************************"
echo "Building SLEPc"
echo "****************************************"

git clone -b release https://gitlab.com/slepc/slepc.git slepc --depth=1

pushd slepc
unset SLEPC_DIR
unset SLEPC_ARCH
PETSC_DIR=$HOME/local/petsc ./configure --prefix=$HOME/local/slepc

make SLEPC_DIR=$(pwd) PETSC_DIR=$HOME/local/petsc
make SLEPC_DIR=$(pwd) PETSC_DIR=$HOME/local/petsc install
popd

echo "****************************************"
echo " Finished building SLEPc"
echo "****************************************"
else
echo "****************************************"
echo " PETSc already installed"
echo "****************************************"
fi
else
echo "****************************************"
echo " PETSc not requested"
echo "****************************************"
fi
2 changes: 1 addition & 1 deletion .ci_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ then
sudo -u test ${0/\/tmp/\/home\/test} $mpi
## If we are called as normal user, run test
else
pip install --user zoidberg
pip install --user zoidberg natsort
. /etc/profile.d/modules.sh
module load mpi/${1}-x86_64
export OMPI_MCA_rmaps_base_oversubscribe=yes
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ jobs:
-DSUNDIALS_ROOT=/home/runner/local"
omp_num_threads: 2

- name: "CMake, new PETSc"
os: ubuntu-20.04
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DBOUT_ENABLE_METRIC_3D=ON
-DBOUT_ENABLE_OPENMP=ON
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_ENABLE_PYTHON=ON
-DSUNDIALS_ROOT=/home/runner/local
-DPETSC_DIR=/home/runner/local/petsc
-DSLEPC_DIR=/home/runner/local/slepc"

build_petsc: -petsc

- name: "Coverage"
os: ubuntu-20.04
cmake_options: "-DBUILD_SHARED_LIBS=ON
Expand Down Expand Up @@ -142,12 +157,15 @@ jobs:
uses: actions/cache@v2
with:
path: /home/runner/local
key: bout-sundials-${{ matrix.config.os }}
key: bout-sundials-${{ matrix.config.os }}${{ matrix.config.build_petsc }}

- name: Build SUNDIALS
run: ./.build_sundials_for_ci.sh

- name: Build (CMake)
- name: Build PETSc
run: BUILD_PETSC=${{ matrix.config.build_petsc }} ./.build_petsc_for_ci.sh

- name: Build BOUT++
run: UNIT_ONLY=${{ matrix.config.unit_only }} ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }}

- name: Capture coverage
Expand Down Expand Up @@ -176,7 +194,7 @@ jobs:
with:
submodules: true
- name: Build Fedora rawhide
run: ./.ci_fedora.sh setup mpich rawhide
run: ./.ci_fedora.sh setup openmpi rawhide
shell: bash
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.22)
cmake_policy(SET CMP0127 NEW)
endif()

if ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
option(BOUT_ALLOW_INSOURCE_BUILD "Whether BOUT++ should really allow to build in source." OFF)
if (NOT ${BOUT_ALLOW_INSOURCE_BUILD})
message(FATAL_ERROR "BOUT++ does not recommend in source builds. Try building out of source, e.g. with `cmake -S . -B build` or set -DBOUT_ALLOW_INSOURCE_BUILD=ON - but things may break!")
endif()
endif()

# CMake currently doesn't support proper semver
# Set the version here, strip any extra tags to use in `project`
# We try to use git to get a full description, inspired by setuptools_scm
Expand Down
20 changes: 10 additions & 10 deletions cmake/FindPETSc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ show :

include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns)

macro (PETSC_TEST_RUNS includes libraries runs)
macro (petsc_test_compiles includes libraries runs)
message(STATUS "PETSc test with : ${includes} ${libraries}" )
if (PETSC_VERSION VERSION_GREATER 3.1)
set (_PETSC_TSDestroy "TSDestroy(&ts)")
Expand All @@ -287,12 +287,12 @@ int main(int argc,char *argv[]) {
return 0;
}
")
multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
multipass_source_compiles ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
if (${${runs}})
set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
set (PETSC_EXECUTABLE_COMPILES "YES" CACHE BOOL
"Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
endif (${${runs}})
endmacro (PETSC_TEST_RUNS)
endmacro ()


find_path (PETSC_INCLUDE_DIR petscts.h
Expand All @@ -314,14 +314,14 @@ int main(int argc,char *argv[]) {
set (petsc_mpi_include_dirs "${MPI_${PETSC_LANGUAGE_BINDINGS}_INCLUDE_DIRS}")
#set (petsc_additional_libraries "MPI::MPI_${PETSC_LANGUAGE_BINDINGS}${petsc_openmp_library}")

petsc_test_runs ("${petsc_includes_minimal};${petsc_mpi_include_dirs}"
petsc_test_compiles ("${petsc_includes_minimal};${petsc_mpi_include_dirs}"
"${PETSC_LIBRARIES_TS};${petsc_additional_libraries}"
petsc_works_minimal)
if (petsc_works_minimal)
message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.")
set (petsc_includes_needed "${petsc_includes_minimal}")
else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it
petsc_test_runs ("${petsc_includes_all};${petsc_mpi_include_dirs}"
petsc_test_compiles ("${petsc_includes_all};${petsc_mpi_include_dirs}"
"${PETSC_LIBRARIES_TS};${petsc_additional_libraries}"
petsc_works_allincludes)
if (petsc_works_allincludes) # It does, we just need all the includes (
Expand All @@ -332,7 +332,7 @@ int main(int argc,char *argv[]) {
foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external})
endforeach (pkg)
petsc_test_runs ("${petsc_includes_minimal};${petsc_mpi_include_dirs}"
petsc_test_compiles ("${petsc_includes_minimal};${petsc_mpi_include_dirs}"
"${PETSC_LIBRARIES_TS};${petsc_additional_libraries}"
petsc_works_alllibraries)
if (petsc_works_alllibraries)
Expand All @@ -341,7 +341,7 @@ int main(int argc,char *argv[]) {
else (petsc_works_alllibraries)
# It looks like we really need everything, should have listened to Matt
set (petsc_includes_needed ${petsc_includes_all})
petsc_test_runs ("${petsc_includes_all};${petsc_mpi_include_dirs}"
petsc_test_compiles ("${petsc_includes_all};${petsc_mpi_include_dirs}"
"${PETSC_LIBRARIES_TS};${petsc_additional_libraries}"
petsc_works_all)
if (petsc_works_all) # We fail anyways
Expand Down Expand Up @@ -372,15 +372,15 @@ if (NOT PETSC_INCLUDES AND NOT TARGET PETSc::PETSc)
pkg_search_module(PkgPETSC PETSc>3.4.0 petsc>3.4.0)
set (PETSC_LIBRARIES ${PkgPETSC_LINK_LIBRARIES} CACHE STRING "PETSc libraries" FORCE)
set (PETSC_INCLUDES ${PkgPETSC_INCLUDE_DIRS} CACHE STRING "PETSc include path" FORCE)
set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
set (PETSC_EXECUTABLE_COMPILES "YES" CACHE BOOL
"Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
endif()
endif()

# Note that we have forced values for all these choices. If you
# change these, you are telling the system to trust you that they
# work. It is likely that you will end up with a broken build.
mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS)
mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_COMPILES)

include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (PETSc
Expand Down
26 changes: 26 additions & 0 deletions cmake/FindPackageMultipass.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale.

include(CheckCXXSourceCompiles)

macro (FIND_PACKAGE_MULTIPASS _name _current)
string (TOUPPER ${_name} _NAME)
set (_args ${ARGV})
Expand Down Expand Up @@ -104,3 +106,27 @@ endmacro (MULTIPASS_SOURCE_RUNS)
macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs)
multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C")
endmacro (MULTIPASS_C_SOURCE_RUNS)

macro (MULTIPASS_SOURCE_COMPILES includes libraries source runs language)
include (Check${language}SourceRuns)
# This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the
# *name* of the return variable doesn't change, then the test does
# not need to be re-run. We keep an internal count which we
# increment to guarantee that every test name is unique. If we've
# gotten here, then the configuration has changed enough that the
# test *needs* to be rerun.
if (NOT MULTIPASS_TEST_COUNT)
set (MULTIPASS_TEST_COUNT 00)
endif (NOT MULTIPASS_TEST_COUNT)
math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable?
set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID")
set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs})
set (CMAKE_REQUIRED_INCLUDES ${includes})
set (CMAKE_REQUIRED_LIBRARIES ${libraries})
if(${language} STREQUAL "C")
check_c_source_compiles ("${source}" ${testname})
elseif(${language} STREQUAL "CXX")
check_cxx_source_compiles ("${source}" ${testname})
endif()
set (${runs} "${${testname}}")
endmacro ()
72 changes: 2 additions & 70 deletions cmake/FindSLEPc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ show :
endif()

if (SLEPC_SKIP_BUILD_TESTS)
set(SLEPC_TEST_RUNS TRUE)
set(SLEPC_VERSION "UNKNOWN")
set(SLEPC_VERSION_OK TRUE)
elseif (SLEPC_LIBRARIES AND SLEPC_INCLUDE_DIRS AND NOT SLEPC_TEST_RUNS)
elseif (SLEPC_LIBRARIES AND SLEPC_INCLUDE_DIRS)

# Set flags for building test program
set(CMAKE_REQUIRED_INCLUDES ${SLEPC_INCLUDE_DIRS})
Expand Down Expand Up @@ -192,72 +191,6 @@ int main() {
set(SLEPC_VERSION_OK TRUE CACHE BOOL "")
endif()
mark_as_advanced(SLEPC_VERSION_OK)

# Run SLEPc test program
set(SLEPC_TEST_LIB_CPP
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/slepc_test_lib.cpp")
file(WRITE ${SLEPC_TEST_LIB_CPP} "
#include \"petsc.h\"
#include \"slepceps.h\"
int main()
{
PetscErrorCode ierr;
int argc = 0;
char** argv = NULL;
ierr = SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
EPS eps;
ierr = EPSCreate(PETSC_COMM_SELF, &eps); CHKERRQ(ierr);
//ierr = EPSSetFromOptions(eps); CHKERRQ(ierr);
#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 1
ierr = EPSDestroy(eps); CHKERRQ(ierr);
#else
ierr = EPSDestroy(&eps); CHKERRQ(ierr);
#endif
ierr = SlepcFinalize(); CHKERRQ(ierr);
return 0;
}
")

try_run(
SLEPC_TEST_LIB_EXITCODE
SLEPC_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${SLEPC_TEST_LIB_CPP}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
COMPILE_OUTPUT_VARIABLE SLEPC_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE SLEPC_TEST_LIB_OUTPUT
)

if (SLEPC_TEST_LIB_COMPILED AND SLEPC_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Performing test SLEPC_TEST_RUNS - Success")
set(SLEPC_TEST_RUNS TRUE CACHE BOOL "SLEPc test program can run")
else()
message(STATUS "Performing test SLEPC_TEST_RUNS - Failed")

# Test program does not run - try adding SLEPc 3rd party libs and test again
list(APPEND CMAKE_REQUIRED_LIBRARIES ${SLEPC_EXTERNAL_LIBRARIES})

try_run(
SLEPC_TEST_3RD_PARTY_LIBS_EXITCODE
SLEPC_TEST_3RD_PARTY_LIBS_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${SLEPC_TEST_LIB_CPP}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
COMPILE_OUTPUT_VARIABLE SLEPC_TEST_3RD_PARTY_LIBS_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE SLEPC_TEST_3RD_PARTY_LIBS_OUTPUT
)

if (SLEPC_TEST_3RD_PARTY_LIBS_COMPILED AND SLEPC_TEST_3RD_PARTY_LIBS_EXITCODE EQUAL 0)
message(STATUS "Performing test SLEPC_TEST_3RD_PARTY_LIBS_RUNS - Success")
set(SLEPC_LIBRARIES ${SLEPC_LIBRARIES} ${SLEPC_EXTERNAL_LIBRARIES}
CACHE STRING "SLEPc libraries." FORCE)
set(SLEPC_TEST_RUNS TRUE CACHE BOOL "SLEPc test program can run")
else()
message(STATUS "Performing test SLEPC_TEST_3RD_PARTY_LIBS_RUNS - Failed")
endif()
endif()
endif()

# Standard package handling
Expand All @@ -266,8 +199,7 @@ find_package_handle_standard_args(SLEPc
FOUND_VAR SLEPC_FOUND
FAIL_MESSAGE "SLEPc could not be found. Be sure to set SLEPC_DIR, PETSC_DIR, and PETSC_ARCH."
VERSION_VAR SLEPC_VERSION
REQUIRED_VARS SLEPC_LIBRARIES SLEPC_DIR SLEPC_INCLUDE_DIRS SLEPC_TEST_RUNS
SLEPC_VERSION_OK)
REQUIRED_VARS SLEPC_LIBRARIES SLEPC_DIR SLEPC_INCLUDE_DIRS SLEPC_VERSION_OK)

if (SLEPC_FOUND)
if (NOT TARGET SLEPc::SLEPc)
Expand Down
20 changes: 12 additions & 8 deletions cmake/SetupBOUTThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,20 @@ if (BOUT_USE_NETCDF)
# Use our own FindnetCDF module which uses nc-config
find_package(netCDF REQUIRED)
FetchContent_MakeAvailable(netcdf-cxx4)
target_link_libraries(bout++ PUBLIC netCDF::netcdf-cxx4)
else()
find_package(netCDFCxx REQUIRED)
foreach(FLAG ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES})
if("${FLAG}" STREQUAL "netcdf")
set(FLAG -lnetcdf)
endif()
set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${FLAG}")
endforeach()
find_package(netCDFCxx)
if (netCDFCxx_FOUND)
set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}")
target_link_libraries(bout++ PUBLIC netCDF::netcdf-cxx4)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(NETCDF REQUIRED IMPORTED_TARGET netcdf-cxx4)
target_link_libraries(bout++ PUBLIC PkgConfig::NETCDF)
list(JOIN NETCDF_LDFLAGS " " NETCDF_LDFLAGS_STRING)
set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${NETCDF_LDFLAGS_STRING}")
endif()
endif()
target_link_libraries(bout++ PUBLIC netCDF::netcdf-cxx4)
endif()
message(STATUS "NetCDF support: ${BOUT_USE_NETCDF}")
set(BOUT_HAS_NETCDF ${BOUT_USE_NETCDF})
Expand Down
10 changes: 6 additions & 4 deletions examples/laplacexy/simple-hypre/test-laplacexy-hypre.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ int main(int argc, char** argv) {
bout::globals::mesh);

/// Solution
Field2D x = 0.0;
Field2D solution = 0.0;

x = laplacexy.solve(rhs, x);
solution = laplacexy.solve(rhs, solution);

SAVE_ONCE2(rhs, x);
bout::globals::dump.write(); // Save output file
Options dump;
dump["rhs"] = rhs;
dump["x"] = solution;
bout::writeDefaultOutputFile(dump);
}
BoutFinalise();
#if BOUT_HAS_CUDA
Expand Down
Loading