diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 51f22e68..a0586190 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: @@ -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 }} diff --git a/cmake/mkl-fftw.cmake b/cmake/mkl-fftw.cmake index c3e26ada..20777287 100644 --- a/cmake/mkl-fftw.cmake +++ b/cmake/mkl-fftw.cmake @@ -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}")