Skip to content

Commit

Permalink
updates github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Nov 14, 2024
1 parent dd9e694 commit 4043a56
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 37 deletions.
15 changes: 13 additions & 2 deletions .github/scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,24 @@ else
adios=()
fi

## HIP
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++")
else
hip=()
fi

# configuration
echo
echo "configuration:"
echo

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

# checks
Expand All @@ -63,7 +74,7 @@ sed -i "s:IMAIN .*:IMAIN = ISTANDARD_OUTPUT:" setup/constants.h
# compilation
echo
echo "compilation:"
make clean; make -j2 all
make clean; make -j4 all

# checks
if [[ $? -ne 0 ]]; then exit 1; fi
Expand Down
73 changes: 47 additions & 26 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,45 @@ my_test(){
if [[ $? -ne 0 ]]; then exit 1; fi
}

my_kernel_test(){
# kernel values
# get expect input arguments
RHO="$1"
KAPPA="$2"
MU="$3"
# Check if arguments are not empty
if [[ -z "$RHO" || -z "$KAPPA" || -z "$MU" ]]; then
echo "Error: All three arguments are required, got RHO=$RHO KAPPA=$KAPPA MU=$MU"
exit 1
fi
# final test result
PASSED=0
# checks rho kernel value
VAL=`fgrep 'maximum value of rho kernel' OUTPUT_FILES/output_solver.txt | cut -d = -f 2 | tr -d ' '`
echo "kernel rho : $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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$RHO val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# checks kappa kernel value
VAL=`fgrep 'maximum value of kappa kernel' OUTPUT_FILES/output_solver.txt | cut -d = -f 2 | tr -d ' '`
echo "kernel kappa : $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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$KAPPA val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# checks mu kernel value
VAL=`fgrep 'maximum value of mu kernel' OUTPUT_FILES/output_solver.txt | 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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$MU val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# overall pass
if [[ $PASSED -ne 0 ]]; then
echo "testing kernel values: failed"; exit 1;
else
echo "testing kernel values: all good"
fi
}

# test example
cd $dir

Expand Down Expand Up @@ -153,44 +192,26 @@ if [ "${DEBUG}" == "true" ] || [ "${RUN_KERNEL}" == "true" ]; then
else
my_test
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

# kernel test
if [ "${RUN_KERNEL}" == "true" ]; then
# homogeneous halfspace
if [ "$TESTDIR" == "EXAMPLES/applications/homogeneous_halfspace/" ]; then
PASSED=0
# checks rho kernel value
# checks rho/kappa/mu kernel value outputs
RHO=3.18576676E-09
VAL=`fgrep 'maximum value of rho kernel' OUTPUT_FILES/output_solver.txt | cut -d = -f 2 | tr -d ' '`
echo "kernel rho : $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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$RHO val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# checks kappa kernel value
KAPPA=9.48281809E-09
VAL=`fgrep 'maximum value of kappa kernel' OUTPUT_FILES/output_solver.txt | cut -d = -f 2 | tr -d ' '`
echo "kernel kappa : $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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$KAPPA val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# checks mu kernel value
MU=3.89545782E-08
VAL=`fgrep 'maximum value of mu kernel' OUTPUT_FILES/output_solver.txt | 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.0001){print "failed"; exit 1;}else{print "good"; exit 0;} }' ex=$MU val=$VAL
if [[ $? -ne 0 ]]; then PASSED=1; fi

# overall pass
if [[ $PASSED -ne 0 ]]; then
echo "kernel tests: failed"; exit 1;
else
echo "kernel tests: good"
fi
my_kernel_test $RHO $KAPPA $MU
fi
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

# cleanup
rm -rf OUTPUT_FILES/ DATABASES_MPI/
rm -rf OUTPUT_FILES/
if [ -e DATABASES_MPI ]; then rm -rf DATABASES_MPI/; fi

echo
echo "all good"
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:
run: ./configure

- name: make
run: make -j2 all
run: make -j4 all


linuxCheck-Intel:
Expand Down Expand Up @@ -261,8 +261,8 @@ jobs:
- name: make serial debug
run: |
make -j2 all
make -j2 all --always-make
make -j4 all
make -j4 all --always-make
make clean
- name: configure serial
Expand All @@ -271,7 +271,7 @@ jobs:
- name: make serial
run: |
make -j2 all
make -j4 all
make clean
- name: configure parallel debug
Expand All @@ -280,8 +280,8 @@ jobs:
- name: make parallel debug
run: |
make -j2 all
make -j2 all --always-make
make -j4 all
make -j4 all --always-make
make clean
- name: configure parallel
Expand All @@ -290,7 +290,7 @@ jobs:
- name: make parallel
run: |
make -j2 all
make -j4 all
make clean
# note: fails with -ftrapuv flag due to MPI issue on virtual nodes
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:

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

Expand Down Expand Up @@ -794,6 +794,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 All @@ -803,7 +805,7 @@ jobs:

- name: Run build
env:
TESTFLAGS: --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: true
run: ./.github/scripts/run_build.sh
shell: bash

Expand Down

0 comments on commit 4043a56

Please sign in to comment.