Skip to content
Open
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
5 changes: 0 additions & 5 deletions .github/workflows/C++.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: C++ Build

on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/build_cufinufft_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
name: Build cufinufft Python wheels

on: [push, pull_request]
on:
# Weekly schedule (Sunday 00:00 UTC)
schedule:
- cron: "0 0 * * 0"

# On tag push
push:
tags:
- 'v*'
# Manual trigger (with an optional deploy toggle)
workflow_dispatch:
inputs:
deploy:
description: "Deploy after build?"
type: boolean
required: false
default: false

jobs:
build_wheels:
Expand All @@ -17,9 +33,16 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup CUDA
if: ${{ matrix.buildplat[0] == 'windows-2022' }}
uses: Jimver/[email protected].21
uses: Jimver/[email protected].24
with:
cuda: '12.4.0'
method: 'network'
linux-local-args: '["--toolkit"]'
log-file-suffix: '${{matrix.os}}-cuda-install.txt'
sub-packages: ${{runner.os == 'Linux' && '["nvcc", "cudart"]' || '["nvcc", "cudart", "cufft", "cufft_dev"]'}}
non-cuda-sub-packages: ${{runner.os == 'Linux' && '["libcufft","libcufft-dev"]' || '[]'}}
use-local-cache: 'false'
use-github-cache: 'false' #it is not working at the moment https://github.com/Jimver/cuda-toolkit/issues/390
- name: Build ${{ matrix.buildplat[1] }} wheels
uses: pypa/[email protected]
with:
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/build_finufft_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
name: Build and test finufft Python wheels

on: [ push, pull_request ]
on:
# Weekly schedule (Sunday 00:00 UTC)
schedule:
- cron: "0 0 * * 0"

# On tag push
push:
tags:
- 'v*'
# Manual trigger (with an optional deploy toggle)
workflow_dispatch:
inputs:
deploy:
description: "Deploy after build?"
type: boolean
required: false
default: false


jobs:
build_wheels:
Expand Down
207 changes: 123 additions & 84 deletions .github/workflows/cmake_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ name: cmake ci linux macos windows
on: [push, pull_request]

jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate matrix
id: generate_matrix
run: |
MATRIX=$(python3 ${{ github.workspace }}/.github/workflows/generate_cmake_matrix.py)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
pip-requirements:
runs-on: ubuntu-22.04
steps:
Expand All @@ -23,7 +11,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
cache : 'pip'
cache: 'pip'
python-version: '3.10'
- name: Generate requirements.txt
run: |
Expand All @@ -38,142 +26,193 @@ jobs:
with:
name: requirements
path: requirements.txt

cache:
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2022
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: create cache directory
run: |
mkdir -p cpm
shell: bash
run: mkdir -p "cpm"
- name: Check if cache exists
id: cache
uses: actions/cache@v4
with:
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('CMakeLists.txt', 'cmake/*') }}
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
enableCrossOsArchive: true
path: cpm
- name: Setup Cpp
- name: Setup Cpp (on cache miss)
if: steps.cache.outputs.cache-hit != 'true'
uses: aminya/setup-cpp@v1
with:
cmake : true
- name: Download dependencies in cache linux
cmake: true
- name: Download dependencies in cache (Linux)
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
cmake -S . -B ./build
cmake -S . -B ./build -DCPM_SOURCE_CACHE="cpm"
rm -rf build
cmake -S . -B ./build -DFINUFFT_USE_DUCC0=ON
env:
CPM_SOURCE_CACHE: cpm
- name: Download dependencies in cache windows
cmake -S . -B ./build -DFINUFFT_USE_DUCC0=ON -DCPM_SOURCE_CACHE="cpm"
- name: Download dependencies in cache (Windows)
if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'Linux'
run: |
cmake -S . -B build
cmake -S . -B build -DCPM_SOURCE_CACHE="cpm"
rm build -r -force
cmake -S . -B build -DFINUFFT_USE_DUCC0=ON
env:
CPM_SOURCE_CACHE: cpm
cmake -S . -B build -DFINUFFT_USE_DUCC0=ON -DCPM_SOURCE_CACHE="cpm"
- name: Cache dependencies
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('CMakeLists.txt', 'cmake/*') }}
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
enableCrossOsArchive: true
path: cpm

cmake-ci:
runs-on: ${{ matrix.os }}
needs: [prepare, cache, pip-requirements]
needs: [cache, pip-requirements]
env:
CMAKE_GENERATOR: Ninja
CPM_SOURCE_CACHE: cpm
CTEST_OUTPUT_ON_FAILURE: "1"
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: "0"
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_CXX_COMPILER_LAUNCHER: sccache
CMAKE_CUDA_COMPILER_LAUNCHER: sccache
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
matrix:
include:
- { os: ubuntu-22.04, toolchain: gcc-10 }
- { os: ubuntu-22.04, toolchain: gcc-11 }
- { os: ubuntu-22.04, toolchain: gcc-12 }
- { os: ubuntu-22.04, toolchain: gcc-13 }
- { os: ubuntu-22.04, toolchain: clang-16 }
- { os: ubuntu-22.04, toolchain: clang-17 }
- { os: ubuntu-22.04, toolchain: clang-18 }

- { os: windows-2022, toolchain: msvc }
- { os: windows-2022, toolchain: clang-19 }

- { os: macos-13, toolchain: llvm }
- { os: macos-13, toolchain: gcc-14 }
- { os: macos-14, toolchain: llvm }
- { os: macos-14, toolchain: gcc-14 }
- { os: macos-15, toolchain: llvm }
# - { os: macos-15, toolchain: gcc-15 } # it is broken at the moment, but it is not caused by finufft

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

