Skip to content

Commit

Permalink
refactor: Download and compile FFTW prior
Browse files Browse the repository at this point in the history
  • Loading branch information
sindre-nistad committed Jan 16, 2024
1 parent f57dfcc commit cde0e19
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,44 @@ jobs:
path: sources/boost/*
if-no-files-found: error

prepare-fftw:
# Currently, this is the only machine with Apple Silicon
runs-on: macos-13-xlarge
name: Download and prepare FFTW (for Apple Silicon)
strategy:
matrix:
fftw:
- "3.3.10"

steps:
- uses: actions/checkout@v4
name: Checkout repository

- name: Restore cached FFTW
id: cache-fftw
uses: actions/cache@v3
with:
path: |
sources/fftw/${{ matrix.fftw }}
vendor/
key: fftw-${{ matrix.fftw }}-${{ hashFiles('bin/*-fftw.sh') }}

- name: Download & Build FFTW
if: steps.cache-fftw.outputs.cache-hit != 'true'
run: ./bin/compile-fftw.sh ${{ matrix.fftw }}

- name: Store FFTW source, and build artifacts
uses: actions/upload-artifact@v4
with:
name: fftw-${{ matrix.fftw }}
path: |
sources/fftw/*
vendor/*
build:
needs:
- prepare-boost
- prepare-fftw
runs-on: ${{ matrix.os }}
name: Build & Test
strategy:
Expand Down Expand Up @@ -82,6 +117,14 @@ jobs:
path: sources/boost/
merge-multiple: true

- name: Download FFTW source
if: ${{ runner.os == 'macOS' && (runner.arch == 'ARM64' || runner.arch == 'ARM') }}
uses: actions/download-artifact@v4
with:
pattern: fftw-*
path: .
merge-multiple: true

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
Expand Down
4 changes: 4 additions & 0 deletions cmake/mkl-fftw.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ if (USE_FFT3)
file(COPY ${CMAKE_SOURCE_DIR}/bin/compile-fftw.sh DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${CMAKE_SOURCE_DIR}/bin/fetch-fftw.sh DESTINATION ${CMAKE_BINARY_DIR}/bin)
endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/vendor AND EXISTS ${CMAKE_SOURCE_DIR}/vendor)
message(STATUS "Reusing pre-compiled FFTW")
file(COPY ${CMAKE_SOURCE_DIR}/vendor DESTINATION ${CMAKE_BINARY_DIR})
endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/vendor/include/fftw3.h OR NOT EXISTS ${CMAKE_BINARY_DIR}/vendor/lib/libfftw3.a)
message(STATUS "Compiling FFTW")
set(ENV{CMAKE} "${CMAKE_COMMAND}")
Expand Down

0 comments on commit cde0e19

Please sign in to comment.