From 2b11fca1f8c8af932f7c4b2d1e417aabcbc214bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Schw=C3=B6rer?= Date: Fri, 23 Jul 2021 20:26:24 +0200 Subject: [PATCH 01/37] Ensure we found a parallel SUNDIALS --- cmake/FindSUNDIALS.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/FindSUNDIALS.cmake b/cmake/FindSUNDIALS.cmake index c67e2be100..1ecb5db429 100644 --- a/cmake/FindSUNDIALS.cmake +++ b/cmake/FindSUNDIALS.cmake @@ -32,8 +32,13 @@ include(FindPackageHandleStandardArgs) find_package(SUNDIALS CONFIG QUIET) + if (SUNDIALS_FOUND) - return() + if (TARGET SUNDIALS::nvecparallel) + return() + else() + message(STATUS "SUNDIALS found but not SUNDIALS::nvecparallel") + endif() endif() find_path(SUNDIALS_INCLUDE_DIR From 7d98f8eecb05dd5986d743a94ecc36a3dbe3af2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Schw=C3=B6rer?= Date: Wed, 18 Aug 2021 16:52:24 +0200 Subject: [PATCH 02/37] Workaround for finding SUNDIALS --- cmake/FindSUNDIALS.cmake | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cmake/FindSUNDIALS.cmake b/cmake/FindSUNDIALS.cmake index 1ecb5db429..41f97890f7 100644 --- a/cmake/FindSUNDIALS.cmake +++ b/cmake/FindSUNDIALS.cmake @@ -31,15 +31,6 @@ include(FindPackageHandleStandardArgs) -find_package(SUNDIALS CONFIG QUIET) - -if (SUNDIALS_FOUND) - if (TARGET SUNDIALS::nvecparallel) - return() - else() - message(STATUS "SUNDIALS found but not SUNDIALS::nvecparallel") - endif() -endif() find_path(SUNDIALS_INCLUDE_DIR sundials_config.h From 1dbebcfcd15c3abff328132587da93ae9c99e003 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 22 Feb 2022 12:01:32 +0100 Subject: [PATCH 03/37] Switching tests to CMake --- .ci_with_cmake.sh | 2 +- .github/workflows/tests.yml | 53 ++++++++++++++++++++++++++++--------- .travis_fedora.sh | 8 +++--- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.ci_with_cmake.sh b/.ci_with_cmake.sh index 3479510105..96824508a8 100755 --- a/.ci_with_cmake.sh +++ b/.ci_with_cmake.sh @@ -3,7 +3,7 @@ set -ex cmake --version -cmake . -B build $@ -DCMAKE_INSTALL_PREFIX=$(pwd)/installed +cmake -S . -B build $@ -DCMAKE_INSTALL_PREFIX=$(pwd)/installed cmake --build build --target build-check -j 2 cd build ctest --output-on-failure --timeout 300 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0512d3c70d..36100995e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,9 +32,12 @@ jobs: configure_options: "--with-petsc --with-slepc --with-sundials=/home/runner/local" - script_flags: "-uim" + cmake_options: "-DBOUT_USE_PETSC=ON + -DBOUT_USE_SLEPC=ON + -DBOUT_USE_SUNDIALS=ON + -DSUNDIALS_ROOT=/home/runner/local" - - name: "Optimised, shared, Python" + - name: "Optimised, static" os: ubuntu-18.04 configure_options: "--enable-shared --enable-checks=no @@ -45,7 +48,16 @@ jobs: --with-petsc --with-slepc --with-sundials=/home/runner/local" - script_flags: "-uim -t shared -t python" + cmake_options: "-DBOUT_ENABLE_CHECKS=OFF + -DBUILD_SHARED_LIBS=OFF + -DCXXFLAGS=-Ofast + -DBOUT_ENABLE_SIGNAL=OFF + -DBOUT_ENABLE_TRACK=OFF + -DBOUT_ENABLE_BACKTRACE=OFF + -DBOUT_USE_PETSC=ON + -DBOUT_USE_SLEPC=ON + -DBOUT_USE_SUNDIALS=ON + -DSUNDIALS_ROOT=/home/runner/local" - name: "Debug, shared" os: ubuntu-18.04 @@ -56,6 +68,14 @@ jobs: --with-petsc --with-slepc --with-sundials=/home/runner/local" + cmake_options: "-DBOUT_ENABLE_CHECKS=3 + -DCMAKE_BUILD_TYPE=Debug + -DBOUT_ENABLE_SIGNAL=ON + -DBOUT_ENABLE_TRACK=ON + -DBOUT_USE_PETSC=ON + -DBOUT_USE_SLEPC=ON + -DBOUT_USE_SUNDIALS=ON + -DSUNDIALS_ROOT=/home/runner/local" script_flags: "-uim" - name: "OpenMP, shared" @@ -65,10 +85,15 @@ jobs: --with-petsc --with-slepc --with-sundials=/home/runner/local" + cmake_options: "-DBOUT_ENABLE_OPENMP=ON + -DBOUT_USE_PETSC=ON + -DBOUT_USE_SLEPC=ON + -DBOUT_USE_SUNDIALS=ON + -DSUNDIALS_ROOT=/home/runner/local" script_flags: "-uim" omp_num_threads: 2 - - name: "CMake, shared, Ubuntu 20.04" + - name: "Shared, Ubuntu 20.04" os: ubuntu-20.04 cmake_options: "-DBUILD_SHARED_LIBS=ON -DBOUT_ENABLE_OPENMP=ON @@ -79,7 +104,7 @@ jobs: -DSUNDIALS_ROOT=/home/runner/local" omp_num_threads: 2 - - name: "CMake, shared, Ubuntu 20.04, 3D metrics" + - name: "3D metrics, shared, Ubuntu 20.04" os: ubuntu-20.04 cmake_options: "-DBUILD_SHARED_LIBS=ON -DBOUT_ENABLE_METRIC_3D=ON @@ -102,6 +127,16 @@ jobs: --with-petsc --with-slepc --with-sundials=/home/runner/local" + 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" script_flags: "-u" exclude: # Don't run the coverage tests if the branch isn't master or next @@ -155,15 +190,7 @@ jobs: - name: Build SUNDIALS run: ./.build_sundials_for_travis.sh - - name: Build (configure) - if: ${{ ! contains(matrix.config.name, 'CMake') }} - run: ./.travis_script.sh ${{ matrix.config.script_flags }} - env: - LD_LIBRARY_PATH: /home/runner/local/lib:$LD_LIBRARY_PATH - CONFIGURE_OPTIONS: ${{ matrix.config.configure_options }} - - name: Build (CMake) - if: ${{ contains(matrix.config.name, 'CMake') }} run: ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }} - name: Capture coverage diff --git a/.travis_fedora.sh b/.travis_fedora.sh index d73c61bafc..27fdb39396 100755 --- a/.travis_fedora.sh +++ b/.travis_fedora.sh @@ -37,7 +37,7 @@ then cat /etc/os-release # Ignore weak depencies echo "install_weak_deps=False" >> /etc/dnf/dnf.conf - time dnf -y install dnf-plugins-core python3-pip + time dnf -y install dnf-plugins-core python3-pip cmake # Allow to override packages - see #2073 time dnf copr enable -y davidsch/fixes4bout || : time dnf -y upgrade @@ -58,11 +58,11 @@ else cd cd BOUT-dev echo "starting configure" - time ./configure --with-petsc --enable-shared || cat config.log + time cmake -S . -B build -DBOUT_USE_PETSC=ON for f in tests/requirements/*[^y] ; do echo -n "$f: " $f && echo yes || echo no done - time make build-check -j 2 - time make check + time make -C build build-check -j 2 + time make -C build check fi From 7f54be15e51f98d3daa07d964092b51f9e3cec24 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 22 Feb 2022 14:12:52 +0100 Subject: [PATCH 04/37] add debug --- .ci_with_cmake.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci_with_cmake.sh b/.ci_with_cmake.sh index 96824508a8..dc9ed46816 100755 --- a/.ci_with_cmake.sh +++ b/.ci_with_cmake.sh @@ -10,11 +10,13 @@ ctest --output-on-failure --timeout 300 # Test bout-config basic functionallity cd ../examples/make-script +PATH=../../build/bin:$PATH bout-config --all PATH=../../build/bin:$PATH make ./test --help cd - make install -j 2 cd - rm test +PATH=../../installed/bin:$PATH bout-config --all PATH=../../installed/bin:$PATH make ./test --help From 8277875986afe103b37bae1f33950c9be72d8e1d Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 00:02:37 +0100 Subject: [PATCH 05/37] Avoid adding `netcdf` to flags --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f74204ea5f..7028bf15ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -594,7 +594,12 @@ if (BOUT_USE_NETCDF) FetchContent_MakeAvailable(netcdf-cxx4) else() find_package(netCDFCxx REQUIRED) - set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}") + foreach(FLAG ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}) + if("$FLAG" STREQUAL "netcdf") + set(FLAG -lnetcdf) + endif() + set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${FLAG}") + endforeach() endif() target_link_libraries(bout++ PUBLIC netCDF::netcdf-cxx4) endif() From 28999d7da7f0ecda21f00547da172e5088567275 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 00:10:03 +0100 Subject: [PATCH 06/37] Cleanup tests --- .github/workflows/tests.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36100995e8..16839b7088 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,9 +29,6 @@ jobs: config: - name: "Default options" os: ubuntu-18.04 - configure_options: "--with-petsc - --with-slepc - --with-sundials=/home/runner/local" cmake_options: "-DBOUT_USE_PETSC=ON -DBOUT_USE_SLEPC=ON -DBOUT_USE_SUNDIALS=ON @@ -39,15 +36,6 @@ jobs: - name: "Optimised, static" os: ubuntu-18.04 - configure_options: "--enable-shared - --enable-checks=no - --enable-optimize=3 - --disable-signal - --disable-track - --disable-backtrace - --with-petsc - --with-slepc - --with-sundials=/home/runner/local" cmake_options: "-DBOUT_ENABLE_CHECKS=OFF -DBUILD_SHARED_LIBS=OFF -DCXXFLAGS=-Ofast @@ -61,13 +49,6 @@ jobs: - name: "Debug, shared" os: ubuntu-18.04 - configure_options: "--enable-shared - --enable-sigfpe - --enable-debug - --enable-track - --with-petsc - --with-slepc - --with-sundials=/home/runner/local" cmake_options: "-DBOUT_ENABLE_CHECKS=3 -DCMAKE_BUILD_TYPE=Debug -DBOUT_ENABLE_SIGNAL=ON @@ -80,11 +61,6 @@ jobs: - name: "OpenMP, shared" os: ubuntu-18.04 - configure_options: "--enable-shared - --enable-openmp - --with-petsc - --with-slepc - --with-sundials=/home/runner/local" cmake_options: "-DBOUT_ENABLE_OPENMP=ON -DBOUT_USE_PETSC=ON -DBOUT_USE_SLEPC=ON @@ -119,14 +95,6 @@ jobs: - name: "Coverage" os: ubuntu-18.04 - configure_options: "--enable-shared - --enable-code-coverage - --enable-debug - --enable-track - --with-lapack - --with-petsc - --with-slepc - --with-sundials=/home/runner/local" cmake_options: "-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DCHECK=3 @@ -148,7 +116,6 @@ jobs: - name: Job information run: | echo Build: ${{ matrix.config.name }}, ${{ matrix.config.os }} - echo Configure options: ${{ matrix.config.configure_options }} echo CMake options: ${{ matrix.config.cmake_options }} - name: Install dependencies From f53770defb1f12fe30c7143ea294fd4f84e705b8 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 01:22:49 +0100 Subject: [PATCH 07/37] debug --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7028bf15ae..ddc7eebd16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,9 +595,11 @@ if (BOUT_USE_NETCDF) else() find_package(netCDFCxx REQUIRED) foreach(FLAG ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}) - if("$FLAG" STREQUAL "netcdf") + message(STATUS "${FLAG}") + if("${FLAG}" STREQUAL "netcdf") set(FLAG -lnetcdf) endif() + message(STATUS "${FLAG} ${CONFIG_LDFLAGS}") set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${FLAG}") endforeach() endif() From 7b73f393ec6b32c18dcfb9c8a1ed125cb58f280a Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 08:41:54 +0100 Subject: [PATCH 08/37] Fix static linking for petsc --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddc7eebd16..675b86a865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,7 +637,7 @@ if (BOUT_USE_PETSC) find_package(PETSc REQUIRED) target_link_libraries(bout++ PUBLIC PETSc::PETSc) string(JOIN " " CONFIG_PETSC_LIBRARIES ${PETSC_LIBRARIES}) - set(CONFIG_LDFLAGS "${CONFIG_PETSC_LIBRARIES} ${CONFIG_LDFLAGS}") + set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${CONFIG_PETSC_LIBRARIES}") foreach(PETSC_INCLUDE ${PETSC_INCLUDES}) set(CONFIG_CFLAGS "${CONFIG_CFLAGS} -I${PETSC_INCLUDE}") endforeach() From c4805559099ed7cea7bc88f18ca3ef80d7a902b2 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 08:49:13 +0100 Subject: [PATCH 09/37] Run only unit tests for coverage --- .ci_with_cmake.sh | 12 +++++++++--- .github/workflows/tests.yml | 6 ++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.ci_with_cmake.sh b/.ci_with_cmake.sh index dc9ed46816..8ed3d500be 100755 --- a/.ci_with_cmake.sh +++ b/.ci_with_cmake.sh @@ -4,9 +4,15 @@ set -ex cmake --version cmake -S . -B build $@ -DCMAKE_INSTALL_PREFIX=$(pwd)/installed -cmake --build build --target build-check -j 2 -cd build -ctest --output-on-failure --timeout 300 + +if test ".$UNIT_ONLY" = ".YES" ; then + make -C build build-check-unit-tests + make -C build check-unit-tests +else + cmake --build build --target build-check -j 2 + cd build + ctest --output-on-failure --timeout 300 +fi # Test bout-config basic functionallity cd ../examples/make-script diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 16839b7088..c900aaeaa7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,7 +57,6 @@ jobs: -DBOUT_USE_SLEPC=ON -DBOUT_USE_SUNDIALS=ON -DSUNDIALS_ROOT=/home/runner/local" - script_flags: "-uim" - name: "OpenMP, shared" os: ubuntu-18.04 @@ -66,7 +65,6 @@ jobs: -DBOUT_USE_SLEPC=ON -DBOUT_USE_SUNDIALS=ON -DSUNDIALS_ROOT=/home/runner/local" - script_flags: "-uim" omp_num_threads: 2 - name: "Shared, Ubuntu 20.04" @@ -105,7 +103,7 @@ jobs: -DBOUT_USE_SUNDIALS=ON -DBOUT_ENABLE_PYTHON=ON -DSUNDIALS_ROOT=/home/runner/local" - script_flags: "-u" + unit_only: YES exclude: # Don't run the coverage tests if the branch isn't master or next - is_master_or_next: false @@ -158,7 +156,7 @@ jobs: run: ./.build_sundials_for_travis.sh - name: Build (CMake) - run: ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }} + run: UNIT_ONLY=${{ matrix.config.unit_only }} ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }} - name: Capture coverage if: ${{ matrix.config.name == 'Coverage' }} From 6628bb5f4afaaa686600039512823201cec6a3d4 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 10:02:06 +0100 Subject: [PATCH 10/37] Set sundials LD_LIBRARY_PATH --- .ci_with_cmake.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci_with_cmake.sh b/.ci_with_cmake.sh index 8ed3d500be..f308cebc48 100755 --- a/.ci_with_cmake.sh +++ b/.ci_with_cmake.sh @@ -14,6 +14,8 @@ else ctest --output-on-failure --timeout 300 fi +export LD_LIBRARY_PATH=/home/runner/local/lib:$LD_LIBRARY_PATH + # Test bout-config basic functionallity cd ../examples/make-script PATH=../../build/bin:$PATH bout-config --all From f5cdabf6a44e100d1954d849dc21822b2674728d Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 15:57:00 +0100 Subject: [PATCH 11/37] Fix coverage job --- .ci_with_cmake.sh | 9 +++++---- .github/workflows/tests.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.ci_with_cmake.sh b/.ci_with_cmake.sh index f308cebc48..7081b0d4a6 100755 --- a/.ci_with_cmake.sh +++ b/.ci_with_cmake.sh @@ -8,12 +8,13 @@ cmake -S . -B build $@ -DCMAKE_INSTALL_PREFIX=$(pwd)/installed if test ".$UNIT_ONLY" = ".YES" ; then make -C build build-check-unit-tests make -C build check-unit-tests -else - cmake --build build --target build-check -j 2 - cd build - ctest --output-on-failure --timeout 300 + exit 0 fi +cmake --build build --target build-check -j 2 +cd build +ctest --output-on-failure --timeout 300 + export LD_LIBRARY_PATH=/home/runner/local/lib:$LD_LIBRARY_PATH # Test bout-config basic functionallity diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c900aaeaa7..5a6eefaeaa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -168,7 +168,7 @@ jobs: # 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 code-coverage-capture + make -C build code-coverage-capture - name: Upload coverage if: ${{ matrix.config.name == 'Coverage' }} From d3c5ffadce9fdc6e6f04fecfa4f204c0a94d625e Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 16:32:40 +0100 Subject: [PATCH 12/37] CI: Install fastcov --- .github/workflows/tests.yml | 4 ++-- cmake/Sanitizers.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5a6eefaeaa..557c201068 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: OMPI_MCA_rmaps_base_oversubscribe: yes MPIRUN: mpiexec -np strategy: - fail-fast: false + fail-fast: true matrix: # Need this to be able to exclude the coverage job is_master_or_next: @@ -142,7 +142,7 @@ jobs: - name: Install pip packages run: | - ./.pip_install_for_travis.sh 'cython~=0.29' 'netcdf4~=1.5' 'sympy~=1.5' 'gcovr' 'cmake' 'h5py' zoidberg + ./.pip_install_for_travis.sh 'cython~=0.29' 'netcdf4~=1.5' 'sympy~=1.5' 'gcovr' 'cmake' 'h5py' zoidberg fastcov # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index a94be2cddd..97d88a61d3 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -15,7 +15,7 @@ function(enable_sanitizers target_name) find_program(fastcov_FOUND fastcov) message(STATUS "Looking for fastcov: ${fastcov_FOUND}") find_program(genhtml_FOUND genhtml) - message(STATUS "Looking for genhtml: ${fastcov_FOUND}") + message(STATUS "Looking for genhtml: ${genhtml_FOUND}") if (fastcov_FOUND AND genhtml_FOUND) set(COVERAGE_NAME coverage CACHE STRING "Name of coverage output file") @@ -45,7 +45,7 @@ function(enable_sanitizers target_name) COMMENT "Cleaning coverage information" ) else() - message(STATUS "Coverage enabled, but coverage-capture not available. Please install fastcov and lcov") + message(FATAL_ERROR "Coverage enabled, but coverage-capture not available. Please install fastcov and lcov") endif() endif() From 995151d7e987a2c292287819d253318bb8b7e92c Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 1 Mar 2022 16:57:55 +0100 Subject: [PATCH 13/37] try lcov for coverage --- cmake/Sanitizers.cmake | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index 97d88a61d3..831f4e81b0 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -12,22 +12,20 @@ function(enable_sanitizers target_name) target_compile_options(${target_name} PUBLIC --coverage -O0 -g) target_link_libraries(${target_name} PUBLIC --coverage) - find_program(fastcov_FOUND fastcov) - message(STATUS "Looking for fastcov: ${fastcov_FOUND}") + find_program(lcov_FOUND lcov) + message(STATUS "Looking for lcov: ${lcov_FOUND}") find_program(genhtml_FOUND genhtml) message(STATUS "Looking for genhtml: ${genhtml_FOUND}") - if (fastcov_FOUND AND genhtml_FOUND) + if (lcov_FOUND AND genhtml_FOUND) set(COVERAGE_NAME coverage CACHE STRING "Name of coverage output file") set(COVERAGE_FILE "${COVERAGE_NAME}.info") set(COVERAGE_MSG "Open file://${PROJECT_SOURCE_DIR}/${COVERAGE_NAME}/index.html in your browser to view coverage HTML output") add_custom_target(code-coverage-capture COMMAND - fastcov --include "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include" - --exclude "${CMAKE_CURRENT_SOURCE_DIR}/externalpackages" - --lcov --process-gcno - --output "${COVERAGE_FILE}" + lcov -c --directory "${CMAKE_CURRENT_SOURCE_DIR}/src" --directory "${CMAKE_CURRENT_SOURCE_DIR}/include" + --output-file "${COVERAGE_FILE}" COMMAND genhtml --output-directory "${COVERAGE_NAME}" --demangle-cpp --legend --show-details "${COVERAGE_FILE}" COMMAND @@ -41,11 +39,11 @@ function(enable_sanitizers target_name) add_custom_target(code-coverage-clean COMMAND - fastcov --zerocounters + lcov --zerocounters COMMENT "Cleaning coverage information" ) else() - message(FATAL_ERROR "Coverage enabled, but coverage-capture not available. Please install fastcov and lcov") + message(FATAL_ERROR "Coverage enabled, but coverage-capture not available. Please install lcov and lcov") endif() endif() From 02bd701ac84aee414f045f5cc595ee394e5e0adc Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Mar 2022 09:58:40 +0100 Subject: [PATCH 14/37] fix coverage for cmake We need to link with gcov to get gcda files. Further, they are in the build directories, not the source directories. --- .gitignore | 2 ++ cmake/Sanitizers.cmake | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a8077ff0e1..66850542c2 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,5 @@ src/fmt/format.cxx /tests/integrated/test-options-netcdf/test.nc /tests/integrated/test-options-netcdf/time.nc /tests/integrated/test-yupdown-weights/test_yupdown_weights +coverage.info +coverage/ diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index 831f4e81b0..543609e024 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -10,7 +10,7 @@ function(enable_sanitizers target_name) if(ENABLE_COVERAGE) target_compile_options(${target_name} PUBLIC --coverage -O0 -g) - target_link_libraries(${target_name} PUBLIC --coverage) + target_link_libraries(${target_name} PUBLIC --coverage -lgcov) find_program(lcov_FOUND lcov) message(STATUS "Looking for lcov: ${lcov_FOUND}") @@ -24,8 +24,8 @@ function(enable_sanitizers target_name) add_custom_target(code-coverage-capture COMMAND - lcov -c --directory "${CMAKE_CURRENT_SOURCE_DIR}/src" --directory "${CMAKE_CURRENT_SOURCE_DIR}/include" - --output-file "${COVERAGE_FILE}" + lcov -c --directory "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/bout++.dir/src" + --output-file "${COVERAGE_FILE}" COMMAND genhtml --output-directory "${COVERAGE_NAME}" --demangle-cpp --legend --show-details "${COVERAGE_FILE}" COMMAND From 5864e7f746e012011a5fcc0f7eb0d36848eb5fa4 Mon Sep 17 00:00:00 2001 From: David Bold Date: Sat, 5 Mar 2022 12:54:42 +0100 Subject: [PATCH 15/37] Tidy up messages Co-authored-by: Peter Hill --- CMakeLists.txt | 2 -- cmake/Sanitizers.cmake | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1740d5cb25..b1b345a720 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,11 +604,9 @@ if (BOUT_USE_NETCDF) else() find_package(netCDFCxx REQUIRED) foreach(FLAG ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}) - message(STATUS "${FLAG}") if("${FLAG}" STREQUAL "netcdf") set(FLAG -lnetcdf) endif() - message(STATUS "${FLAG} ${CONFIG_LDFLAGS}") set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${FLAG}") endforeach() endif() diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index 543609e024..715a08ab88 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -43,7 +43,7 @@ function(enable_sanitizers target_name) COMMENT "Cleaning coverage information" ) else() - message(FATAL_ERROR "Coverage enabled, but coverage-capture not available. Please install lcov and lcov") + message(FATAL_ERROR "Coverage enabled, but coverage-capture not available. Please install lcov") endif() endif() From 2b432716928e03084edfeb332b65c8708eb7efd6 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 28 Jul 2022 17:50:50 +0100 Subject: [PATCH 16/37] Add deprecation warning to configure --- configure | 7 ++++++- configure.ac | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 9675ef0031..46e43435f3 100755 --- a/configure +++ b/configure @@ -2402,7 +2402,8 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ./configure is deprecated and will be removed in a future version, please use CMake instead" >&5 +$as_echo "$as_me: WARNING: ./configure is deprecated and will be removed in a future version, please use CMake instead" >&2;} # Check whether --with-netcdf was given. @@ -17266,3 +17267,7 @@ $as_echo "$as_me: export PYTHONPATH=$PWD/tools/pylib/:\$PYTHONPATH" >&6;} $as_echo "$as_me: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: *** Now run '$MAKE' to compile BOUT++ ***" >&5 $as_echo "$as_me: *** Now run '$MAKE' to compile BOUT++ ***" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: " >&5 +$as_echo "$as_me: " >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ./configure is deprecated and will be removed in a future version, please use CMake instead" >&5 +$as_echo "$as_me: WARNING: ./configure is deprecated and will be removed in a future version, please use CMake instead" >&2;} diff --git a/configure.ac b/configure.ac index 1412b61156..4f4703a02a 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,8 @@ AC_INIT([BOUT++],[5.0.0-alpha],[bd512@york.ac.uk]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) +AC_MSG_WARN([./configure is deprecated and will be removed in a future version, please use CMake instead]) + AC_ARG_WITH(netcdf, [AS_HELP_STRING([--with-netcdf], [Enable support for netCDF files])],,[]) AC_ARG_WITH(pnetcdf, [AS_HELP_STRING([--with-pnetcdf], @@ -1493,3 +1495,5 @@ AC_MSG_NOTICE([]) AC_MSG_NOTICE([ export PYTHONPATH=$PWD/tools/pylib/:\$PYTHONPATH]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([*** Now run '$MAKE' to compile BOUT++ ***]) +AC_MSG_NOTICE([]) +AC_MSG_WARN([./configure is deprecated and will be removed in a future version, please use CMake instead]) From b73414ee6414f69f50c6bed8290bcd0b0b8183d4 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 21:58:17 +0100 Subject: [PATCH 17/37] make tarball after bumping version --- manual/RELEASE_HOWTO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/RELEASE_HOWTO.md b/manual/RELEASE_HOWTO.md index b16026abd3..c9c723fd7e 100644 --- a/manual/RELEASE_HOWTO.md +++ b/manual/RELEASE_HOWTO.md @@ -60,7 +60,6 @@ Before merging PR: After PR is merged: -- [ ] Make tarball: `./configure && make dist` - [ ] Try to summarise the changes! - [ ] Make [GitHub Release][gh_release], include change summary **NB:** tag should have leading `v` @@ -78,6 +77,7 @@ After PR is merged: - [ ] [`manual/doxygen/Doxyfile`][Doxyfile]: `PROJECT_NUMBER` - [ ] [`CMakeLists.txt`][CMakeLists.txt]: `_bout_previous_version`, `_bout_next_version` - [ ] [`tools/pylib/_boutpp_build/backend.py`][backend.py]: `_bout_previous_version`, `_bout_next_version` +- [ ] Make tarball: `cmake -S . -B build && make dist -C build` [Doxyfile]: ../manual/doxygen/Doxyfile [Doxyfile_readthedocs]: ../manual/doxygen/Doxyfile_readthedocs From a407a86c8e50a6fd7972ee42785fa97efc4eabc0 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 22:30:13 +0100 Subject: [PATCH 18/37] switch some docs to cmake --- manual/sphinx/user_docs/advanced_install.rst | 43 ++++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 57a1b5d635..d1a54a1cda 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -14,53 +14,24 @@ SUNDIALS and PETSc. Optimisation and run-time checking ---------------------------------- -Configure with ``--enable-checks=3`` enables a lot of checks of +Configure with ``-DCHECK=3`` enables a lot of checks of operations performed by the field objects. This is very useful for debugging a code, and can be omitted once bugs have been removed. -``--enable=checks=2`` enables less checking, especially the -computationally rather expensive ones, while ``--enable-checks=0`` +``--DCHECK=2`` enables less checking, especially the +computationally rather expensive ones, while ``-DCHECK=0`` disables most checks. -To get most checking, both from BOUT++ and from the compiler -``--enable-debug`` can be used. That enables checks of level 3, as -well as debug flags, e.g. ``-g`` for gcc. - For (sometimes) more useful error messages, there is the -``--enable-track`` option. This keeps track of the names of variables -and includes these in error messages. +``-DBOUT_ENABLE_TRACK=ON`` option. This keeps track of the names of +variables and includes these in error messages. To get a backtrace, you can set the environment variable ``BOUT_SHOW_BACKTRACE`` in order for the exception to include the backtrace. -To enable optimization, configure with ``--enable-optimize=3``. -This will try to set appropriate flags, but may not set the best ones. -This should work well for gcc. Similar to checks, different levels can -be specified, where 3 is high, and 0 means disabling all -optimization. ``--enable-optimize=fast`` will set the ``-Ofast`` flag -for gcc which enables optimizations that are not standard conforming, so -proceed at own risk. - -Manually set compilation flags ------------------------------- - -You can set the following environment variables if you need more -control over how BOUT++ is built: - -- ``LDFLAGS``: extra flags for linking, e.g. ``-L`` - -- ``LIBS``: extra libraries for linking, e.g. ``-l`` - -- ``CPPFLAGS``: preprocessor flags, e.g. ``-I`` - -- ``CXXFLAGS``: compiler flags, e.g. ``-Wall`` - -- ``SUNDIALS_EXTRA_LIBS`` specifies additional libraries for linking - to SUNDIALS, which are put at the end of the link command. +To enable optimization, configure with appropriate flags for your +compiler, e.g. with ``-DCMAKE_CXX_FLAGS=" -O3 "`` for a gnu compiler. -It is possible to change flags for BOUT++ after running configure, by -editing the ``make.config`` file. Note that this is not recommended, -as e.g. PVODE will not be built with these flags. Install dependencies: --------------------- From 7765700e0a03313c0aa60d7fa4120040ecf0ef69 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:37:16 +0100 Subject: [PATCH 19/37] Switch advanced install to cmake --- manual/sphinx/user_docs/advanced_install.rst | 32 ++++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index d1a54a1cda..249bef37ec 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -296,7 +296,7 @@ BOUT++ will look for ``ncxx4-config`` or ``nc-config`` in your version than the one you want, you can point it at the correct version using:: - ./configure --with-netcdf=/path/to/ncxx4-config + cmake -S .. -B . -DBOUT_USE_NETCDF=ON -DnetCDFCxx_ROOT=/path/to/ncxx4-config where ``/path/to/ncxx4-config`` is the location of the ``ncxx4-config`` tool (``nc-config`` will also work, but @@ -353,9 +353,9 @@ OpenMP ------ BOUT++ can make use of OpenMP parallelism. To enable OpenMP, use the -``--enable-openmp`` flag to configure:: +``-DBOUT_ENABLE_OPENMP=ON`` flag to configure:: - ./configure --enable-openmp + cmake -S .. -B . -DBOUT_ENABLE_OPENMP=ON OpenMP can be used to parallelise in more directions than can be achieved with MPI alone. For example, it is currently difficult to @@ -378,7 +378,7 @@ some problem sizes on some machines) is setting the OpenMP schedule used in some of the OpenMP loops (specifically those using `BOUT_FOR`). This can be set using:: - ./configure --enable-openmp --with-openmp-schedule= + cmake . -DBOUT_ENABLE_OPENMP=ON -DBOUT_OPENMP_SCHEDULE= with ```` being one of: ``static`` (the default), ``dynamic``, ``guided``, ``auto`` or ``runtime``. @@ -448,9 +448,9 @@ solver, which evolves a system of the form :math:`\mathbf{f}(\mathbf{u},\dot{\mathbf{u}},t) = 0`. This allows algebraic constraints on variables to be specified. -Use the ``--with-sundials`` option to configure BOUT++ with SUNDIALS:: +Use the ``-DBOUT_USE_SUNDIALS=ON -DSUNDIALS_ROOT=`` option to configure BOUT++ with SUNDIALS:: - $ ./configure --with-sundials=/path/to/sundials/install + $ cmake . -DBOUT_USE_SUNDIALS=ON -DSUNDIALS_ROOT=/path/to/sundials/install SUNDIALS will allow you to select at run-time which solver to use. See :ref:`sec-timeoptions` for more details on how to do this. @@ -458,8 +458,6 @@ SUNDIALS will allow you to select at run-time which solver to use. See Notes: * If compiling SUNDIALS, make sure that it is configured with MPI (``MPI_ENABLE=ON``) -* If you install SUNDIALS to a non-standard (system) directory, you will probably have - to add the ``lib`` directory to the ``LD_LIBRARY_PATH`` environment variable. .. _sec-PETSc-install: @@ -558,11 +556,11 @@ serial performance. This does not add new features, but may be faster in some cases. LAPACK is however written in FORTRAN 77, which can cause linking headaches. To enable these routines use:: - $ ./configure --with-lapack + $ cmake . -DBOUT_USE_LAPACK=ON and to specify a non-standard path:: - $ ./configure --with-lapack=/path/to/lapack + $ cmake . -DBOUT_USE_LAPACK=ON -DLAPACK_ROOT=/path/to/lapack MPI compilers @@ -570,9 +568,7 @@ MPI compilers These are usually called something like mpicc and mpiCC (or mpicxx), and the configure script will look for several common names. If your -compilers aren’t recognised then set them using:: - - $ ./configure MPICC= MPICXX= +compilers aren’t recognised then check the `cmake documentation for MPI `_ NOTES: @@ -849,15 +845,11 @@ to ``next``, with an error like the following:: make: *** [src] Error 2 it's possible something has gone wrong with the submodules. To fix, -just run ``make submodules``:: +just run:: - $ make submodules - Downloading mpark.variant - git submodule update --init --recursive /home/peter/Codes/BOUT-dev/externalpackages/mpark.variant - Submodule path 'externalpackages/mpark.variant': checked out '0b488da9bebac980e7ba0e158a959c956a449676' + $ git submodule update --init --recursive ./externalpackages/* -If you regularly work on two different branches and need to run ``make -submodules`` a lot, you may consider telling git to automatically +If you regularly work on two different branches and need to run the above command a lot, you may consider telling git to automatically update the submodules:: git config submodule.recurse=true From 48daf167b48eec244fcd135cfd4e1340b18cc1a0 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:37:31 +0100 Subject: [PATCH 20/37] Update recommendet PETSc --- manual/sphinx/user_docs/advanced_install.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 249bef37ec..c440487bc3 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -474,9 +474,9 @@ ways, so this is not guaranteed. To install PETSc version 3.13, use the following steps:: $ cd ~ - $ wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.13.4.tar.gz - $ tar -xzvf petsc-3.13.4.tar.gz - $ cd petsc-3.13.4 + $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.5.tar.gz + $ tar -xzvf petsc-3.17.5.tar.gz + $ cd petsc-3.17.5 Use the following configure options to ensure PETSc is compatible with BOUT++:: From 98edf23526ab5c87fcc9d37e0d129b0f618b4e3f Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:37:58 +0100 Subject: [PATCH 21/37] Update installing to cmake --- manual/sphinx/user_docs/installing.rst | 70 ++++++++++---------------- 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/manual/sphinx/user_docs/installing.rst b/manual/sphinx/user_docs/installing.rst index af209f4a6d..316fd04cd6 100644 --- a/manual/sphinx/user_docs/installing.rst +++ b/manual/sphinx/user_docs/installing.rst @@ -454,14 +454,9 @@ gettext. If you are planning on installing BOUT++ (see you will be running BOUT++ from the directory you downloaded it into, then configure with the option:: - ./configure --localedir=$PWD/locale + cmake . -DCMAKE_INSTALL_LOCALEDIR=$PWD/locale -This will enable BOUT++ to find the translations. When ``configure`` -finishes, the configuration summary should contain a line like:: - - configure: Natural language support: yes (path: /home/user/BOUT-dev/locale) - -where the ``path`` is the directory containing the translations. +This will enable BOUT++ to find the translations. See :ref:`sec-run-nls` for details of how to switch language when running BOUT++ simulations. @@ -509,7 +504,9 @@ or conda:: $ conda install numpy scipy matplotlib sympy netcdf4 h5py future importlib-metadata -They may also be available from your Linux system's package manager. +They may also be available from your Linux system's package manager:: + + $ sudo dnf install python3-boututils python3-boutdata To use the versions of ``boututils`` and ``boutdata`` provided by BOUT++, the path to ``tools/pylib`` should be added to the ``PYTHONPATH`` environment variable. This is not @@ -568,25 +565,14 @@ Compiling BOUT++ ---------------- Once BOUT++ has been configured, you can compile the bulk of the code by -going to the ``BOUT-dev`` directory (same as ``configure``) and running:: +going to the ``build`` directory and running:: $ make -(on OS-X, FreeBSD, and AIX this should be ``gmake``). This should print -something like:: - - ----- Compiling BOUT++ ----- - CXX = mpicxx - CFLAGS = -O -DCHECK=2 -DSIGHANDLE \ - -DREVISION=13571f760cec446d907e1bbeb1d7a3b1c6e0212a \ - -DNCDF -DBOUT_HAS_PVODE - CHECKSUM = ff3fb702b13acc092613cfce3869b875 - INCLUDE = -I../include - Compiling field.cxx - Compiling field2d.cxx - -At the end of this, you should see a file ``libbout++.a`` in the -``lib/`` subdirectory of the BOUT++ distribution. If you get an error, +(on OS-X, FreeBSD, and AIX this should be ``gmake``). + +At the end of this, you should see a file ``libbout++.so`` in the +``lib/`` subdirectory of the BOUT++ build directory. If you get an error, please `create an issue on Github `__ including: @@ -594,7 +580,7 @@ including: - The output from make, including full error message -- The ``make.config`` file in the BOUT++ root directory +- The ``CMakeCache.txt`` file in the BOUT++ build directory .. _sec-runtestsuite: @@ -607,23 +593,23 @@ way to run all of them is to simply do:: $ make check -from the top-level directory. Alternatively, if you just want to run -one them individually, you can do:: +from the build directory. Alternatively, if you just want to run +one set of them individually, you can do:: $ make check-unit-tests $ make check-integrated-tests $ make check-mms-tests -**Note:** The integrated test suite currently uses the ``mpirun`` +**Note:** The integrated and MMS test suites currently uses the ``mpirun`` command to launch the runs, so won’t work on machines which use a job -submission system like PBS or SGE. +submission system like slurm or PBS. These tests should all pass, but if not please `create an issue on Github `__ containing: - Which machine you’re running on -- The ``make.config`` file in the BOUT++ root directory +- The ``CMakeCache.txt`` file in the BOUT++ build directory - The ``run.log.*`` files in the directory of the test which failed @@ -655,18 +641,16 @@ This will install the following files under ``/usr/local/``: * ``/usr/local/include/bout++/...`` header files for BOUT++ -* ``/usr/local/lib/libbout++.a`` The main BOUT++ library +* ``/usr/local/lib/libbout++.so`` The main BOUT++ library -* ``/usr/local/lib/libpvode.a`` and ``/usr/local/lib/libpvpre.a``, the PVODE library +* ``/usr/local/lib/libpvode.so`` and ``/usr/local/lib/libpvpre.so``, the PVODE library * ``/usr/local/share/bout++/pylib/...`` Python analysis routines * ``/usr/local/share/bout++/idllib/...`` IDL analysis routines -* ``/usr/local/share/bout++/make.config`` A ``makefile`` configuration, used to compile many BOUT++ examples - -To install BOUT++ under a different directory, use the ``--prefix=`` +To install BOUT++ under a different directory, use the ``prefix=`` flag e.g. to install in your home directory:: $ make install prefix=$HOME/local/ @@ -674,20 +658,18 @@ flag e.g. to install in your home directory:: You can also specify this prefix when configuring, in the usual way (see :ref:`sec-config-bout`):: - $ ./configure --prefix=$HOME/local/ - $ make - $ make install + $ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/local/ + $ make -C build -j 4 + $ make -C build install More control over where files are installed is possible by passing options to -``configure``, following the GNU conventions: - -* ``--bindir=`` sets where ``bout-config`` will be installed ( default ``/usr/local/bin``) +``cmake``, following the GNU conventions: -* ``--includedir=`` sets where the ``bout++/*.hxx`` header files wil be installed (default ``/usr/local/include``) +* ``-DCMAKE_INSTALL_BINDIR=`` sets where ``bout-config`` will be installed ( default ``/usr/local/bin``) -* ``--libdir=`` sets where the ``libbout++.a``, ``libpvode.a`` and ``libpvpre.a`` libraries are installed (default ``/usr/local/lib``) +* ``-DCMAKE_INSTALL_INCLUDEDIR=`` sets where the ``bout++/*.hxx`` header files wil be installed (default ``/usr/local/include``) -* ``--datadir=`` sets where ``idllib``, ``pylib`` and ``make.config`` are installed (default ``/usr/local/share/``) +* ``-DCMAKE_INSTALL_LIBDIR=`` sets where the ``libbout++.so``, ``libpvode.so`` and ``libpvpre.so`` libraries are installed (default ``/usr/local/lib``) After installing, that you can run ``bout-config`` e.g:: From 9d6de349dc1e67497b451d303a8232e67c364a4a Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:38:20 +0100 Subject: [PATCH 22/37] 3D metrics user switched away from configure --- manual/sphinx/user_docs/new_in_v5.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/manual/sphinx/user_docs/new_in_v5.rst b/manual/sphinx/user_docs/new_in_v5.rst index 8a1f5b0128..b9eb637cd5 100644 --- a/manual/sphinx/user_docs/new_in_v5.rst +++ b/manual/sphinx/user_docs/new_in_v5.rst @@ -20,12 +20,6 @@ allow simulations of devices such as stellarators. To enable 3D metrics, build BOUT++ like: -.. code-block:: console - - ./configure --enable-metric-3D - -or, with CMake: - .. code-block:: console cmake . -B build -DBOUT_ENABLE_METRIC_3D=ON From 6352653ccf8a4a564c43863a8ac13152414a838b Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:38:37 +0100 Subject: [PATCH 23/37] make the cmake version more prominent --- manual/sphinx/user_docs/physics_models.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/sphinx/user_docs/physics_models.rst b/manual/sphinx/user_docs/physics_models.rst index bd1f72411f..daa0693562 100644 --- a/manual/sphinx/user_docs/physics_models.rst +++ b/manual/sphinx/user_docs/physics_models.rst @@ -1117,9 +1117,9 @@ everything except ``output_warn`` and ``output_error``. To enable the ``output_debug`` messages, configure BOUT++ with a ``CHECK`` level ``>= 3``. To enable it at lower check levels, -configure BOUT++ with ``--enable-debug-output`` (for ``./configure``) -or ``-DENABLE_OUTPUT_DEBUG`` (for ``CMake``). When running BOUT++ add -a ``-v -v`` flag to see ``output_debug`` messages. +configure BOUT++ with ``-DENABLE_OUTPUT_DEBUG`` (for ``CMake``; +``--enable-debug-output`` for ``./configure``)). When running BOUT++ +add a ``-v -v`` flag to see ``output_debug`` messages. .. _sec-3to4: From 17baa1c7f9affc0c075a52e26ab32cbb54cfd25b Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:39:01 +0100 Subject: [PATCH 24/37] Some updates to the boutpp documentation --- manual/sphinx/user_docs/python_boutpp.rst | 120 +++++++++++----------- 1 file changed, 58 insertions(+), 62 deletions(-) diff --git a/manual/sphinx/user_docs/python_boutpp.rst b/manual/sphinx/user_docs/python_boutpp.rst index 77786264a5..939a817ffe 100644 --- a/manual/sphinx/user_docs/python_boutpp.rst +++ b/manual/sphinx/user_docs/python_boutpp.rst @@ -1,55 +1,51 @@ The python boutpp module -========================== +======================== Installing ---------- -Installing boutpp can be tricky. -Ideally it should be just +Installing boutpp can be tricky, however in most cases it should be +automatically enabled if all dependencies are available. +To error out on missing dependencies, explicitly enable it:: .. code-block:: bash - ./configure --enable-shared - make -j 4 python + cmake -DBOUT_ENABLE_PYTHON=ON -but getting all the -dependencies can be difficult. -``make python`` creates the python3 module. +It can be especially tricky if you want to run boutpp on login nodes +for simple post processing, but due to differences in the instruction +set the compiled modules for the compute nodes do not run there. In +that case you need to manually install all needed dependencies. It is +probably a good idea to use a different build directory, to not +unintentionally modify your BOUT++ compilation for the compute nodes. -If problems arise, it might be worth checking a copy of the bout -module out, to reduce the risk of causing issues with the old bout -installation. This is especially true if you are trying to run -boutpp not on compute nodes of a super computer but rather on -post-processing/login/... nodes. +If you are running fedora - you can install pre-build binaries: -To use boutpp on the login node, a self compiled version of mpi may be -required, as the provided one may be only for the compute nodes. -Further, numpy header files are required, therefore numpy needs to be -compiled as well. -Further, the header files need to be exposed to the boutpp cython -compilation, e.g. by adding them to ``_boutpp_build/boutpp.pyx.in``. -It seems both ``NUMPY/numpy/core/include`` and -``NUMPY/build/src.linux-x86_64-2.7/numpy/core/include/numpy`` need to be -added, where ``NUMPY`` is the path of the numpy directory. -For running boutpp on the post processing nodes, fftw3 needs to be -compiled as well, if certain fftw routines are used. Note, fftw needs -to be configured with ``--enable-shared``. +.. code-block:: bash -After installing mpi e.g. in ``~/local/mpich``, bout needs to be -configured with something like: -``./configure --enable-shared MPICC=~/local/mpich/bin/mpicc MPICXX=~/local/mpich/bin/mpicxx --with-fftw=~/local/fftw/`` + sudo dnf install python3-bout++-mpich + module load mpi/mpich-$(arch) -``--enable-shared`` is required, so that pvode etc. is compiles as position -independent code. +You can also pip install boutpp with: -If you are running fedora - you can install pre-build binaries: +.. code-block:: bash + + pip install boutpp-nightly + +This will download the latest boutpp-nightly version, compile and +install it. Note that you still need all the non-python dependencies +like mpi. Note that after ``pip install boutpp-nightly`` the +``boutpp`` module is installed, so you can use ``import boutpp`` +independent of the version used. + +After the 5.0.0 release you will also be able to install the latest +released version of boutpp with: .. code-block:: bash - sudo dnf copr enable davidsch/bout - sudo dnf install python3-bout++-mpich - module load mpi/mpich-$(arch) + pip install boutpp + Purpose @@ -58,18 +54,18 @@ Purpose The boutpp module exposes (part) of the BOUT++ C++ library to python. It allows to calculate e.g. BOUT++ derivatives in python. -State ------ -Field3D and Field2D are working. If other fields are needed, please open an issue. -Fields can be accessed directly using the [] operators, and give a list of slice objects. -The get all data, ``f3d.getAll()`` is equivalent to ``f3d[:,:,]`` and returns a numpy array. -This array can be addressed with -e.g. ``[]`` operators, and then the field can be set again with -``f3d.setAll(numpyarray)``. -It is also possible to set a part of an Field3D with the ``[]`` operators. -Addition, multiplication etc. are all available. -The derivatives should all be working, if find a missing one, please open an issue. -Vectors are not exposed yet. +State ----- Field3D and Field2D are working. If other fields are +needed, please open an issue. Fields can be accessed directly using +the [] operators, similar to numpy. The get all data, ``f3d[:]`` is +equivalent to ``f3d[:, :, :]`` and returns a numpy array. This array +can be addressed with e.g. ``[]`` operators, and then the field can be +set again with ``f3d[:] = numpyarray``. It is also possible to set a +part of an Field3D with the ``[]`` operators. Addition, +multiplication etc. are all available. The derivatives should all be +working, if find a missing one, please open an issue. + +Note that views are currently not supported, thus ``f3d[:] += 1`` will +modify the returned copy, and the ``f3d`` object will be unchanged. Functions --------- @@ -84,12 +80,12 @@ Some trivial post processing: import boutpp import numpy as np - args="-d data -f BOUT.settings -o BOUT.post".split(" ") + args="-d data -f BOUT.settings -o BOUT.post" boutpp.init(args) - dens=boutpp.Field3D.fromCollect("n",path="data") - temp=boutpp.Field3D.fromCollect("T",path="data") - pres=dens*temp - dpdz=boutpp.DDZ(pres,outloc="CELL_ZLOW") + dens = boutpp.Field3D.fromCollect("n", path="data") + temp = boutpp.Field3D.fromCollect("T", path="data") + pres = dens * temp + dpdz = boutpp.DDZ(pres, outloc="CELL_ZLOW") @@ -100,14 +96,14 @@ A simple MMS test: import boutpp import numpy as np boutpp.init("-d data -f BOUT.settings -o BOUT.post") - for nz in [64,128,256]: - boutpp.setOption("meshz:nz","%d"%nz) - mesh=boutpp.Mesh(OptionSection="meshz") - f=boutpp.create3D("sin(z)",mesh) - sim=boutpp.DDZ(f) - ana=boutpp.create3D("cos(z)",mesh) - err=sim-ana - err=boutpp.max(boutpp.abs(err)) + for nz in [64, 128, 256]: + boutpp.setOption("meshz:nz", "%d"%nz) + mesh = boutpp.Mesh(OptionSection="meshz") + f = boutpp.create3D("sin(z)", mesh) + sim = boutpp.DDZ(f) + ana = boutpp.create3D("cos(z)", mesh) + err = sim - ana + err = boutpp.max(boutpp.abs(err)) errors.append(err) @@ -118,10 +114,10 @@ A real example - unstagger data: import boutpp boutpp.init("-d data -f BOUT.settings -o BOUT.post") # uses location from dump - is already staggered - upar=boutpp.Field3D.fromCollect("Upar") - upar=boutpp.interp_to(upar,"CELL_CENTRE") + upar = boutpp.Field3D.fromCollect("Upar") + upar = boutpp.interp_to(upar, "CELL_CENTRE") # convert to numpy array - upar=upar.getAll() + upar = upar[:] A real example - check derivative contributions: From a2fcb7848c06fd4c97f535bc1a44b5781a20167d Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:39:24 +0100 Subject: [PATCH 25/37] Update more flags to the cmake version --- manual/sphinx/user_docs/running_bout.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/manual/sphinx/user_docs/running_bout.rst b/manual/sphinx/user_docs/running_bout.rst index 09102bab33..59c5b53828 100644 --- a/manual/sphinx/user_docs/running_bout.rst +++ b/manual/sphinx/user_docs/running_bout.rst @@ -232,26 +232,25 @@ when you need a way to debug your code too. which shows which functions were being run (most recent first). This should give a good indication of where an error occurred. If this stack isn’t printed, make sure checking is set to level 2 or higher - (``./configure –-enable-checks=2``). + (``cmake -DCHECK=2``). - If the error is due to non-finite numbers, increase the checking - level (``./configure –-enable-checks=3``) to perform more checking of + level (``cmake -DCHECK=3``) to perform more checking of values and (hopefully) find an error as soon as possible after it occurs. - If the error is a segmentation fault, you can try a debugger such as gdb or totalview. You will likely need to compile with some - debugging flags (``./configure --enable-debug``). + debugging flags (``cmake -DCMAKE_CXX_FLAGS=" -g "``). - You can also enable exceptions on floating point errors - (``./configure --enable-sigfpe``), though the majority of these + (``cmake -DBOUT_ENABLE_SIGFPE``), though the majority of these types of errors should be caught with checking level set to 3. - Expert users can try AddressSanitizer, which is a tool that comes with recent versions of GCC and Clang. To enable AddressSanitizer, include ``-fsanitize=leak -fsanitize=address -fsanitize=undefined`` - in ``CXXFLAGS`` when configuring BOUT++, or add them to - ``BOUT_FLAGS``. + in ``-DCMAKE_CXX_FLAGS`` when configuring BOUT++. Startup output -------------- From 7b908b0ba4e334aa8014a25cd1e3612f7baea37e Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:55:26 +0100 Subject: [PATCH 26/37] Change some more options to cmake --- manual/sphinx/developer_docs/data_types.rst | 2 +- manual/sphinx/developer_docs/mesh.rst | 2 +- manual/sphinx/user_docs/input_grids.rst | 2 +- manual/sphinx/user_docs/staggered_grids.rst | 2 +- manual/sphinx/user_docs/time_integration.rst | 54 ++++++++++---------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/manual/sphinx/developer_docs/data_types.rst b/manual/sphinx/developer_docs/data_types.rst index fa19f83bbc..2e303381f9 100644 --- a/manual/sphinx/developer_docs/data_types.rst +++ b/manual/sphinx/developer_docs/data_types.rst @@ -347,7 +347,7 @@ offsets there is a function ``offset(x,y,z)`` so that Note that by default no bounds checking is performed. If the checking level is increased to 3 or above then bounds checks will be performed. This will have a significant (bad) impact on performance, so is -just for debugging purposes. Configure with ``--enable-checks=3`` +just for debugging purposes. Configure with ``-DCHECK=3`` option to do this. diff --git a/manual/sphinx/developer_docs/mesh.rst b/manual/sphinx/developer_docs/mesh.rst index 94f9ff2ca4..06c175b64a 100644 --- a/manual/sphinx/developer_docs/mesh.rst +++ b/manual/sphinx/developer_docs/mesh.rst @@ -270,7 +270,7 @@ The mesh spacing is given by the public members `Coordinates::dx`, Field2D zlength(); // Computed from dz `Coordinates::FieldMetric` can be either `Field2D` or if BOUT++ has -been configured with ``--enable-metric-3d`` then a `Field3D`. +been configured with ``-DBOUT_ENABLE_METRIC_3D`` then a `Field3D`. Metrics ------- diff --git a/manual/sphinx/user_docs/input_grids.rst b/manual/sphinx/user_docs/input_grids.rst index c1e3347eec..5dd395ac61 100644 --- a/manual/sphinx/user_docs/input_grids.rst +++ b/manual/sphinx/user_docs/input_grids.rst @@ -111,7 +111,7 @@ found, a warning will be printed and the default values used. - Differencing quantities in 2D/3D arrays ``dx(nx,ny[,nz])``, ``dy(nx,ny[,nz])`` and ``dz(nx,ny[,nz])``. If these are not found they will be set to 1. To allow variation in ``z`` direction, BOUT++ - has to be configured ``--enable-metric-3d``, otherwise 2D fields are + has to be configured ``-DBOUT_ENABLE_METRIC_3D``, otherwise 2D fields are used for the metric fields. Note that prior to BOUT++ version 5 ``dz`` was a constant. diff --git a/manual/sphinx/user_docs/staggered_grids.rst b/manual/sphinx/user_docs/staggered_grids.rst index 42b5deb698..00f565d560 100644 --- a/manual/sphinx/user_docs/staggered_grids.rst +++ b/manual/sphinx/user_docs/staggered_grids.rst @@ -46,7 +46,7 @@ locations of the evolving variables are:: which makes the velocity ``v`` staggered to the lower side of the cell in Y, whilst the density :math:`n` remains cell centred. -.. note:: If BOUT++ was configued ``--with-checks``, +.. note:: If BOUT++ was not configued with ``-DCHECK=0``, `Field3D::setLocation` will throw an exception if you don't have staggered grids turned on and try to set the location to something other than `CELL_CENTRE`. If you want to be diff --git a/manual/sphinx/user_docs/time_integration.rst b/manual/sphinx/user_docs/time_integration.rst index 7118039633..9d5a34ea89 100644 --- a/manual/sphinx/user_docs/time_integration.rst +++ b/manual/sphinx/user_docs/time_integration.rst @@ -34,33 +34,33 @@ needed to make the solver available. .. _tab-solvers: .. table:: Available time integration solvers - +---------------+-----------------------------------------+--------------------+ - | Name | Description | Compile options | - +===============+=========================================+====================+ - | euler | Euler explicit method (example only) | Always available | - +---------------+-----------------------------------------+--------------------+ - | rk4 | Runge-Kutta 4th-order explicit method | Always available | - +---------------+-----------------------------------------+--------------------+ - | rkgeneric | Generic Runge Kutta explicit methods | Always available | - +---------------+-----------------------------------------+--------------------+ - | rk3ssp | 3rd-order Strong Stability Preserving | Always available | - +---------------+-----------------------------------------+--------------------+ - | splitrk | Split RK3-SSP and RK-Legendre | Always available | - +---------------+-----------------------------------------+--------------------+ - | pvode | 1998 PVODE with BDF method | Always available | - +---------------+-----------------------------------------+--------------------+ - | cvode | SUNDIALS CVODE. BDF and Adams methods | –with-cvode | - +---------------+-----------------------------------------+--------------------+ - | ida | SUNDIALS IDA. DAE solver | –with-ida | - +---------------+-----------------------------------------+--------------------+ - | arkode | SUNDIALS ARKODE IMEX solver | –with-arkode | - +---------------+-----------------------------------------+--------------------+ - | petsc | PETSc TS methods | –with-petsc | - +---------------+-----------------------------------------+--------------------+ - | imexbdf2 | IMEX-BDF2 scheme | –with-petsc | - +---------------+-----------------------------------------+--------------------+ - | beuler / snes | Backward Euler with SNES solvers | --with-petsc | - +---------------+-----------------------------------------+--------------------+ + +---------------+-----------------------------------------+------------------------+ + | Name | Description | Compile options | + +===============+=========================================+========================+ + | euler | Euler explicit method (example only) | Always available | + +---------------+-----------------------------------------+------------------------+ + | rk4 | Runge-Kutta 4th-order explicit method | Always available | + +---------------+-----------------------------------------+------------------------+ + | rkgeneric | Generic Runge Kutta explicit methods | Always available | + +---------------+-----------------------------------------+------------------------+ + | rk3ssp | 3rd-order Strong Stability Preserving | Always available | + +---------------+-----------------------------------------+------------------------+ + | splitrk | Split RK3-SSP and RK-Legendre | Always available | + +---------------+-----------------------------------------+------------------------+ + | pvode | 1998 PVODE with BDF method | Always available | + +---------------+-----------------------------------------+------------------------+ + | cvode | SUNDIALS CVODE. BDF and Adams methods | -DBOUT_USE_SUNDIALS=ON | + +---------------+-----------------------------------------+------------------------+ + | ida | SUNDIALS IDA. DAE solver | -DBOUT_USE_SUNDIALS=ON | + +---------------+-----------------------------------------+------------------------+ + | arkode | SUNDIALS ARKODE IMEX solver | -DBOUT_USE_SUNDIALS=ON | + +---------------+-----------------------------------------+------------------------+ + | petsc | PETSc TS methods | -DBOUT_USE_PETSC=ON | + +---------------+-----------------------------------------+------------------------+ + | imexbdf2 | IMEX-BDF2 scheme | -DBOUT_USE_PETSC=ON | + +---------------+-----------------------------------------+------------------------+ + | beuler / snes | Backward Euler with SNES solvers | -DBOUT_USE_PETSC=ON | + +---------------+-----------------------------------------+------------------------+ Each solver can have its own settings which work in slightly different ways, but some common settings and which solvers they are used in are From eecf5adfadbe503eba9a42b163cf6ade3a399c0f Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 4 Nov 2022 23:55:43 +0100 Subject: [PATCH 27/37] Update scorep section to cmake --- manual/sphinx/developer_docs/performance_profiling.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manual/sphinx/developer_docs/performance_profiling.rst b/manual/sphinx/developer_docs/performance_profiling.rst index 9ba5c8d484..d93c1e904b 100644 --- a/manual/sphinx/developer_docs/performance_profiling.rst +++ b/manual/sphinx/developer_docs/performance_profiling.rst @@ -82,11 +82,10 @@ percent of runtime. Configure and build ~~~~~~~~~~~~~~~~~~~ -Configure with ``--with-scorep`` to enable Scorep instrumentation, then build -as normal. This option can be combined with other options, but it is usually -desirable to profile the optimized code, configuring with the flags -``--enable-optimize=3 --enable-checks=0``. Build the code with ``make`` as -normal. +Configure with ``-BOUT_USE_SCOREP`` to enable Scorep instrumentation, +then build as normal. This option can be combined with other options, +but it is usually desirable to profile the optimized code, configuring +with the flags ````. Build the code with ``make`` as normal. With CMake: @@ -95,6 +94,7 @@ With CMake: $ SCOREP_WRAPPER=off cmake \ -DCMAKE_C_COMPILER=scorep-mpicc \ -DCMAKE_CXX_COMPILER=scorep-mpicxx \ + -DCMAKE_CXX_FLAGS=-O3 -DCHECK=0 \ This will turn off the instrumentation during the configure From 5acab089066ded935c0d7be05994be2fadf00cac Mon Sep 17 00:00:00 2001 From: tomc271 Date: Sat, 15 Apr 2023 17:11:35 +0100 Subject: [PATCH 28/37] Single hyphen for DCHECK option. --- manual/sphinx/user_docs/advanced_install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index c440487bc3..d9d0d7ede5 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -17,7 +17,7 @@ Optimisation and run-time checking Configure with ``-DCHECK=3`` enables a lot of checks of operations performed by the field objects. This is very useful for debugging a code, and can be omitted once bugs have been removed. -``--DCHECK=2`` enables less checking, especially the +``-DCHECK=2`` enables less checking, especially the computationally rather expensive ones, while ``-DCHECK=0`` disables most checks. From 5d2aeac61d4d4403d89d230097f304dd166fcc8d Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 13:33:05 +0100 Subject: [PATCH 29/37] Corrected cmake argument -DPETSC_ROOT to -DPETSC_DIR in PETSc section of 'Advanced installation options' page of manual. --- manual/sphinx/user_docs/advanced_install.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index d9d0d7ede5..346f9e3154 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -532,11 +532,11 @@ something like:: To configure BOUT++ with PETSc, add to the cmake configure command:: - -DBOUT_USE_PETSC=ON -DPETSC_ROOT=$HOME/local/petsc-version-options + -DBOUT_USE_PETSC=ON -DPETSC_DIR=$HOME/local/petsc-version-options For example like this:: - $ cmake -DBOUT_USE_PETSC=ON -DPETSC_ROOT=$HOME/local/petsc-version-options + $ cmake -DBOUT_USE_PETSC=ON -DPETSC_DIR=$HOME/local/petsc-version-options BOUT++ can also work with PETSc if it has not been installed. In this case ensure that ``PETSC_DIR`` and ``PETSC_ARCH`` are set, for example From 7d4de3da2acada18bd041a65952699514376e2a1 Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 13:40:03 +0100 Subject: [PATCH 30/37] Update examples to petsc version 3.19.0 in 'Advanced installation options' page of manual. --- manual/sphinx/user_docs/advanced_install.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 346f9e3154..3624ebfcf6 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -470,13 +470,13 @@ Helmholtz equations. Currently, BOUT++ supports PETSc versions 3.7 - 3.14. More recent versions may well work, but the PETSc API does sometimes change in backward-incompatible -ways, so this is not guaranteed. To install PETSc version 3.13, use the +ways, so this is not guaranteed. To install PETSc version 3.19, use the following steps:: $ cd ~ - $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.5.tar.gz - $ tar -xzvf petsc-3.17.5.tar.gz - $ cd petsc-3.17.5 + $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.0.tar.gz + $ tar -xzvf petsc-3.19.0.tar.gz + $ cd petsc-3.19.0 Use the following configure options to ensure PETSc is compatible with BOUT++:: @@ -514,7 +514,7 @@ installed to. To make PETSc type what is shown in the terminal output after the configure step, something like:: - $ make PETSC_DIR=$HOME/petsc-3.13.4 PETSC_ARCH=arch-linux2-cxx-debug all + $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug all Should BLAS, LAPACK, or any other packages be missing, you will get an error, and a suggestion that you can append @@ -523,12 +523,12 @@ error, and a suggestion that you can append You may want to test that everything is configured properly. To do this replace ``all`` with ``test`` in the make command. It should be something like:: - $ make PETSC_DIR=$HOME/petsc-3.13.4 PETSC_ARCH=arch-linux2-cxx-debug test + $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug test To install PETSc, replace ``test``/``all`` with ``install`` and run something like:: - $ make PETSC_DIR=$HOME/petsc-3.13.4 PETSC_ARCH=arch-linux2-cxx-debug install + $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug install To configure BOUT++ with PETSc, add to the cmake configure command:: From ffcdd3397a74376f29ad915232652216ca34b01d Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 13:40:27 +0100 Subject: [PATCH 31/37] Add /manual/sphinx/_build to gitignore file. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d386292a97..1806dd2672 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ coverage/ # Python stuff /_wheel*/ /dist/ +/manual/sphinx/_build From e89c2c4ff7ea6ca8e32da86e667132ede6a9cf2f Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 13:43:11 +0100 Subject: [PATCH 32/37] Added comma, for clarity. --- manual/sphinx/user_docs/advanced_install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 3624ebfcf6..6c7742af2f 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -511,7 +511,7 @@ installed to. to ``./configure``. -To make PETSc type what is shown in the terminal output after the configure +To make PETSc, type what is shown in the terminal output after the configure step, something like:: $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug all From f3dc73ffd4ec50b9961f03b79cdc10f6161b2a6c Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 14:39:50 +0100 Subject: [PATCH 33/37] Clarify example using dnf. --- manual/sphinx/user_docs/installing.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manual/sphinx/user_docs/installing.rst b/manual/sphinx/user_docs/installing.rst index 316fd04cd6..3527fa00f2 100644 --- a/manual/sphinx/user_docs/installing.rst +++ b/manual/sphinx/user_docs/installing.rst @@ -504,7 +504,9 @@ or conda:: $ conda install numpy scipy matplotlib sympy netcdf4 h5py future importlib-metadata -They may also be available from your Linux system's package manager:: +They may also be available from your Linux system's package manager. + +For example on Fedora:: $ sudo dnf install python3-boututils python3-boutdata From 299c7479061e745e00219db72a627dd58f600114 Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 17 Apr 2023 15:22:08 +0100 Subject: [PATCH 34/37] Change command example from 'make' to 'cmake --build ' in 'Compiling BOUT++' section of 'Advanced installation options' page of manual. --- manual/sphinx/user_docs/installing.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/manual/sphinx/user_docs/installing.rst b/manual/sphinx/user_docs/installing.rst index 3527fa00f2..590be239c6 100644 --- a/manual/sphinx/user_docs/installing.rst +++ b/manual/sphinx/user_docs/installing.rst @@ -567,11 +567,9 @@ Compiling BOUT++ ---------------- Once BOUT++ has been configured, you can compile the bulk of the code by -going to the ``build`` directory and running:: +going to the ``BOUT-dev`` directory and running:: - $ make - -(on OS-X, FreeBSD, and AIX this should be ``gmake``). + $ cmake --build At the end of this, you should see a file ``libbout++.so`` in the ``lib/`` subdirectory of the BOUT++ build directory. If you get an error, From 37e4c608ff4271decddef61844eee57eb6b9d0d6 Mon Sep 17 00:00:00 2001 From: tomc271 Date: Tue, 18 Apr 2023 15:28:30 +0100 Subject: [PATCH 35/37] Use petsc version 3.17.5 in examples, on 'Advanced installation options' page of manual. (version 3.19 is not compatible) [skip ci] --- manual/sphinx/user_docs/advanced_install.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 6c7742af2f..00011996d3 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -468,15 +468,15 @@ BOUT++ can use PETSc https://www.mcs.anl.gov/petsc/ for time-integration and for solving elliptic problems, such as inverting Poisson and Helmholtz equations. -Currently, BOUT++ supports PETSc versions 3.7 - 3.14. More recent versions may +Currently, BOUT++ supports PETSc versions 3.7 - 3.17. More recent versions may well work, but the PETSc API does sometimes change in backward-incompatible -ways, so this is not guaranteed. To install PETSc version 3.19, use the +ways, so this is not guaranteed. To install PETSc version 3.17, use the following steps:: $ cd ~ - $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.0.tar.gz - $ tar -xzvf petsc-3.19.0.tar.gz - $ cd petsc-3.19.0 + $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.5.tar.gz + $ tar -xzvf petsc-3.17.5.tar.gz + $ cd petsc-3.17.5 Use the following configure options to ensure PETSc is compatible with BOUT++:: @@ -514,7 +514,7 @@ installed to. To make PETSc, type what is shown in the terminal output after the configure step, something like:: - $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug all + $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug all Should BLAS, LAPACK, or any other packages be missing, you will get an error, and a suggestion that you can append @@ -523,12 +523,12 @@ error, and a suggestion that you can append You may want to test that everything is configured properly. To do this replace ``all`` with ``test`` in the make command. It should be something like:: - $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug test + $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug test To install PETSc, replace ``test``/``all`` with ``install`` and run something like:: - $ make PETSC_DIR=$HOME/petsc-3.19.0 PETSC_ARCH=arch-linux2-cxx-debug install + $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug install To configure BOUT++ with PETSc, add to the cmake configure command:: From 9227f88f752738d36797333c0434b7d47978518d Mon Sep 17 00:00:00 2001 From: tomc271 Date: Mon, 1 May 2023 13:02:18 +0100 Subject: [PATCH 36/37] Update more example code snippets from make to cmake. Include -S and -B flags, so examples are more consistent. Use to indicate the path to the build directory. [skip ci] --- manual/sphinx/user_docs/advanced_install.rst | 14 +++++++------ manual/sphinx/user_docs/installing.rst | 22 +++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index 00011996d3..cd8d7a8f04 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -196,9 +196,11 @@ Compiling with Apple Clang 12, the following configuration has been known to wor .. code-block:: tcsh - cmake . -B build -DBOUT_ENABLE_BACKTRACE=Off -DBUILD_SHARED_LIBS=Off -DBOUT_USE_NLS=Off -DBOUT_USE_UUID_SYSTEM_GENERATOR=Off - cd build - make + cmake . -B -DBOUT_ENABLE_BACKTRACE=Off -DBUILD_SHARED_LIBS=Off -DBOUT_USE_NLS=Off -DBOUT_USE_UUID_SYSTEM_GENERATOR=Off + cd + cmake --build + +where ```` is the path to the build directory Marconi ~~~~~~~ @@ -536,7 +538,7 @@ To configure BOUT++ with PETSc, add to the cmake configure command:: For example like this:: - $ cmake -DBOUT_USE_PETSC=ON -DPETSC_DIR=$HOME/local/petsc-version-options + $ cmake -S . -B -DBOUT_USE_PETSC=ON -DPETSC_DIR=$HOME/local/petsc-version-options BOUT++ can also work with PETSc if it has not been installed. In this case ensure that ``PETSC_DIR`` and ``PETSC_ARCH`` are set, for example @@ -556,11 +558,11 @@ serial performance. This does not add new features, but may be faster in some cases. LAPACK is however written in FORTRAN 77, which can cause linking headaches. To enable these routines use:: - $ cmake . -DBOUT_USE_LAPACK=ON + $ cmake -S . -B -DBOUT_USE_LAPACK=ON and to specify a non-standard path:: - $ cmake . -DBOUT_USE_LAPACK=ON -DLAPACK_ROOT=/path/to/lapack + $ cmake -S . -B -DBOUT_USE_LAPACK=ON -DLAPACK_ROOT=/path/to/lapack MPI compilers diff --git a/manual/sphinx/user_docs/installing.rst b/manual/sphinx/user_docs/installing.rst index 590be239c6..b6a12aec46 100644 --- a/manual/sphinx/user_docs/installing.rst +++ b/manual/sphinx/user_docs/installing.rst @@ -571,6 +571,8 @@ going to the ``BOUT-dev`` directory and running:: $ cmake --build +where ```` is the path to the build directory + At the end of this, you should see a file ``libbout++.so`` in the ``lib/`` subdirectory of the BOUT++ build directory. If you get an error, please `create an issue on Github `__ @@ -591,14 +593,14 @@ BOUT++ comes with three sets of test suites: unit tests, integrated tests and method of manufactured solutions (MMS) tests. The easiest way to run all of them is to simply do:: - $ make check + $ cmake --build --target check -from the build directory. Alternatively, if you just want to run +Alternatively, if you just want to run one set of them individually, you can do:: - $ make check-unit-tests - $ make check-integrated-tests - $ make check-mms-tests + $ cmake --build --target check-unit-tests + $ cmake --build --target check-integrated-tests + $ cmake --build --target check-mms-tests **Note:** The integrated and MMS test suites currently uses the ``mpirun`` command to launch the runs, so won’t work on machines which use a job @@ -631,7 +633,7 @@ not widely used and so should be considered experimental. After configuring and compiling BOUT++ as above, BOUT++ can be installed to system directories by running as superuser or ``sudo``:: - $ sudo make install + $ sudo cmake --build --target install .. DANGER:: Do not do this unless you know what you're doing! @@ -653,14 +655,14 @@ This will install the following files under ``/usr/local/``: To install BOUT++ under a different directory, use the ``prefix=`` flag e.g. to install in your home directory:: - $ make install prefix=$HOME/local/ + $ cmake --build --target install -DCMAKE_INSTALL_PREFIX=$HOME/local/ You can also specify this prefix when configuring, in the usual way (see :ref:`sec-config-bout`):: - $ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/local/ - $ make -C build -j 4 - $ make -C build install + $ cmake -S . -B -DCMAKE_INSTALL_PREFIX=$HOME/local/ + $ cmake --build -j 4 + $ cmake --build --target install More control over where files are installed is possible by passing options to ``cmake``, following the GNU conventions: From a6087093231d6c0ab05d7ea1eae801b3d3ea50c4 Mon Sep 17 00:00:00 2001 From: tomc271 Date: Fri, 12 May 2023 10:33:24 +0100 Subject: [PATCH 37/37] Use petsc version 3.19.1 in examples, on 'Advanced installation options' page of manual. [skip ci] --- manual/sphinx/user_docs/advanced_install.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manual/sphinx/user_docs/advanced_install.rst b/manual/sphinx/user_docs/advanced_install.rst index cd8d7a8f04..89eed8ddbf 100644 --- a/manual/sphinx/user_docs/advanced_install.rst +++ b/manual/sphinx/user_docs/advanced_install.rst @@ -470,15 +470,15 @@ BOUT++ can use PETSc https://www.mcs.anl.gov/petsc/ for time-integration and for solving elliptic problems, such as inverting Poisson and Helmholtz equations. -Currently, BOUT++ supports PETSc versions 3.7 - 3.17. More recent versions may +Currently, BOUT++ supports PETSc versions 3.7 - 3.19. More recent versions may well work, but the PETSc API does sometimes change in backward-incompatible -ways, so this is not guaranteed. To install PETSc version 3.17, use the +ways, so this is not guaranteed. To install PETSc version 3.19, use the following steps:: $ cd ~ - $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.5.tar.gz - $ tar -xzvf petsc-3.17.5.tar.gz - $ cd petsc-3.17.5 + $ wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.1.tar.gz + $ tar -xzvf petsc-3.19.1.tar.gz + $ cd petsc-3.19.1 Use the following configure options to ensure PETSc is compatible with BOUT++:: @@ -516,7 +516,7 @@ installed to. To make PETSc, type what is shown in the terminal output after the configure step, something like:: - $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug all + $ make PETSC_DIR=$HOME/petsc-3.19.1 PETSC_ARCH=arch-linux2-cxx-debug all Should BLAS, LAPACK, or any other packages be missing, you will get an error, and a suggestion that you can append @@ -525,12 +525,12 @@ error, and a suggestion that you can append You may want to test that everything is configured properly. To do this replace ``all`` with ``test`` in the make command. It should be something like:: - $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug test + $ make PETSC_DIR=$HOME/petsc-3.19.1 PETSC_ARCH=arch-linux2-cxx-debug test To install PETSc, replace ``test``/``all`` with ``install`` and run something like:: - $ make PETSC_DIR=$HOME/petsc-3.17.5 PETSC_ARCH=arch-linux2-cxx-debug install + $ make PETSC_DIR=$HOME/petsc-3.19.1 PETSC_ARCH=arch-linux2-cxx-debug install To configure BOUT++ with PETSc, add to the cmake configure command::