Skip to content

Commit f93c06f

Browse files
authored
Merge: Parallelism & Portability
2 parents a750052 + bc13e02 commit f93c06f

94 files changed

Lines changed: 9789 additions & 4230 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/_wheels.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ jobs:
126126
uses: actions/checkout@v6
127127
with:
128128
ref: ${{ inputs.ref || github.sha }}
129+
- name: Print Machine Specs
130+
run: sysctl hw.optional.arm hw.optional machdep.cpu || true
129131
- name: Install Python
130132
uses: actions/setup-python@v6
131133
with:
@@ -168,6 +170,8 @@ jobs:
168170
uses: actions/checkout@v6
169171
with:
170172
ref: ${{ inputs.ref || github.sha }}
173+
- name: Print Machine Specs
174+
run: sysctl hw.optional.arm hw.optional machdep.cpu || true
171175
- name: Install Python
172176
uses: actions/setup-python@v6
173177
with:
@@ -226,6 +230,11 @@ jobs:
226230
uses: actions/checkout@v6
227231
with:
228232
ref: ${{ inputs.ref || github.sha }}
233+
- name: Print Machine Specs
234+
shell: pwsh
235+
run: |
236+
Get-CimInstance Win32_Processor | Format-List Name,Manufacturer,NumberOfCores,NumberOfLogicalProcessors,Description,Architecture
237+
Get-ComputerInfo | Format-List CsProcessors,OsArchitecture,WindowsVersion
229238
- name: Install Python
230239
uses: actions/setup-python@v6
231240
with:

.github/workflows/release-c.yml

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ jobs:
120120
- name: Package Archive
121121
shell: bash
122122
run: |
123-
tar -cvf "numkong_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar" \
123+
tar -czf "numkong_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar.gz" \
124124
build_release/Release/numkong.dll \
125125
include/numkong/ \
126126
LICENSE
127127
- name: Upload to GitHub Release
128128
shell: bash
129129
env:
130130
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131-
run: gh release upload ${{ github.event.release.tag_name }} "numkong_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar" --clobber
131+
run: gh release upload ${{ github.event.release.tag_name }} "numkong_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar.gz" --clobber
132132

