Skip to content

updates error checking for reading in parameters #141

updates error checking for reading in parameters

updates error checking for reading in parameters #141

Workflow file for this run

# Github Actions workflow
#
# runs compilation tests on Linux Ubuntu and Mac platforms
name: CI
on: [push, pull_request]
jobs:
changesCheck:
name: Check file changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for changes
id: diff
run: |
if [ $GITHUB_BASE_REF ]; then
# Pull Request
echo "Pull request:"
git fetch origin $GITHUB_BASE_REF --depth=1
export DIFF=$( git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA )
echo " diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA"
else
# Push
echo "Push request:"
git fetch origin ${{ github.event.before }} --depth=1
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA )
echo " diff between ${{ github.event.before }} and $GITHUB_SHA"
fi
echo "***"; echo "$DIFF"; echo "***"
# Escape newlines (replace \n with %0A)
# deprecated:
#echo "::set-output name=diff::$( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' )"
# new:
# replace new line with %0A - will result finding only one file with a very long name...
#echo "diff=$( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' )" >> $GITHUB_OUTPUT
# doesn't work...
#echo "diff=\"$DIFF\"" >> "$GITHUB_OUTPUT"
# new multi-line format:
# (https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings)
echo "diff<<EOF" >> $GITHUB_OUTPUT
echo "$DIFF" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Output changes
run: echo "${{ steps.diff.outputs.diff }}"
- name: Check files
run: |
RUN_CHECKS=0
DIFF="${{ steps.diff.outputs.diff }}"
# Loop by lines
while read path; do
# Set $directory to substring before /
directory="$( echo $path | cut -d'/' -f1 -s )"
echo "file: $path - directory: $directory"
if [ -z "$directory" ]; then
# root directory
RUN_CHECKS=1
elif [ "$directory" == src ]; then
# src/ directory
RUN_CHECKS=1
elif [ "$directory" == setup ]; then
# setup/ directory
RUN_CHECKS=1
elif [ "$directory" == EXAMPLES ]; then
# EXAMPLES/ directory
RUN_CHECKS=1
elif [ "$directory" == tests ]; then
# tests/ directory
RUN_CHECKS=1
elif [ "$directory" == .github ]; then
# .github/ directory
RUN_CHECKS=1
fi
done <<< "$DIFF"
echo
echo "run checks: ${RUN_CHECKS}"
if [[ ${RUN_CHECKS} -eq 0 ]]; then echo "nothing to check, exiting..."; exit 1; fi
macosCheck:
name: Test on Mac
runs-on: macos-latest
needs: changesCheck
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew cleanup
brew reinstall gcc # need gfortran (symlink to gfortran-10)
brew install hwloc openmpi
echo ""
echo "compiler versions:"
echo "gcc --version"
gcc --version
echo "gfortran --version"
gfortran --version
echo "mpif90 --version"
mpif90 --version
echo ""
## avoids sed -i '' issue on MacOS, using gnu sed to have the same sed command lines as in linux
brew install gnu-sed
echo "PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV
## OpenMP
echo "OMP_NUM_THREADS=2" >> $GITHUB_ENV
## MPI
echo
echo "MPI environment:"
echo "mpif90 on path: $(which mpif90)"
echo
# add OpenMPI path to have ./configure detect mpi.h
echo "MPI_INC=/opt/homebrew/include" >> $GITHUB_ENV
## avoids MPI issue with number of slots
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
echo "OMPI_MCA_rmaps_base_inherit=1" >> $GITHUB_ENV
## avoids MPI issue when running in MacOS
echo "OMPI_MCA_btl=self,tcp" >> $GITHUB_ENV
# exports for xterm output (for make tests)
echo "TERM=xterm" >> $GITHUB_ENV
echo ""
echo "exports:"
export
echo ""
- name: configure
run: ./configure
# skipping - compilation check done as well in make tests
#- name: make
# run: make -j2 all
- name: make tests
run: make tests
linuxCheck:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: changesCheck
strategy:
matrix:
os: [ubuntu-latest,ubuntu-20.04]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: configure
run: ./configure
- name: make
run: make -j2 all
linuxCheck-Intel:
name: Test Intel on ubuntu-20.04
runs-on: ubuntu-20.04
needs: changesCheck
steps:
- uses: actions/checkout@v4
- name: Cache Intel oneapi packages
id: cache-intel-oneapi
uses: actions/cache@v3
with:
path: /opt/intel/oneapi
key: install-${{ runner.os }}-all
- name: Install packages
if: steps.cache-intel-oneapi.outputs.cache-hit != 'true'
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo ""
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
echo ""
# info
#sudo -E apt-cache pkgnames intel | grep intel-oneapi
#echo ""
echo "installing packages intel oneapi:"
sudo apt-get install -y intel-oneapi-compiler-fortran-2023.2.2 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.2 intel-oneapi-mpi intel-oneapi-mpi-devel
echo ""
- name: compiler infos
run: |
echo ""
source /opt/intel/oneapi/setvars.sh
echo ""
echo "compiler versions:"
echo "icx --version"
which icx
icx --version
echo ""
echo "icc --version"
which icc
icc --version
echo ""
echo "ifx --version"
which ifx
ifx --version
echo ""
echo "ifort --version"
which ifort
ifort --version
echo ""
echo "mpiifort --version"
which mpiifort
mpiifort --version
echo ""
echo "mpif90 --version"
which mpif90
mpif90 --version
echo ""
# infos
which ifort
which icc
which mpiifort
echo "mpirun:"
which mpirun
echo ""
# intel setup for running tests
echo ""
echo "replacing mpif90 with mpiifort link:"
sudo ln -sf $(which mpiifort) $(which mpif90)
mpif90 --version
echo ""
# debug
#export I_MPI_DEBUG=5,pid,host
#export I_MPI_LIBRARY_KIND=debug
# remove -ftrapuv which leads to issues for running tests
sed -i "s/-ftrapuv//g" flags.guess
# environment setting
export TERM=xterm
# export info
echo "exports:"
export
echo ""
echo ""
printenv >> $GITHUB_ENV
echo "CXX=icpc" >> $GITHUB_ENV
echo "CC=icc" >> $GITHUB_ENV
echo "FC=ifort" >> $GITHUB_ENV
echo ""
- name: configure debug
run: |
./configure --enable-debug FC=ifort CC=icc
- name: make debug
run: |
make -j2 all
make -j2 all --always-make
make clean
- name: configure
run: |
./configure FC=ifort CC=icc
- name: make
run: |
make -j2 all
make clean
- name: configure parallel debug
run: |
./configure --enable-debug --with-mpi FC=ifort CC=icc MPIFC=mpiifort MPI_INC="${I_MPI_ROOT}/include"
- name: make parallel debug
run: |
make -j2 all
make -j2 all --always-make
make clean
- name: configure parallel
run: |
./configure --with-mpi FC=ifort CC=icc MPIFC=mpiifort MPI_INC="${I_MPI_ROOT}/include"
- name: make parallel
run: |
make -j2 all
make clean
# note: fails with -ftrapuv flag due to MPI issue on virtual nodes
- name: make tests
run: |
make tests
linuxTest_0:
name: Test run example 0 - make tests
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: configure
run: ./configure
- name: make tests
run: make tests
linuxTest_1:
name: Test run example 1 - benchmark claerbout kernel acoustic
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_2:
name: Test run example 2 - benchmark claerbout kernel elastic P-SV
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC
TESTCASE: P-SV
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_3:
name: Test run example 3 - benchmark claerbout kernel elastic SH
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC
TESTCASE: SH
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_4:
name: Test run example 4 - benchmark claerbout kernel acoustic-elastic
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC_ELASTIC
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_5:
name: Test run example 5 - moving sources
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/moving_sources_acoustic
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_6:
name: Test run example 6 - anisotropy
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/anisotropic_isotropic_model
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_7:
name: Test run example 7 - Industrial_Format_SEP
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/Industrial_Format_SEP
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_8:
name: Test run example 8 - axisymmetric_case_AXISYM_option
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/axisymmetric_case_AXISYM_option
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_9:
name: Test run example 9 - simple_topography_and_also_a_simple_fluid_layer debug
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --enable-debug
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/simple_topography_and_also_a_simple_fluid_layer
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_10:
name: Test run example 10 - simple_topography_and_also_a_simple_fluid_layer debug double_precision
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --enable-double-precision --enable-debug
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/simple_topography_and_also_a_simple_fluid_layer
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_11:
name: Test run example 11 - tomographic_ocean_model
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: # default w/out MPI
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/tomographic_ocean_model
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_12:
name: Test run example 12 - Marmousi2
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/Marmousi2
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_13:
name: Test run example 13 - Gmsh w/ Stacey
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/Gmsh_example_Stacey_MPI
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_14:
name: Test run example 14 - EM
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --enable-debug
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/electromagnetic_GPR_TM
DEBUG: true
run: ./.github/scripts/run_tests.sh
shell: bash