Merge pull request #301 from awslabs/hughcars/ncwaveport-patch-rebuild #1386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test (macOS) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test-macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: # Pairwise testing (from allpairspy) | |
- compiler: clang | |
mpi: openmpi | |
math-libs: openblas | |
build-shared: shared | |
with-64bit-int: int32 | |
with-openmp: serial | |
with-solver: superlu | |
with-eigensolver: slepc | |
- compiler: gcc | |
mpi: openmpi | |
math-libs: openblas | |
build-shared: static | |
with-64bit-int: int64 | |
with-openmp: openmp | |
with-solver: superlu | |
with-eigensolver: arpack | |
- compiler: gcc | |
mpi: mpich | |
math-libs: openblas | |
build-shared: static | |
with-64bit-int: int32 | |
with-openmp: openmp | |
with-solver: strumpack | |
with-eigensolver: slepc | |
runs-on: macos-latest-xlarge | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install dependencies | |
run: | | |
brew install pkg-config | |
- uses: julia-actions/setup-julia@v2 | |
with: | |
version: '1' | |
- name: Configure Open MPI | |
if: matrix.mpi == 'openmpi' | |
run: | | |
brew install openmpi | |
- name: Configure MPICH | |
if: matrix.mpi == 'mpich' | |
run: | | |
brew install mpich | |
- name: Install math libraries (OpenBLAS) | |
if: matrix.math-libs == 'openblas' | |
run: | | |
brew install openblas | |
- name: Build Palace | |
env: | |
CMAKE_BUILD_TYPE: Release | |
NUM_PROC_BUILD_MAX: '32' | |
run: | | |
# Configure environment | |
if [[ "${{ matrix.compiler }}" == 'clang' ]]; then | |
export CC=$(brew --prefix llvm@15)/bin/clang | |
export CXX=$(brew --prefix llvm@15)/bin/clang++ | |
export FC=gfortran-12 | |
elif [[ "${{ matrix.compiler }}" == 'gcc' ]]; then | |
export CC=gcc-12 | |
export CXX=g++-12 | |
export FC=gfortran-12 | |
fi | |
if [[ "${{ matrix.math-libs }}" == 'openblas' ]]; then | |
export OPENBLAS_DIR=$(brew --prefix openblas) | |
fi | |
export NUM_PROC_BUILD=$(nproc 2> /dev/null || sysctl -n hw.ncpu) | |
if [[ "$NUM_PROC_BUILD" -gt "$NUM_PROC_BUILD_MAX" ]]; then | |
NUM_PROC_BUILD=$NUM_PROC_BUILD_MAX | |
fi | |
[[ "${{ matrix.build-shared }}" == 'shared' ]] && BUILD_SHARED='ON' || BUILD_SHARED='OFF' | |
[[ "${{ matrix.with-64bit-int }}" == 'int64' ]] && WITH_INT64='ON' || WITH_INT64='OFF' | |
[[ "${{ matrix.with-openmp }}" == 'openmp' ]] && WITH_OPENMP='ON' || WITH_OPENMP='OFF' | |
[[ "${{ matrix.with-solver }}" == 'superlu' ]] && WITH_SUPERLU='ON' || WITH_SUPERLU='OFF' | |
[[ "${{ matrix.with-solver }}" == 'strumpack' ]] && WITH_STRUMPACK='ON' || WITH_STRUMPACK='OFF' | |
[[ "${{ matrix.with-solver }}" == 'mumps' ]] && WITH_MUMPS='ON' || WITH_MUMPS='OFF' | |
[[ "${{ matrix.with-eigensolver }}" == 'slepc' ]] && WITH_SLEPC='ON' || WITH_SLEPC='OFF' | |
[[ "${{ matrix.with-eigensolver }}" == 'arpack' ]] && WITH_ARPACK='ON' || WITH_ARPACK='OFF' | |
# Build and install (with unit tests) | |
mkdir palace-build && cd palace-build | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/../palace-install \ | |
-DBUILD_SHARED_LIBS=$BUILD_SHARED \ | |
-DPALACE_WITH_64BIT_INT=$WITH_INT64 \ | |
-DPALACE_WITH_OPENMP=$WITH_OPENMP \ | |
-DPALACE_WITH_SUPERLU=$WITH_SUPERLU \ | |
-DPALACE_WITH_STRUMPACK=$WITH_STRUMPACK \ | |
-DPALACE_WITH_MUMPS=$WITH_MUMPS \ | |
-DPALACE_WITH_SLEPC=$WITH_SLEPC \ | |
-DPALACE_WITH_ARPACK=$WITH_ARPACK | |
make -j$NUM_PROC_BUILD palace-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: | | |
# Configure environment | |
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 | |
fi | |
if [[ "${{ matrix.with-openmp }}" == 'true' ]]; then | |
NUM_PROC_TEST=$(( NUM_PROC_TEST / 2 )) | |
export OMP_NUM_THREADS=2 | |
else | |
export OMP_NUM_THREADS=1 | |
fi | |
export PATH=$(pwd)/palace-install/bin:$PATH | |
# Run tests | |
julia --project=test/examples -e 'using Pkg; Pkg.instantiate()' | |
julia --project=test/examples --color=yes test/examples/runtests.jl |