Skip to content
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

Add GitHub Actions workflow for unit tests #99

Merged
merged 1 commit into from
Sep 26, 2023
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
36 changes: 29 additions & 7 deletions .github/workflows/build-and-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
[[ "${{ matrix.with-eigensolver }}" == 'slepc' ]] && WITH_SLEPC='ON' || WITH_SLEPC='OFF'
[[ "${{ matrix.with-eigensolver }}" == 'arpack' ]] && WITH_ARPACK='ON' || WITH_ARPACK='OFF'

# Build and install
# Build and install (with unit tests)
mkdir palace-build && cd palace-build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$(pwd)/../palace-install \
Expand All @@ -186,9 +186,31 @@ jobs:
-DPALACE_WITH_MUMPS=$WITH_MUMPS \
-DPALACE_WITH_SLEPC=$WITH_SLEPC \
-DPALACE_WITH_ARPACK=$WITH_ARPACK
make -j$NUM_PROC_BUILD
make -j$NUM_PROC_BUILD palace-tests

- name: Run tests
- name: Run unit tests
env:
NUM_PROC_TEST_MAX: '2'
run: |
# Configure environment
if [[ "${{ matrix.compiler }}" == 'intel' ]] || \
[[ "${{ matrix.mpi }}" == 'intelmpi' ]] || \
[[ "${{ matrix.math-libs }}" == 'intelmkl' ]]; then
source /opt/intel/oneapi/setvars.sh # Sets PATH, MKLROOT
fi
if [[ "${{ matrix.with-openmp }}" == 'true' ]]; then
export OMP_NUM_THREADS=2
else
export OMP_NUM_THREADS=1
fi
export LD_LIBRARY_PATH=$(pwd)/palace-install/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$(pwd)/palace-install/lib64:$LD_LIBRARY_PATH
cd $(pwd)/palace-build/palace-build/test/unit

# Run tests
mpirun -np $NUM_PROC_TEST_MAX ./unit-tests --skip-benchmarks

- name: Run regression tests for examples/
env:
NUM_PROC_TEST_MAX: '8'
run: |
Expand All @@ -198,6 +220,10 @@ jobs:
[[ "${{ matrix.math-libs }}" == 'intelmkl' ]]; then
source /opt/intel/oneapi/setvars.sh # Sets PATH, MKLROOT
fi
if [[ "${{ matrix.math-libs }}" == 'aocl' ]]; then
export AOCLROOT=/opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc
export LD_LIBRARY_PATH=$AOCLROOT/lib:$LD_LIBRARY_PATH
fi
export NUM_PROC_TEST=$(nproc 2> /dev/null || sysctl -n hw.ncpu)
if [[ "$NUM_PROC_TEST" -gt "$NUM_PROC_TEST_MAX" ]]; then
NUM_PROC_TEST=$NUM_PROC_TEST_MAX
Expand All @@ -208,10 +234,6 @@ jobs:
else
export OMP_NUM_THREADS=1
fi
if [[ "${{ matrix.math-libs }}" == 'aocl' ]]; then
export AOCLROOT=/opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc
export LD_LIBRARY_PATH=$AOCLROOT/lib:$LD_LIBRARY_PATH
fi
export PATH=$(pwd)/palace-install/bin:$PATH

# Run tests
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
[[ "${{ matrix.with-eigensolver }}" == 'slepc' ]] && WITH_SLEPC='ON' || WITH_SLEPC='OFF'
[[ "${{ matrix.with-eigensolver }}" == 'arpack' ]] && WITH_ARPACK='ON' || WITH_ARPACK='OFF'

# Build and install
# Build and install (with unit tests)
mkdir palace-build && cd palace-build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$(pwd)/../palace-install \
Expand All @@ -107,9 +107,25 @@ jobs:
-DPALACE_WITH_MUMPS=$WITH_MUMPS \
-DPALACE_WITH_SLEPC=$WITH_SLEPC \
-DPALACE_WITH_ARPACK=$WITH_ARPACK
make -j$NUM_PROC_BUILD
make -j$NUM_PROC_BUILD palace-tests

- name: Run tests
- name: Run unit tests
env:
NUM_PROC_TEST_MAX: '2'
run: |
# Configure environment
if [[ "${{ matrix.with-openmp }}" == 'true' ]]; then
export OMP_NUM_THREADS=2
else
export OMP_NUM_THREADS=1
fi
export DYLD_LIBRARY_PATH=$(pwd)/palace-install/lib:$DYLD_LIBRARY_PATH
cd $(pwd)/palace-build/palace-build/test/unit

# Run tests
mpirun -np $NUM_PROC_TEST_MAX ./unit-tests --skip-benchmarks

- name: Run regression tests for examples/
env:
NUM_PROC_TEST_MAX: '8'
run: |
Expand Down