Skip to content

Commit

Permalink
Merge pull request #2720 from boutproject/v5.1.0-rc
Browse files Browse the repository at this point in the history
5.1 release candidate
  • Loading branch information
ZedThree authored Oct 4, 2023
2 parents fd303eb + 8ae5e35 commit 2e3cc2c
Show file tree
Hide file tree
Showing 121 changed files with 1,863 additions and 1,188 deletions.
2 changes: 1 addition & 1 deletion .build_petsc_for_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if test $BUILD_PETSC ; then
--with-scalar-type=real \
--with-shared-libraries=1 \
--with-debugging=0 \
{C,CXX,F}OPTFLAGS="-O3 -march=native" \
{C,CXX,F}OPTFLAGS="-O3" \
--prefix=$HOME/local/petsc

make && make install
Expand Down
2 changes: 1 addition & 1 deletion .ci_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ else
cd
cd BOUT-dev
echo "starting configure"
time cmake -DBOUT_USE_PETSC=ON -S . -B build
time cmake -S . -B build -DBOUT_USE_PETSC=ON
time make -C build build-check -j 2
time make -C build check
fi
13 changes: 12 additions & 1 deletion .ci_with_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
set -ex

cmake --version
cmake . -B build $@ -DCMAKE_INSTALL_PREFIX=$(pwd)/installed
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
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
cd ../examples/make-script
PATH=../../build/bin:$PATH bout-config --all
PATH=../../build/bin:$PATH make
./test --help
cd -
Expand All @@ -25,6 +35,7 @@ rm -rf build
# Test installation with plain `make`
cd ../examples/make-script
rm test
PATH=../../installed/bin:$PATH bout-config --all
PATH=../../installed/bin:$PATH make
./test --help
cd -
Expand Down
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-misc-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-vararg,-clang-analyzer-optin.mpi*,-bugprone-exception-escape,-cppcoreguidelines-pro-bounds-pointer-arithmetic'
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-misc-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-vararg,-clang-analyzer-optin.mpi*,-bugprone-exception-escape,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-function-cognitive-complexity'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
Expand Down
29 changes: 29 additions & 0 deletions .docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set -ex

if which docker &> /dev/null ; then
cmd="time sudo docker"
else
cmd="time podman"
fi

file=$1
(test $file && test -f $file) || file=.docker/fedora/Dockerfile
test $# -gt 0 && shift

if test -x $file
then
COMMIT=$(git rev-parse HEAD) $file $@ > Dockerfile
else
cp $file Dockerfile
fi

$cmd login -p $DOCKER_TOKEN -u $DOCKER_USER

cat Dockerfile

$cmd build -t mobydick . --build-arg=COMMIT=$(git rev-parse HEAD) --build-arg=MPI=$MPI --build-arg=CMAKE_OPTIONS="$CMAKE_OPTIONS" --build-arg=BASE=$BASE
for tag in $TAGS
do
$cmd tag mobydick $tag
$cmd push $tag
done
39 changes: 39 additions & 0 deletions .docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ARG BASE
FROM ghcr.io/dschwoerer/bout-container-base:$BASE

# ----------------------------------------------------------------
# Build and install BOUT++
# ----------------------------------------------------------------
# user: boutuser
# password: boutforever

ARG MPI
ARG URL
ARG COMMIT
ARG CMAKE_OPTIONS

RUN sudo ls

# Checkout submodules now so configure later is fast, and iterating on
# it less painful
RUN git clone $URL \
&& chown -R boutuser /home/boutuser/BOUT-dev \
&& cd BOUT-dev \
&& git checkout $COMMIT \
&& git submodule update --init --recursive


WORKDIR /home/boutuser/BOUT-dev

RUN cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/opt/bout++/ \
-DBOUT_GENERATE_FIELDOPS=OFF \
-DBOUT_USE_PETSC=ON -DPETSc_ROOT=/opt/petsc \
-DBOUT_ENABLE_PYTHON=ON \
-DBOUT_USE_SUNDIALS=ON -DSUNDIALS_ROOT=/usr/lib64/$MPI/ -DSUNDIALS_INCLUDE_DIR=/usr/include/$MPI-x86_64/sundials/ \
$CMAKE_OPTIONS || (cat /home/boutuser/BOUT-dev/build/CMakeFiles/CMake{Output,Error}.log ; exit 1)


RUN make -C build -j 2
RUN sudo make -C build install

RUN find /opt/bout++
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

updates:
- package-ecosystem: "gitsubmodule"
schedule:
interval: "daily"
directory: "/"

- package-ecosystem: "pip"
schedule:
interval: "daily"
directory: "/"

- package-ecosystem: "github-actions"
schedule:
interval: "weekly"
directory: "/"
5 changes: 4 additions & 1 deletion .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
submodules: true

- name: Run clang-tidy
uses: ZedThree/clang-tidy-review@v0.8.4
uses: ZedThree/clang-tidy-review@v0.13.1
id: review
with:
build_dir: build
Expand All @@ -44,3 +44,6 @@ jobs:
-DBOUT_ENABLE_PYTHON=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DBOUT_UPDATE_GIT_SUBMODULE=OFF
- name: Upload clang-tidy fixes
uses: ZedThree/clang-tidy-review/[email protected]
84 changes: 84 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Docker

