Skip to content

Commit

Permalink
updates test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Nov 19, 2024
1 parent b343572 commit 3df007f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if [ "${HIP}" == "true" ]; then
echo
echo "enabling HIP"
echo
hip=(--with-hip HIPCC=g++ HIP_FLAGS="-O2 -g -std=c++17" HIP_PLATFORM=cpu HIP_INC=./external_libs/ROCm-HIP-CPU/include HIP_LIBS="-ltbb -lpthread -lstdc++")
hip=(--with-hip HIPCC=g++ HIP_FLAGS="-O2 -g -std=c++17" HIP_PLATFORM=cpu HIP_INC=./external_libs/ROCm-HIP-CPU/include HIP_LIBS="-ltbb -lpthread -lstdc++ -lmpi_cxx")
else
hip=()
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if [ "${EMC_MODEL}" == "true" ]; then
echo
echo "current dir: `pwd`"
cd DATA/IRIS_EMC/
wget --tries=3 https://ds.iris.edu/files/products/emc/emc-files/Alaska.JointInversion-RF+Vph+HV-1.Berg.2020-nc4.nc
wget --quiet --tries=3 https://ds.iris.edu/files/products/emc/emc-files/Alaska.JointInversion-RF+Vph+HV-1.Berg.2020-nc4.nc
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
ln -s Alaska.JointInversion-RF+Vph+HV-1.Berg.2020-nc4.nc model.nc
Expand Down
32 changes: 16 additions & 16 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ my_kernel_test(){
RHO=`grep -E 'maximum value of rho[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
KAPPA=`grep -E 'maximum value of kappa[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
MU=`grep -E 'maximum value of mu[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
KAPPAV=`grep -E 'maximum value of kappav[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
MUV=`grep -E 'maximum value of muv[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
ALPHAV=`grep -E 'maximum value of alphav[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`
BETAV=`grep -E 'maximum value of betav[[:space:]]+kernel' $file_ref | cut -d = -f 2 | tr -d ' '`

# need at least rho & kappa (for acoustic kernels)
if [ "$RHO" == "" ]; then
echo " missing reference kernel values: RHO=$RHO | KAPPA=$KAPPA KAPPAV=$KAPPAV | MU=$MU MUV=$MUV"
echo " missing reference kernel values: RHO=$RHO | KAPPA=$KAPPA MU=$MU | ALPHAV=$ALPHAV BETAV=$BETAV"
echo
exit 1
else
echo " reference kernel values: RHO=$RHO | KAPPA=$KAPPA KAPPAV=$KAPPAV | MU=$MU MUV=$MUV"
echo " reference kernel values: RHO=$RHO | KAPPA=$KAPPA MU=$MU | ALPHAV=$ALPHAV BETAV=$BETAV"
fi
# compares with test output - using a relative tolerance of 0.001 (1 promille) with respect to expected value
# final test result
Expand All @@ -72,25 +72,25 @@ my_kernel_test(){
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$KAPPA val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi
fi
# checks kappav kernel value (if anisotropic kernels)
if [ "$KAPPAV" != "" ]; then
VAL=`grep -E 'maximum value of kappav[[:space:]]+kernel' $file_out | cut -d = -f 2 | tr -d ' '`
echo "kernel kappav: $VAL"
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$KAPPAV val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi
fi
# checks mu kernel value
if [ "$MU" != "" ]; then
VAL=`grep -E 'maximum value of mu[[:space:]]+kernel' $file_out | cut -d = -f 2 | tr -d ' '`
echo "kernel mu : $VAL"
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$MU val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi
fi
# checks muv kernel value (if anisotropic kernels)
if [ "$MUV" != "" ]; then
VAL=`grep -E 'maximum value of muv[[:space:]]+kernel' $file_out | cut -d = -f 2 | tr -d ' '`
echo "kernel muv : $VAL"
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$MUV val=$VAL
# checks alphav kernel value (if anisotropic kernels)
if [ "$ALPHAV" != "" ]; then
VAL=`grep -E 'maximum value of alphav[[:space:]]+kernel' $file_out | cut -d = -f 2 | tr -d ' '`
echo "kernel alphav: $VAL"
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$ALPHAV val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi
fi
# checks betav kernel value (if anisotropic kernels)
if [ "$BETAV" != "" ]; then
VAL=`grep -E 'maximum value of betav[[:space:]]+kernel' $file_out | cut -d = -f 2 | tr -d ' '`
echo "kernel betav : $VAL"
echo "" | awk '{diff=ex-val;diff_abs=(diff >= 0)? diff:-diff;diff_rel=diff_abs/ex;print " value: expected = "ex" gotten = "val" - difference absolute = "diff_abs" relative = "diff_rel; if (diff_rel>0.001){print " failed"; exit 1;}else{print " good"; exit 0;} }' ex=$BETAV val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi
fi
# overall pass
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true # needs submodule content in folder external_libs/ROCm-HIP-CPU/

- name: Install packages
env:
Expand Down

0 comments on commit 3df007f

Please sign in to comment.