133133
create_macos_dylib_library:
134134
name: Create Library for macOS
@@ -258,3 +258,161 @@ jobs:
258258
env:
259259
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260260
run: gh release upload ${{ github.event.release.tag_name }} numkong_wasm_*.tar.gz numkong_wasm_*.zip --clobber
261+
262+
create_freebsd_library:
263+
name: Create Library for FreeBSD
264+
runs-on: ubuntu-24.04
265+
env:
266+
CC: clang-20
267+
CXX: clang++-20
268+
AR: llvm-ar-20
269+
NM: llvm-nm-20
270+
RANLIB: llvm-ranlib-20
271+
strategy:
272+
fail-fast: false
273+
matrix:
274+
include:
275+
- arch: amd64
276+
freebsd_arch: amd64
277+
target: x86_64-unknown-freebsd14.2
278+
processor: x86_64
279+
- arch: arm64
280+
freebsd_arch: arm64/aarch64
281+
target: aarch64-unknown-freebsd14.2
282+
processor: aarch64
283+
steps:
284+
- name: Checkout Repository
285+
uses: actions/checkout@v6
286+
with:
287+
ref: "main"
288+
- name: Update Git Submodules
289+
run: git submodule update --init --recursive
290+
- name: Get Version
291+
id: set_version
292+
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
293+
- name: Install Dependencies
294+
run: |
295+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
296+
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" | sudo tee /etc/apt/sources.list.d/llvm-20.list
297+
sudo apt-get update
298+
sudo apt-get install -y clang-20 lld-20
299+
- name: Download FreeBSD Sysroot
300+
run: |
301+
mkdir -p /tmp/freebsd-sysroot
302+
curl -fsSL "https://download.freebsd.org/releases/${{ matrix.freebsd_arch }}/14.2-RELEASE/base.txz" \
303+
| tar -xJf - -C /tmp/freebsd-sysroot ./lib ./usr/lib ./usr/include
304+
- name: Build Shared Library
305+
run: |
306+
cmake -B build_freebsd \
307+
-DCMAKE_BUILD_TYPE=Release \
308+
-DCMAKE_SYSTEM_NAME=FreeBSD \
309+
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.processor }} \
310+
-DCMAKE_SYSROOT=/tmp/freebsd-sysroot \
311+
-DCMAKE_C_COMPILER_TARGET=${{ matrix.target }} \
312+
-DCMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
313+
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld-20" \
314+
-DNK_BUILD_SHARED=ON \
315+
-DNK_BUILD_TEST=OFF \
316+
-DNK_BUILD_BENCH=OFF
317+
cmake --build build_freebsd --config Release
318+
cp build_freebsd/libnumkong.so \
319+
"numkong_freebsd_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.so"
320+
- name: Upload to GitHub Release
321+
env:
322+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
323+
run: gh release upload ${{ github.event.release.tag_name }} *.so --clobber
324+
325+
create_linux_exotic_library:
326+
name: Create Library for Linux (${{ matrix.name }})
327+
runs-on: ubuntu-24.04
328+
strategy:
329+
fail-fast: false
330+
matrix:
331+
include:
332+
- name: ppc64le
333+
arch: ppc64le
334+
cc: powerpc64le-linux-gnu-gcc-14
335+
cxx: powerpc64le-linux-gnu-g++-14
336+
pkg: gcc-14-powerpc64le-linux-gnu g++-14-powerpc64le-linux-gnu
337+
processor: ppc64le
338+
- name: loongarch64
339+
arch: loongarch64
340+
cc: loongarch64-linux-gnu-gcc-14
341+
cxx: loongarch64-linux-gnu-g++-14
342+
pkg: gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu
343+
processor: loongarch64
344+
steps:
345+
- name: Checkout Repository
346+
uses: actions/checkout@v6
347+
with:
348+
ref: "main"
349+
- name: Update Git Submodules
350+
run: git submodule update --init --recursive
351+
- name: Get Version
352+
id: set_version
353+
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
354+
- name: Install Dependencies
355+
run: |
356+
sudo apt-get update
357+
sudo apt-get install -y ${{ matrix.pkg }}
358+
- name: Build Shared Library
359+
run: |
360+
cmake -B build_release \
361+
-DCMAKE_SYSTEM_NAME=Linux \
362+
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.processor }} \
363+
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
364+
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
365+
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
366+
-DCMAKE_BUILD_TYPE=Release \
367+
-DNK_BUILD_SHARED=ON \
368+
-DNK_BUILD_TEST=OFF \
369+
-DNK_BUILD_BENCH=OFF
370+
cmake --build build_release --config Release
371+
cp build_release/libnumkong.so \
372+
"numkong_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.so"
373+
- name: Upload to GitHub Release
374+
env:
375+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
376+
run: gh release upload ${{ github.event.release.tag_name }} *.so --clobber
377+
378+
create_linux_riscv_library:
379+
name: Create Library for Linux (riscv64)
380+
runs-on: ubuntu-24.04
381+
steps:
382+
- name: Checkout Repository
383+
uses: actions/checkout@v6
384+
with:
385+
ref: "main"
386+
- name: Update Git Submodules
387+
run: git submodule update --init --recursive
388+
- name: Get Version
389+
id: set_version
390+
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
391+
- name: Install Dependencies
392+
run: |
393+
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key \
394+
| sudo gpg --dearmor -o /usr/share/keyrings/llvm.gpg
395+
echo "deb [signed-by=/usr/share/keyrings/llvm.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble main" \
396+
| sudo tee /etc/apt/sources.list.d/llvm.list > /dev/null
397+
sudo apt-get update
398+
sudo apt-get install -y cmake clang-23 lld-23 llvm-23 \
399+
gcc-riscv64-linux-gnu libc6-dev-riscv64-cross
400+
- name: Build Shared Library
401+
run: |
402+
SYSROOT="$(riscv64-linux-gnu-gcc -print-sysroot)"
403+
cmake -B build_riscv \
404+
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-riscv64-llvm.cmake \
405+
-DLLVM_ROOT=/usr/lib/llvm-23 \
406+
-DRISCV_SYSROOT="${SYSROOT}" \
407+
-DRISCV_MARCH=rv64gcv_zvfh_zvfbfwma_zvbb \
408+
-DCMAKE_BUILD_TYPE=Release \
409+
-DNK_BUILD_SHARED=ON \
410+
-DNK_BUILD_TEST=OFF \
411+
-DNK_BUILD_BENCH=OFF
412+
cmake --build build_riscv --config Release
413+
cp build_riscv/libnumkong.so \
414+
"numkong_linux_riscv64_${{ steps.set_version.outputs.version }}.so"
415+
- name: Upload to GitHub Release
416+
env:
417+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
418+
run: gh release upload ${{ github.event.release.tag_name }} *.so --clobber

.github/workflows/release-javascript.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ jobs:
7070
sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev
7171
sudo apt install -y gcc-14-aarch64-linux-gnu g++-14-aarch64-linux-gnu binutils-aarch64-linux-gnu
7272
73+
- name: Install System Dependencies (macOS)
74+
if: runner.os == 'macOS'
75+
run: brew install libomp
76+
7377
- name: Set Up MSVC ARM64 Cross-Compiler
7478
if: matrix.platform == 'win32-arm64'
7579
shell: pwsh
@@ -104,6 +108,23 @@ jobs:
104108
shell: bash
105109
run: cp build/Release/numkong.node javascript/@numkong-${{ matrix.platform }}/numkong.node
106110

111+
# npm has no `delocate` equivalent: copy `libomp.dylib` next to the
112+
# `.node`, rewrite the install name to `@loader_path/libomp.dylib`,
113+
# then re-sign both (install_name_tool invalidates arm64 signatures).
114+
- name: Bundle libomp (macOS)
115+
if: runner.os == 'macOS'
116+
shell: bash
117+
run: |
118+
set -euo pipefail
119+
pkg="javascript/@numkong-${{ matrix.platform }}"
120+
libomp_src="$(brew --prefix libomp)/lib/libomp.dylib"
121+
cp "$libomp_src" "$pkg/libomp.dylib"
122+
chmod u+w "$pkg/libomp.dylib"
123+
install_name_tool -id "@loader_path/libomp.dylib" "$pkg/libomp.dylib"
124+
install_name_tool -change "$libomp_src" "@loader_path/libomp.dylib" "$pkg/numkong.node"
125+
codesign --force --sign - "$pkg/libomp.dylib"
126+
codesign --force --sign - "$pkg/numkong.node"
127+
107128
- name: Upload Platform Package
108129
uses: actions/upload-artifact@v7
109130
with:

0 commit comments

Comments
 (0)