Update Github actions #1303
Workflow file for this run
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: Spack | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test-spack: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: # Include GPU build tests | |
- compiler: gcc | |
mpi: mpich | |
gpu: none | |
# - compiler: gcc | |
# mpi: mpich | |
# gpu: cuda | |
# - compiler: gcc | |
# mpi: mpich | |
# gpu: rocm | |
runs-on: palace_ubuntu-latest_16-core | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Open MPI | |
if: matrix.mpi == 'openmpi' | |
run: | | |
sudo apt-get install -y openmpi-bin libopenmpi-dev | |
- name: Configure MPICH | |
if: matrix.mpi == 'mpich' | |
run: | | |
sudo apt-get install -y mpich libmpich-dev | |
- name: Configure Intel MPI | |
if: matrix.mpi == 'intelmpi' | |
uses: mpi4py/setup-mpi@v1 | |
with: | |
mpi: ${{ matrix.mpi }} | |
- name: Configure Clang compiler | |
if: matrix.compiler == 'clang' | |
run: | | |
sudo apt-get install -y clang lld | |
- name: Configure Intel oneAPI compiler | |
if: matrix.compiler == 'intel' | |
run: | | |
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp=2024.2.1-1079 \ | |
intel-oneapi-compiler-fortran=2024.2.1-1079 | |
- uses: vsoch/spack-package-action/install@main | |
- name: Build Palace | |
run: | | |
# Clean up Android SDK install (confuses Spack MKL link line?) | |
sudo rm -rf $ANDROID_HOME | |
# Set up Spack to use external packages (MPI, etc.) and local Palace package | |
# recipe | |
. /opt/spack/share/spack/setup-env.sh | |
spack external find --all | |
spack repo add spack/local | |
# Configure GPU variant | |
if [[ "${{ matrix.gpu }}" == 'cuda' ]]; then | |
GPU_VARIANT="+cuda cuda_arch=70" | |
elif [[ "${{ matrix.gpu }}" == 'rocm' ]]; then | |
GPU_VARIANT="+rocm amdgpu_target=gfx900" | |
else | |
GPU_VARIANT="" | |
fi | |
# Build and install | |
PALACE_SPEC="local.palace@develop%${{ matrix.compiler }}$GPU_VARIANT ^${{ matrix.mpi }}" | |
PALACE_SPEC="$PALACE_SPEC ^petsc~hdf5 ^intel-oneapi-mkl" | |
spack spec $PALACE_SPEC | |
spack dev-build $PALACE_SPEC | |
- name: Run tests | |
if: matrix.gpu == 'none' # Skip tests for GPU builds | |
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 | |
. /opt/spack/share/spack/setup-env.sh | |
spack load palace | |
# Run tests | |
julia --project=test/examples -e 'using Pkg; Pkg.instantiate()' | |
julia --project=test/examples --color=yes test/examples/runtests.jl |