Skip to content

Commit

Permalink
Merge branch 'v5.1.0-rc' into dschwoerer-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer authored Sep 13, 2023
2 parents 70c808e + 2e4fdbf commit fce2e70
Show file tree
Hide file tree
Showing 75 changed files with 1,037 additions and 622 deletions.
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" \
--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
4 changes: 2 additions & 2 deletions .ci_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 cmake
time dnf -y install dnf5-plugins python3-pip cmake
# Allow to override packages - see #2073
time dnf copr enable -y davidsch/fixes4bout || :
time dnf -y upgrade
Expand All @@ -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
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++
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 }}
32 changes: 25 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:

- name: "Optimised, static"
os: ubuntu-20.04
cmake_options: "-DBOUT_ENABLE_CHECKS=OFF
cmake_options: "-DCHECK=0
-DBUILD_SHARED_LIBS=OFF
-DCXXFLAGS=-Ofast
-DCMAKE_CXX_FLAGS=-Ofast
-DBOUT_ENABLE_SIGNAL=OFF
-DBOUT_ENABLE_TRACK=OFF
-DBOUT_ENABLE_BACKTRACE=OFF
Expand All @@ -50,7 +50,7 @@ jobs:

- name: "Debug, shared"
os: ubuntu-20.04
cmake_options: "-DBOUT_ENABLE_CHECKS=3
cmake_options: "-DCHECK=3
-DCMAKE_BUILD_TYPE=Debug
-DBOUT_ENABLE_SIGNAL=ON
-DBOUT_ENABLE_TRACK=ON
Expand Down 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 @@ -134,20 +149,23 @@ jobs:

- name: Install pip packages
run: |
./.pip_install_for_ci.sh 'cython~=0.29' 'netcdf4~=1.5' 'sympy~=1.5' 'gcovr' 'cmake' 'h5py' zoidberg fastcov
./.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
- name: Cache SUNDIALS build
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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ coverage/
/dist/
/manual/sphinx/_build
/_version.txt
/BOUT++-v*.tar.gz
/BOUT++-v*.tar.xz
2 changes: 1 addition & 1 deletion .pip_install_for_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

export PATH=${HOME}/.local/bin:${PATH}
pip3 install --user --upgrade pip~=20.0 setuptools~=46.1
pip3 install --user --upgrade scipy~=1.4 numpy~=1.18
pip3 install --user --upgrade scipy~=1.4 numpy~=1.18 natsort~=8.1.0
for package in $@
do
if test $package == "cython"
Expand Down
Loading

0 comments on commit fce2e70

Please sign in to comment.