Skip to content

Commit

Permalink
Merge pull request #1701 from danielpeter/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter authored Jun 5, 2024
2 parents ee3b095 + 2652225 commit 1f01888
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 221 deletions.
16 changes: 14 additions & 2 deletions .github/scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ echo "mpif90 --version"
mpif90 --version
echo

## ADIOS2
if [ "${ADIOS2}" == "true" ]; then
echo
echo "enabling ADIOS2"
echo
ADIOS2_CONFIG="${ADIOS2_DIR}/bin/adios2-config"
adios=(--with-adios2 ADIOS2_CONFIG="$ADIOS2_CONFIG" )
else
adios=()
fi

# configuration
echo
echo "configuration: default"
echo "configuration:"
echo

./configure FC=gfortran MPIFC=mpif90 CC=gcc ${TESTFLAGS}
./configure \
${adios[@]} \
FC=gfortran MPIFC=mpif90 CC=gcc ${TESTFLAGS}

# checks
if [[ $? -ne 0 ]]; then echo "configuration failed:"; cat config.log; echo ""; echo "exiting..."; exit 1; fi
Expand Down
39 changes: 39 additions & 0 deletions .github/scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ fi
if [[ $? -ne 0 ]]; then exit 1; fi
echo

# python3 pip upgrade might complain: "ERROR: launchpadlib 1.10.13 requires testresources"
sudo apt-get install -yq --no-install-recommends python3-testresources
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
echo

# python script needs numpy
#sudo apt-get install -qq python-numpy # not working, likely installed on older python version
pip install --user --upgrade pip setuptools wheel
Expand Down Expand Up @@ -68,6 +74,39 @@ echo "mpif90 --version"
mpif90 --version
echo

## ADIOS2
if [ "${ADIOS2}" == "true" ]; then
echo
echo "ADIOS2 installation:"
echo
# installs cmake wget
sudo apt-get install -yq --no-install-recommends cmake wget
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
# uses /opt as installation directory
mkdir -p /opt; cd /opt
# download source
wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.10.1.tar.gz
tar zxf v2.10.1.tar.gz
cd ADIOS2-2.10.1/
# build source
mkdir -p build; cd build/
CC=gcc CXX=g++ FC=gfortran cmake -DADIOS2_USE_Fortran=ON \
-DADIOS2_USE_HDF5=OFF -DADIOS2_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF \
-DCMAKE_INSTALL_PREFIX=/opt/ADIOS2 ../
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
make -j4
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
make install
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
# environment for directory
echo "ADIOS2_DIR=/opt/ADIOS2" >> $GITHUB_ENV
echo; echo "done ADIOS2"; echo
fi

# MPI
# github actions uses for Linux virtual machines a 2-core CPU environment
# see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
Expand Down
6 changes: 6 additions & 0 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ if [[ "${TEST}" == *"with-hdf5"* ]]; then
cp -v run_this_example_HDF5_IO_server.sh run_this_example.sh
fi

# adios
if [ "${ADIOS2}" == "true" ]; then
# turns on ADIOS
sed -i "s:^ADIOS_ENABLED .*:ADIOS_ENABLED = .true.:" DATA/Par_file
fi

# default script
./run_this_example.sh

Expand Down
77 changes: 53 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check for changes
id: diff
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
needs: changesCheck

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand All @@ -104,10 +104,11 @@ jobs:
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=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV
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
Expand Down Expand Up @@ -149,7 +150,7 @@ jobs:
os: [ubuntu-latest,ubuntu-20.04]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -168,7 +169,7 @@ jobs:
needs: changesCheck

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Intel oneapi packages
id: cache-intel-oneapi
Expand Down Expand Up @@ -303,7 +304,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -322,7 +323,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -346,7 +347,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -370,7 +371,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -395,7 +396,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -419,7 +420,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -444,7 +445,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -469,7 +470,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -495,7 +496,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -520,7 +521,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -544,7 +545,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -568,7 +569,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -592,7 +593,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -616,7 +617,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -640,7 +641,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -664,7 +665,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -688,7 +689,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -712,7 +713,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
run: ./.github/scripts/run_install.sh
Expand All @@ -736,7 +737,7 @@ jobs:
needs: [linuxCheck]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install packages
env:
Expand All @@ -758,3 +759,31 @@ jobs:
run: ./.github/scripts/run_tests.sh
shell: bash

linuxTest_19:
name: Test run example 19 - meshfem3D simple model w/ ADIOS2
runs-on: ubuntu-latest
needs: [linuxCheck]

steps:
- uses: actions/checkout@v4

- name: Install packages
env:
ADIOS2: true
run: ./.github/scripts/run_install.sh
shell: bash

- name: Run build
env:
TESTFLAGS: --with-mpi --enable-vectorization
ADIOS2: true
run: ./.github/scripts/run_build.sh
shell: bash

- name: Run test
env:
TESTDIR: EXAMPLES/applications/meshfem3D_examples/simple_model/
ADIOS2: true
run: ./.github/scripts/run_tests.sh
shell: bash

2 changes: 1 addition & 1 deletion src/generate_databases/save_arrays_solver_adios.F90
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ subroutine save_arrays_solver_mesh_adios()


! calling wrapper instead to compile without mpi
call max_allreduce_i(max_global_values,num_vars)
call max_all_all_veci(max_global_values,num_vars)

nglob_wmax = max_global_values(1)
nspec_wmax = max_global_values(2)
Expand Down
4 changes: 2 additions & 2 deletions src/generate_databases/save_moho_adios.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ subroutine crm_save_moho_adios()
! ADIOS write equally sized chunks for each processor. |
!-----------------------------------------------------------------'
! determines maximum values for nspec over all partition slices
call max_allreduce_singlei(NSPEC_AB,NSPEC_wmax)
call max_allreduce_singlei(nspec2d_moho,nspec2d_moho_wmax)
call max_all_all_i(NSPEC_AB,NSPEC_wmax)
call max_all_all_i(nspec2d_moho,nspec2d_moho_wmax)

!-----------------------------------.
! Setup ADIOS for the current group |
Expand Down
6 changes: 4 additions & 2 deletions src/inverse_problem_for_model/input_output/Teleseismic_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module Teleseismic_IO_mod
calc_delta_dist_baz, calc_dist_baz_cart, lowcase, &
write_binary_data
use signal_processing, only: taper_window_W

implicit none
integer, private :: NEVENT

contains
Expand All @@ -50,8 +52,8 @@ module Teleseismic_IO_mod
subroutine read_acqui_teleseismic_file(acqui_file, acqui_simu, myrank)

use my_mpi !! module from specfem
include "precision.h" !! from specfem

implicit none
character(len=MAX_LEN_STRING), intent(in) :: acqui_file
integer, intent(in) :: myrank
type(acqui), dimension(:), allocatable, intent(inout) :: acqui_simu
Expand Down Expand Up @@ -437,7 +439,7 @@ subroutine setup_teleseismic_stations(acqui_simu, myrank)
!! hgamma, hpgamma
!!
!! ------------------------------------------------------------------------------

implicit none
type(acqui), dimension(:), intent(inout) :: acqui_simu
integer, intent(in) :: myrank
! local
Expand Down
Loading

0 comments on commit 1f01888

Please sign in to comment.