Skip to content

Commit c2308fc

Browse files
committed
This allows finufft to compile when xsimd is not supported
1 parent 69a2788 commit c2308fc

File tree

4 files changed

+94
-2
lines changed

4 files changed

+94
-2
lines changed

.github/workflows/powerpc.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: PowerPC cross-compilation build
2+
3+
on:
4+
# Weekly schedule (Sunday 00:00 UTC)
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
8+
# On tag push
9+
push:
10+
tags:
11+
- 'v*'
12+
# Manual trigger (with an optional deploy toggle)
13+
workflow_dispatch:
14+
inputs:
15+
deploy:
16+
description: "Deploy after build?"
17+
type: boolean
18+
required: false
19+
default: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
name: '${{ matrix.target.arch }}, ${{ matrix.sys.compiler }} ${{ matrix.sys.version }}'
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
target:
29+
- { platform: 'ppc64le', arch: 'ppc64le', dir: 'powerpc64le-linux-gnu', flags: '-maltivec -mvsx -mcpu=power10' }
30+
- { platform: 'ppc64', arch: 'ppc64', dir: 'powerpc64-linux-gnu', flags: '-maltivec -mvsx -mcpu=power10' }
31+
sys:
32+
- { compiler: 'gcc', version: '12' }
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Apt setup (cross toolchains, qemu, ninja)
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get --no-install-suggests --no-install-recommends install \
42+
g++-${{ matrix.sys.version }}-${{ matrix.target.dir }} \
43+
g++-${{ matrix.sys.version }}-multilib \
44+
qemu-user \
45+
ninja-build
46+
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-gcc || true
47+
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-g++ || true
48+
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-gcc ${{ matrix.target.dir }}-gcc /usr/bin/${{ matrix.target.dir }}-gcc-${{ matrix.sys.version }} 20
49+
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-g++ ${{ matrix.target.dir }}-g++ /usr/bin/${{ matrix.target.dir }}-g++-${{ matrix.sys.version }} 20
50+
51+
- name: Configure (RelWithDebInfo, DUCC0 + examples + tests, no Fortran)
52+
shell: bash
53+
env:
54+
CC: ${{ matrix.target.dir }}-gcc
55+
CXX: ${{ matrix.target.dir }}-g++
56+
run: |
57+
cmake -S . -B build -G Ninja \
58+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
59+
-DCMAKE_C_COMPILER="${CC}" \
60+
-DCMAKE_CXX_COMPILER="${CXX}" \
61+
-DCMAKE_C_FLAGS="${{ matrix.target.flags }}" \
62+
-DCMAKE_CXX_FLAGS="${{ matrix.target.flags }}" \
63+
-DCMAKE_SYSTEM_NAME=Linux \
64+
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.target.arch }} \
65+
-DCMAKE_CROSSCOMPILING_EMULATOR="qemu-${{ matrix.target.platform }};-cpu;power10;-L;/usr/${{ matrix.target.dir }}/" \
66+
-DFINUFFT_USE_DUCC0=ON \
67+
-DFINUFFT_BUILD_EXAMPLES=ON \
68+
-DFINUFFT_BUILD_TESTS=ON \
69+
-DFINUFFT_ARCH_FLAGS=
70+
71+
- name: Build
72+
shell: bash
73+
run: cmake --build build --config RelWithDebInfo --parallel
74+
75+
- name: Test
76+
shell: bash
77+
# With CMAKE_CROSSCOMPILING_EMULATOR set, tests run via QEMU automatically.
78+
run: ctest --test-dir build --output-on-failure

include/finufft/xsimd.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef FINUFFT_XSIMD_HPP
2+
#define FINUFFT_XSIMD_HPP
3+
4+
#include <xsimd/config/xsimd_config.hpp>
5+
6+
#ifdef XSIMD_NO_SUPPORTED_ARCHITECTURE
7+
#undef XSIMD_NO_SUPPORTED_ARCHITECTURE
8+
#define XSIMD_WITH_EMULATED 1
9+
#define XSIMD_DEFAULT_ARCH emulated<128>
10+
#endif
11+
12+
#include <xsimd/xsimd.hpp>
13+
14+
#endif // FINUFFT_XSIMD_HPP

src/finufft_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <iomanip>
1010
#include <memory>
1111
#include <vector>
12-
#include <xsimd/xsimd.hpp>
12+
#include <finufft/xsimd.hpp>
1313

1414
using namespace finufft;
1515
using namespace finufft::utils;

src/spreadinterp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "ker_horner_allw_loop_constexpr.h"
77
#include "ker_lowupsampfac_horner_allw_loop_constexpr.h"
88

9-
#include <xsimd/xsimd.hpp>
9+
#include <finufft/xsimd.hpp>
1010

1111
#include <array>
1212
#include <cinttypes>

0 commit comments

Comments
 (0)