Skip to content

CI: run tests at CI #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,50 @@ env:
MACOSX_DEPLOYMENT_TARGET: 14.0

jobs:
Run_standalone_tests_with_GFortran:
name: "Run standalone tests with GFortran"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-20.04"]
steps:
- uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2.0.2
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_gfortran.yml

- name: Run standalone tests with GFortran with and without optimization
shell: bash -e -x -l {0}
run: |
cd tests
FC="gfortran" ./run_tests.sh
FC="gfortran -O3 -march=native" ./run_tests.sh

Run_standalone_tests_with_LFortran:
name: "Run standalone tests with LFortran"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-20.04"]
steps:
- uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2.0.2
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_lfortran.yml

- name: Run standalone tests with LFortran with and without optimization
shell: bash -e -x -l {0}
run: |
cd tests
FC="lfortran" ./run_tests.sh
FC="lfortran --fast" ./run_tests.sh

Compile_POT3D_with_GFortran:
name: "Build POT3D and validate with GFortran"
runs-on: ${{ matrix.os }}
Expand Down
32 changes: 32 additions & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set -ex

MPIEXEC=${CONDA_PREFIX}/bin/mpiexec

if [[ "$(uname)" == "Linux" ]]; then
CC=gcc
else
CC=clang
fi

$CC -I$CONDA_PREFIX/include -c ../src/mpi_wrapper.c
$FC -c ../src/mpi_c_bindings.f90
$FC -c ../src/mpi.f90

for file in *.f90; do
filename=$(basename "$file" .f90)
# TODO: currently "allreduce.f90" fails to compile, hence
# we skip that test for now
if [ "$filename" == "allreduce" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script is Good !!

continue
fi
$FC -c $file
$FC mpi_wrapper.o mpi_c_bindings.o mpi.o $filename.o -o $filename -L$CONDA_PREFIX/lib -lmpi -Wl,-rpath,$CONDA_PREFIX/lib

echo "Running $filename with 1 MPI rank..."
${MPIEXEC} -np 1 $filename
echo "Done!"

echo "Running $filename with 2 MPI rank..."
${MPIEXEC} -np 2 $filename
echo "Done!"
done