Skip to content

Commit f95521d

Browse files
committed
Mac x86 and arm builds
1 parent f00f720 commit f95521d

File tree

6 files changed

+45
-14
lines changed

6 files changed

+45
-14
lines changed

.github/workflows/wheels.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,24 @@ jobs:
6969

7070
- name: Install tools (macOS)
7171
if: contains(matrix.os, 'macos')
72-
# * install coreutils which includes `nproc` used by `make -j` in suitesparse.sh
73-
# * GitHub actions comes with libomp already installed. It's listed here to explicitly list this requirement.
72+
# Install coreutils which includes `nproc` used by `make -j` in suitesparse.sh
73+
#
74+
# GitHub actions comes with libomp already installed, but for its native arch only. Must build universal one
75+
# manually so that both x86 and arm builds can be built.
7476
run: |
7577
brew install coreutils
7678
brew install libomp
79+
sh add_arm_to_libomp_dylib.sh
7780
7881
- name: Build Wheels
7982
env:
8083
# very verbose
8184
CIBW_BUILD_VERBOSITY: 3
8285

8386
# Build SuiteSparse
84-
CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }}
87+
# CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }}
88+
# TODO
89+
CIBW_BEFORE_ALL: bash suitesparse.sh refs/tags/7.4.3.0
8590

8691
# CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows.
8792
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS"
@@ -90,13 +95,15 @@ jobs:
9095
CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1"
9196

9297
# Uncomment to only build CPython wheels
93-
# CIBW_BUILD: "cp*"
98+
# TODO
99+
CIBW_BUILD: "cp*"
94100

95101
# macOS: build x86_64 and arm64
96102
CIBW_ARCHS_MACOS: "x86_64 arm64"
97103

98104
# No 32-bit builds
99-
CIBW_SKIP: "*-win32 *_i686"
105+
# TODO
106+
CIBW_SKIP: "*-win32 *_i686 *musl*"
100107

101108
# Use delvewheel on Windows.
102109
# This copies graphblas.dll into the wheel. "repair" in cibuildwheel parlance includes copying any shared

add_arm_to_libomp_dylib.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
#mkdir x86lib
4+
mkdir armlib
5+
6+
# download and unzip both x86 and arm libomp tarballs
7+
#brew fetch --force --bottle-tag=x86_64_monterey libomp
8+
brew fetch --force --bottle-tag=arm64_big_sur libomp
9+
10+
# untar
11+
#tar -xzf $(brew --cache --bottle-tag=x86_64_monterey libomp) --strip-components 2 -C x86lib
12+
tar -xzf $(brew --cache --bottle-tag=arm64_big_sur libomp) --strip-components 2 -C armlib
13+
14+
# merge
15+
lipo armlib/lib/libomp.dylib $(brew --prefix libomp)/lib/libomp.dylib -output libomp.dylib -create
16+
cp -f libomp.dylib $(brew --prefix libomp)/lib

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ requires = [
1111

1212
[project]
1313
name = "suitesparse-graphblas"
14-
dynamic = ["version"]
14+
#dynamic = ["version"]
15+
# TODO
16+
version = "0.0.3"
1517
description = "SuiteSparse:GraphBLAS Python bindings."
1618
readme = "README.md"
1719
requires-python = ">=3.8"

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@
5858
if use_cython:
5959
ext_modules = cythonize(ext_modules, include_path=include_dirs)
6060

61-
ext_modules.append(build_graphblas_cffi.get_extension(extra_compile_args=extra_compile_args))
61+
if build_graphblas_cffi.is_win:
62+
ext_modules.append(build_graphblas_cffi.get_extension(extra_compile_args=extra_compile_args))
6263

6364
setup(
6465
ext_modules=ext_modules,
66+
cffi_modules=None if build_graphblas_cffi.is_win else ["build_graphblas_cffi.py:ffibuilder"],
6567
)

suitesparse.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ if [ -n "${BREW_LIBOMP}" ]; then
2424
cmake_params+=(-DOpenMP_C_LIB_NAMES="libomp")
2525
cmake_params+=(-DOpenMP_libomp_LIBRARY="omp")
2626
export LDFLAGS="-L$(brew --prefix libomp)/lib"
27+
28+
# build both x86 and ARM
29+
export CFLAGS="-arch x86_64 -arch arm64"
2730
fi
2831

2932
if [ -n "${CMAKE_GNUtoMS}" ]; then
@@ -45,14 +48,15 @@ cd GraphBLAS-${VERSION}/build
4548
# Disable optimizing some rarely-used types for significantly faster builds and significantly smaller wheel size.
4649
# Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits.
4750
# These can still be used, they'll just have reduced performance (AFAIK similar to UDTs).
48-
#echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h #
49-
#echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h #
50-
#echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h #
51-
#echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h #
52-
#echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h #
51+
# TODO
52+
echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h #
53+
echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h #
54+
echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h #
55+
echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h #
56+
echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h #
5357
echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h
5458
echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h
55-
#echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h #
59+
echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h #
5660
echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h
5761
echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h
5862
echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h

suitesparse_graphblas/tests/test_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def test_matrix_existence():
77

88

99
def test_version():
10-
assert suitesparse_graphblas.__version__ > "7.4.2.0"
10+
assert suitesparse_graphblas.__version__ >= "0.0.1"

0 commit comments

Comments
 (0)