- name: Restore Cache
uses: actions/cache/restore@v4
with:
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('CMakeLists.txt', 'cmake/*') }}
key: cpm-cache-00-${{ runner.os == 'windows' && 'windows-' || '' }}${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
enableCrossOsArchive: true
path: cpm

- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Set caching env vars
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "SCCACHE_GHA_VERSION=0" >> $GITHUB_ENV
- name: Set up sccache on Windows
if: runner.os == 'Windows'
run: Add-Content -Path $env:GITHUB_ENV -Value "SCCACHE_GHA_ENABLED=true"

- name: Setup Cpp
uses: aminya/setup-cpp@v1.1.1
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.toolchain }}
vcvarsall: ${{ contains(matrix.os, 'windows') }}
vcvarsall: true
cmake: true
ninja: true
vcpkg: false
cppcheck: false
clangtidy: false
- name: Set min macOS version and install fftw
if: runner.os == 'macOS'

- name: Install toolchain + FFTW (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install fftw libomp
- name: Install fftw
if: runner.os == 'linux'
export HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_INSTALL_CLEANUP=1
brew install libomp fftw
{
echo "LDFLAGS=-L$(brew --prefix libomp)/lib"
echo "CPPFLAGS=-I$(brew --prefix libomp)/include"
echo "LIBRARY_PATH=$(brew --prefix libomp)/lib"
echo "DYLD_LIBRARY_PATH=$(brew --prefix libomp)/lib"
echo "CMAKE_PREFIX_PATH=$(brew --prefix libomp)"
ver="${{ matrix.os }}"; ver="${ver#macos-}"
echo "MACOSX_DEPLOYMENT_TARGET=${ver}.0"
} >> "$GITHUB_ENV"

- name: Install fftw (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y libfftw3-dev
- name: Configure Cmake
run: |
cmake -S . -B ./build -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DFINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }} -DFINUFFT_BUILD_TESTS=ON -DFINUFFT_STATIC_LINKING=${{matrix.finufft_static_linking}} -DFINUFFT_USE_DUCC0=${{ matrix.ducc_fft }} -DFINUFFT_ENABLE_SANITIZERS=${{matrix.build_type == 'Debug'}}
env:
CPM_SOURCE_CACHE: cpm
- name: Build
run: |
cmake --build ./build --config ${{matrix.build_type}}
- name: Test
working-directory: ./build
run: |
ctest -C ${{matrix.build_type}} --output-on-failure

- name: Set up Python
if: matrix.finufft_static_linking == 'off'
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Build Python wheels
if: matrix.finufft_static_linking == 'off'
env:
MACOSX_DEPLOYMENT_TARGET: 13
CPM_SOURCE_CACHE: cpm
shell: bash

- name: Install Python requirements
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install \
--verbose \
-C cmake.define.CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-C cmake.define.FINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }} \
-C cmake.define.FINUFFT_USE_DUCC0=${{ matrix.ducc_fft }} \
-C cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-C cmake.define.CMAKE_C_COMPILER_LAUNCHER=sccache \
-C cmake.define.CMAKE_GENERATOR=Ninja \
-C cmake.define.CMAKE_GENERATOR_PLATFORM= \
python/finufft
- name: Test Python package
if: matrix.finufft_static_linking == 'off'

- name: Build and test configurations
shell: bash
run: |
python3 -m pytest python/finufft/test
if [[ "$RUNNER_OS" == "Windows" ]]; then
configs=("build_type=Release ducc_fft=On" "build_type=Debug ducc_fft=On")
else
configs=("build_type=Release ducc_fft=On" "build_type=Release ducc_fft=Off" \
"build_type=Debug ducc_fft=On" "build_type=Debug ducc_fft=Off")
fi

if [[ "${{ matrix.toolchain }}" == "msvc" ]]; then
arch_flags=("/arch:AVX2" "/arch:SSE2" "native")
elif [[ "$RUNNER_OS" == "Linux" ]]; then
arch_flags=("-march=x86-64" "-march=x86-64-v2" "-march=x86-64-v3" "-march=native")
else
arch_flags=("native")
fi

for arch in "${arch_flags[@]}"; do
arch_dir=$(echo "$arch" | tr -c 'A-Za-z0-9' '_')
for cfg in "${configs[@]}"; do
eval "$cfg"
build_dir="build_${build_type}_${ducc_fft}_${arch_dir}"

cmake -E make_directory "$build_dir"
cmake -S . -B "$build_dir" \
-DCMAKE_BUILD_TYPE=$build_type \
-DFINUFFT_ARCH_FLAGS="$arch" \
-DFINUFFT_USE_DUCC0=$ducc_fft \
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded \
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
# CMake will pick the toolchain set by setup-cpp (and macOS brew block for gcc-14).

cmake --build "$build_dir" --config "$build_type"
(cd "$build_dir" && ctest -C "$build_type")

python3 -m pip install \
--verbose \
-C cmake.define.CMAKE_BUILD_TYPE=$build_type \
-C cmake.define.FINUFFT_ARCH_FLAGS="$arch" \
-C cmake.define.FINUFFT_USE_DUCC0=$ducc_fft \
-C cmake.define.CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded \
-C cmake.define.CMAKE_POLICY_DEFAULT_CMP0141=NEW \
python/finufft

python3 -m pytest python/finufft/test
done
done

cleanup:
runs-on: ubuntu-22.04
needs: cmake-ci
Expand Down
Loading
Loading