on:
push:
branches:
- master
- next
# Add your branch here if you want containers for it
- db-WIP
- docker-ci

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build ${{ matrix.config.name }} Container (${{ matrix.metric3d.name }} ; ${{matrix.mpi}})
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
mpi: [mpich]
metric3d:
- name: "With OpenMP"
cmake: ON
base_prefix: "openmp-"
tag_prefix: "3d-"
- name: "Without OpenMP"
cmake: OFF
base_prefix: ""
tag_prefix: ""
config:
- name: "Debug"
tag_postfix: "debug"
options: "-DCHECK=3"
base_postfix: "mini"

- name: "Optimised"
tag_postfix: "opt"
options: "-DCHECK=0"
base_postfix: "mini"

- name: "Full"
tag_postfix: "full"
options: "-DCHECK=3"
base_postfix: "full"

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
prefix=${{ matrix.mpi }}-${{matrix.metric3d.tag_prefix}}${{ matrix.config.tag_postfix }}-
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
build-args: |
BASE=${{ matrix.mpi }}-${{ matrix.metric3d.base_prefix }}${{ matrix.config.base_postfix }}-main
MPI=${{ matrix.mpi }}
CMAKE_OPTIONS=${{ matrix.config.options }} -DBOUT_ENABLE_METRIC_3D=${{ matrix.metric3d.cmake }} -DBOUT_ENABLE_OPENMP=${{ matrix.metric3d.cmake }}
COMMIT=${{ github.sha }}
URL=${{ github.server_url }}/${{ github.repository }}
context: .docker/fedora/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
91 changes: 40 additions & 51 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,42 @@ 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:
- ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.base_ref == 'master' || github.base_ref == 'next' }}
config:
- name: "Default options, Ubuntu 20.04"
os: ubuntu-20.04
configure_options: ""
script_flags: "-uim"
cmake_options: ""

- name: "Optimised, shared, Python"
- name: "Optimised, static"
os: ubuntu-20.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"
script_flags: "-uim -t shared -t python"
omp_num_threads: 1
cmake_options: "-DCHECK=0
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_CXX_FLAGS=-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-20.04
configure_options: "--enable-shared
--enable-sigfpe
--enable-debug
--enable-track
--with-petsc
--with-slepc
--with-sundials=/home/runner/local"
script_flags: "-uim"
omp_num_threads: 1

- name: "CMake, shared, release"
os: ubuntu-latest
cmake_options: "-DCHECK=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"

- name: "Shared, release, Ubuntu 20.04"
os: ubuntu-20.04
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DBOUT_ENABLE_OPENMP=ON
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -74,7 +71,7 @@ jobs:
-DSUNDIALS_ROOT=/home/runner/local"
omp_num_threads: 2

- name: "CMake, shared, OpenMP, 3D metrics"
- name: "Shared, OpenMP, 3D metrics"
os: ubuntu-latest
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DBOUT_ENABLE_METRIC_3D=ON
Expand Down Expand Up @@ -103,16 +100,17 @@ jobs:

- name: "Coverage"
os: ubuntu-20.04
configure_options: "--enable-shared
--enable-code-coverage
--enable-debug
--enable-track
--with-lapack
--with-petsc
--with-slepc
--with-sundials=/home/runner/local"
omp_num_threads: 1
script_flags: "-u"
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCHECK=3
-DENABLE_COVERAGE=ON
-DBOUT_USE_PETSC=ON
-DBOUT_USE_SLEPC=ON
-DBOUT_USE_HDF5=ON
-DBOUT_USE_SUNDIALS=ON
-DBOUT_ENABLE_PYTHON=ON
-DSUNDIALS_ROOT=/home/runner/local"
unit_only: YES
exclude:
# Don't run the coverage tests if the branch isn't master or next
- is_master_or_next: false
Expand All @@ -123,7 +121,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
Expand Down Expand Up @@ -152,7 +149,7 @@ jobs:

- name: Install pip packages
run: |
./.pip_install_for_ci.sh 'cython~=0.29' 'netcdf4~=1.5' 'sympy~=1.5' 'gcovr' 'cmake' 'h5py' 'zoidberg' 'natsort'
./.pip_install_for_ci.sh 'cython~=0.29' 'netcdf4~=1.5' 'sympy~=1.5' 'gcovr' 'cmake' zoidberg fastcov
# Add the pip install location to the runner's PATH
echo ~/.local/bin >> $GITHUB_PATH
Expand All @@ -168,16 +165,8 @@ jobs:
- name: Build PETSc
run: BUILD_PETSC=${{ matrix.config.build_petsc }} ./.build_petsc_for_ci.sh

- name: Build (configure)
if: ${{ ! contains(matrix.config.name, 'CMake') }}
run: ./.ci_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: Build BOUT++
run: UNIT_ONLY=${{ matrix.config.unit_only }} ./.ci_with_cmake.sh ${{ matrix.config.cmake_options }}

- name: Capture coverage
if: ${{ matrix.config.name == 'Coverage' }}
Expand All @@ -189,7 +178,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' }}
Expand Down
Loading

0 comments on commit 2e3cc2c

Please sign in to comment.