Skip to content

Commit

Permalink
adds github action petsc check
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Jun 4, 2024
1 parent 09b6d4d commit de0f52d
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 9 deletions.
15 changes: 14 additions & 1 deletion .github/scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ sudo apt-get install -yq --no-install-recommends gfortran g++ openmpi-bin libope
if [[ $? -ne 0 ]]; then exit 1; fi
echo

# PETSc
if [ "${PETSC}" == "true" ]; then
# requires gfortran version 10 as default
#mv -v /usr/local/bin/gfortran /usr/local/bin/gfortran-9
#sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-10 60
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 60
# installs petsc
sudo apt-get install -yq --no-install-recommends petsc-dev
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
fi

# 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
Expand Down Expand Up @@ -116,7 +128,8 @@ echo "OMPI_MCA_rmaps_base_inherit=1" >> $GITHUB_ENV
# exports for xterm output (for make tests)
echo "TERM=xterm" >> $GITHUB_ENV


# PETSc setting
if [ "${PETSC}" == "true" ]; then echo "PETSC=true" >> $GITHUB_ENV; fi

echo
echo "exports:"
Expand Down
14 changes: 13 additions & 1 deletion .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ if [ "${DEBUG}" == "true" ]; then
sed -i "s:^RECORD_LENGTH_IN_MINUTES .*:RECORD_LENGTH_IN_MINUTES = 0.0:" DATA/Par_file
fi

# full gravity
if [ "${FULL_GRAVITY}" == "true" ]; then
# set NSTEP for short check
echo "NSTEP = 5" >> DATA/Par_file
# turns on full gravity
sed -i "s:^FULL_GRAVITY .*:FULL_GRAVITY = .true.:" DATA/Par_file
# switch to PETSc Poisson solver
if [ "${PETSC}" == "true" ]; then
sed -i "s:^POISSON_SOLVER .*:POISSON_SOLVER = 1:" DATA/Par_file
fi
fi

# default script
./run_this_example.sh

Expand All @@ -63,7 +75,7 @@ echo `date`
echo

# seismogram comparison
if [ "${DEBUG}" == "true" ]; then
if [ "${DEBUG}" == "true" ] || [ "${FULL_GRAVITY}" == "true" ]; then
# no comparisons
: # do nothing
else
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,79 @@ jobs:
TESTDIR: EXAMPLES/mars_regional
run: ./.github/scripts/run_tests.sh
shell: bash

linuxTest_7:
name: Test run example 7 - global_small
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-vectorization
run: ./.github/scripts/run_build.sh
shell: bash

- name: Run test
env:
TESTDIR: EXAMPLES/global_small
run: ./.github/scripts/run_tests.sh
shell: bash

linuxTest_8:
name: Test run example 7 - global_small w/ FULL_GRAVITY
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/global_small
FULL_GRAVITY: true
run: ./.github/scripts/run_tests.sh
shell: bash

linuxTest_9:
name: Test run example 7 - global_small w/ FULL_GRAVITY PETSC
runs-on: ubuntu-latest
needs: [linuxCheck]

steps:
- uses: actions/checkout@v4

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

- name: Run build
env:
TESTFLAGS: --enable-vectorization --with-petsc PETSC_INC=/usr/include/petsc
run: ./.github/scripts/run_build.sh
shell: bash

- name: Run test
env:
TESTDIR: EXAMPLES/global_small
FULL_GRAVITY: true
run: ./.github/scripts/run_tests.sh
shell: bash
30 changes: 27 additions & 3 deletions EXAMPLES/global_small/run_mesher_solver.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/bin/bash

# DATABASES directory
BASEMPIDIR=`grep ^LOCAL_PATH DATA/Par_file | cut -d = -f 2 `
BASEMPIDIR=`grep ^LOCAL_PATH DATA/Par_file | cut -d = -f 2`

# script to run the mesher and the solver
# read DATA/Par_file to get information about the run
# compute total number of nodes needed
NPROC_XI=`grep ^NPROC_XI DATA/Par_file | cut -d = -f 2 `
NPROC_XI=`grep ^NPROC_XI DATA/Par_file | cut -d = -f 2`
NPROC_ETA=`grep ^NPROC_ETA DATA/Par_file | cut -d = -f 2`
NCHUNKS=`grep ^NCHUNKS DATA/Par_file | cut -d = -f 2 `
NCHUNKS=`grep ^NCHUNKS DATA/Par_file | cut -d = -f 2`

# total number of nodes is the product of the values read
numnodes=$(( $NCHUNKS * $NPROC_XI * $NPROC_ETA ))

# full gravity option
FULL_GRAVITY=`grep ^FULL_GRAVITY DATA/Par_file | cut -d = -f 2 | tr -d '[:space:]'`


mkdir -p OUTPUT_FILES
mkdir -p $BASEMPIDIR

Expand Down Expand Up @@ -43,6 +47,26 @@ echo
cp OUTPUT_FILES/*.txt $BASEMPIDIR/


## full gravity
if [ "$FULL_GRAVITY" == ".true." ]; then
##
## gindex3D
##
echo
echo "running xgindex3D..."
echo
if [ ! -e $PWD/bin/xgindex3D ]; then echo "xgindex3D was not compiled, aborting..."; exit 1; fi

mpirun -np 1 $PWD/bin/xgindex3D $numnodes

# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

echo
echo " gindex3D done: `date`"
echo
fi

##
## forward simulation
##
Expand Down
5 changes: 1 addition & 4 deletions EXAMPLES/global_small/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ fi
# copy executables
mkdir -p bin
rm -rf bin/*
cp ../../bin/xmeshfem3D ./bin/
cp ../../bin/xspecfem3D ./bin/
cp ../../bin/xcombine_vol_data ./bin/
cp ../../bin/xcombine_vol_data_vtk ./bin/
cp ../../bin/x* ./bin/

# links data directories needed to run example in this current directory with s362ani
cd DATA/
Expand Down

0 comments on commit de0f52d

Please sign in to comment.