Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update9.1.0 #128

Merged
merged 46 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e35d3c4
Update to SuiteSparse:GraphBLAS 9.1.0
eriknw May 29, 2024
858df89
maybe fix? (path and extra constant)
eriknw May 29, 2024
01c7d1e
Update default include path to include "suitesparse"
eriknw May 29, 2024
4f76637
Try this
eriknw May 29, 2024
fb18dc7
Maybe don't need this anymore for arm on mac os
eriknw May 29, 2024
0caa925
Merge branch 'main' into update9.1.0
eriknw Jun 1, 2024
8749bc2
Explicit macos x86 and arm runners
alugowski Jun 1, 2024
38fe7be
Add dir dump
alugowski Jun 1, 2024
f42f731
Look in "/usr/local"
alugowski Jun 1, 2024
cf75a88
Try installing to prefix
alugowski Jun 2, 2024
a96d9ae
Cmake from .
alugowski Jun 2, 2024
2580a67
Add lib64
alugowski Jun 2, 2024
fa0e837
Try installing to . instead of /tmp
alugowski Jun 2, 2024
9c3b59e
Set MACOSX_DEPLOYMENT_TARGET
alugowski Jun 2, 2024
0aee66c
Try installing to /usr/local/graphblas
alugowski Jun 2, 2024
aa35314
Try installing to {package}
alugowski Jun 3, 2024
fe9dffc
Fix
alugowski Jun 3, 2024
855f1be
Add prints
alugowski Jun 3, 2024
38298a8
Add print
alugowski Jun 3, 2024
a9b4c37
Try installing to .
alugowski Jun 3, 2024
66e11b3
parent
alugowski Jun 3, 2024
5dd9e9a
retry
alugowski Jun 3, 2024
7e1c7a5
Disable JIT on Windows
alugowski Jun 3, 2024
6a940fd
retry
alugowski Jun 3, 2024
c794d39
Fix if
alugowski Jun 3, 2024
a43bcfd
Revert to sys install
alugowski Jun 3, 2024
fcc2579
Fix sudo
alugowski Jun 3, 2024
6a8c53c
Disable JIT on Windows
alugowski Jun 3, 2024
270cffa
tweaks
alugowski Jun 3, 2024
e5ccb16
MSVC complex values
alugowski Jun 3, 2024
41872fc
Revert prints
alugowski Jun 3, 2024
891f221
Silence workflow warnings
alugowski Jun 3, 2024
b911474
Delete no longer used script
alugowski Jun 3, 2024
1d348e1
Undo run tests on push
alugowski Jun 3, 2024
0810cd0
Make linter happy
alugowski Jun 3, 2024
9b27a84
Linter
alugowski Jun 3, 2024
bb3ec65
Support both suitesparse.sh and conda install paths
alugowski Jun 3, 2024
5036424
Fix cibw_test_skip typo
alugowski Jun 3, 2024
f211aed
Build with numpy 2; add Python 3.13; drop Python 3.8
eriknw Oct 12, 2024
1b2669a
Bump
eriknw Oct 12, 2024
9141d43
Try setuptools<74
eriknw Oct 12, 2024
bc10b6e
experiment w/ setuptools as runtime dep
eriknw Oct 12, 2024
8f04eaa
undo
eriknw Oct 12, 2024
0447fda
Update cibuildwheel
eriknw Oct 13, 2024
3653f5b
Use cibuildwheel 2.21, not 2.21.3
eriknw Oct 13, 2024
71c53ba
Delete unnecessary code b/c we dropped Python 3.8
eriknw Oct 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
source: ["conda-forge"]
# os: ["ubuntu-latest"]
# source: ["source"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ jobs:
cibw_skip: "pp* *musl*"

# macOS x86
- os: macos-latest
# Note: keep as old as possible as due to libomp this will be the oldest supported macOS version.
- os: macos-12
cibw_archs: "x86_64"

# macOS Apple Silicon cross-compiled on x86 macOS runner.
# GitHub does not offer Apple Silicon yet (only for self-hosted).
# See https://github.com/github/roadmap/issues/528
- os: macos-latest
# macOS Apple Silicon
# Note: keep as old as possible as due to libomp this will be the oldest supported macOS version.
- os: macos-14
cibw_archs: "arm64"
# Skip macOS ARM tests on Intel runner.
cibw_test_skip: "*-macosx_arm64"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -139,17 +137,15 @@ jobs:
if: contains(matrix.os, 'macos')
# Install coreutils which includes `nproc` used by `make -j` in suitesparse.sh
#
# GitHub actions comes with libomp already installed, but for its native arch only. Must build universal one
# manually so that both x86 and arm builds can be built.
# Explicitly install libomp to be clear about the dependency.
#
# libomp determines the minimum macOS version that we can build for
run: |
brew fetch --retry coreutils && brew install coreutils
brew fetch --retry libomp && brew install libomp
if [[ ${{ matrix.cibw_archs }} == "arm64" ]] ; then
echo "Building universal libomp manually"
sh add_arm_to_libomp_dylib.sh || exit 1
fi
brew fetch --retry libomp && brew reinstall libomp
echo MACOSX_DEPLOYMENT_TARGET=$(otool -l $(brew --prefix libomp)/lib/libomp.dylib | grep minos | awk '{print $2}') >> $GITHUB_ENV

- uses: pypa/cibuildwheel@v2.16
- uses: pypa/cibuildwheel@v2.21
with:
output-dir: wheelhouse
env:
Expand Down
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -20,43 +20,43 @@ repos:
- id: mixed-line-ending
# - id: trailing-whitespace
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.14
rev: v0.20.2
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
rev: v3.18.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
# - repo: https://github.com/MarcoGorelli/auto-walrus
# rev: v0.2.2
# hooks:
# - id: auto-walrus
# args: [--line-length, "100"]
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.10.0
hooks:
- id: black
# - id: black-jupyter
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: &flake8_dependencies
# These versions need updated manually
- flake8==6.1.0
- flake8-comprehensions==3.14.0
- flake8-bugbear==23.9.16
- flake8==7.1.1
- flake8-comprehensions==3.15.0
- flake8-bugbear==24.8.19
# - flake8-simplify==0.20.0
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
Expand All @@ -71,6 +71,6 @@ repos:
# - id: pyroma
# args: [-n, "10", .]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: no-commit-to-branch # no commit directly to main
2 changes: 1 addition & 1 deletion GB_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.1
9.1.0
53 changes: 0 additions & 53 deletions add_arm_to_libomp_dylib.sh

This file was deleted.

24 changes: 20 additions & 4 deletions build_graphblas_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,30 @@
# Expected subdirectories: include/ (contains GraphBLAS.h), lib/, and bin/ (on Windows only)
# Otherwise fallback to default system folders.
graphblas_root = os.environ.get("GraphBLAS_ROOT", None)

if not graphblas_root:
# Windows wheels.yml configures suitesparse.sh to install GraphBLAS to "C:\\GraphBLAS".
graphblas_root = "C:\\GraphBLAS" if is_win else sys.prefix

include_dirs = [os.path.join(graphblas_root, "include")]
library_dirs = [os.path.join(graphblas_root, "lib")]
if is_win:
graphblas_root = "C:\\GraphBLAS"
elif Path("/usr/local/include/suitesparse").exists():
# SuiteSparse:GraphBLAS 9.1+ built by suitesparse.sh
graphblas_root = "/usr/local"
else:
# Conda install
graphblas_root = sys.prefix

include_dirs = [
os.path.join(graphblas_root, "include"),
os.path.join(graphblas_root, "include", "suitesparse"),
]
library_dirs = [os.path.join(graphblas_root, "lib"), os.path.join(graphblas_root, "lib64")]
if is_win:
include_dirs.append(os.path.join(sys.prefix, "Library", "include"))
include_dirs.append(os.path.join(sys.prefix, "Library", "include", "suitesparse"))
library_dirs.append(os.path.join(sys.prefix, "Library", "lib"))

include_dirs.append(os.path.join(graphblas_root, "include"))
include_dirs.append(os.path.join(graphblas_root, "include", "suitesparse"))
library_dirs.append(os.path.join(graphblas_root, "lib"))
library_dirs.append(os.path.join(graphblas_root, "bin"))

Expand Down Expand Up @@ -68,6 +81,9 @@ def get_extension(apply_msvc_patch: bool = None, extra_compile_args=()):
msvc_code = msvc_code.replace("double _Complex", "_Dcomplex")
code_path.write_text(msvc_code)

# Hack: tell GraphBLAS.h that we need MSVC-style complex values
extra_compile_args = list(extra_compile_args) + ["-DGxB_HAVE_COMPLEX_MSVC"]

return Extension(
"suitesparse_graphblas._graphblas",
[os.path.join("suitesparse_graphblas", "_graphblas.c")],
Expand Down
19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >=64",
# setuptools<74 until PyPy vendors cffi 1.15.1
"setuptools >=64, <74",
"setuptools-git-versioning",
"wheel",
"cffi>=1.11",
"cython",
"oldest-supported-numpy; platform_python_implementation != 'PyPy'",
# Inspired by SciPy: unpin numpy version for PyPy builds,
# as oldest-supported-numpy does not take PyPy into account.
"numpy; platform_python_implementation=='PyPy'",
"numpy>=2.0",
]

[project]
name = "suitesparse-graphblas"
dynamic = ["version"]
description = "SuiteSparse:GraphBLAS Python bindings."
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {file = "LICENSE"}
authors = [
{name = "Erik Welch", email = "[email protected]"},
Expand Down Expand Up @@ -53,11 +51,11 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Developers",
"Intended Audience :: Other Audience",
Expand All @@ -68,9 +66,8 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
# These are super-old; can/should we update them?
"cffi>=1.11",
"numpy>=1.19",
"cffi>=1.15",
"numpy>=1.23",
eriknw marked this conversation as resolved.
Show resolved Hide resolved
]
[project.urls]
homepage = "https://github.com/GraphBLAS/python-suitesparse-graphblas"
Expand All @@ -96,7 +93,7 @@ dirty_template = "{tag}+{ccount}.g{sha}.dirty"

[tool.black]
line-length = 100
target-version = ["py38", "py39", "py310", "py311"]
target-version = ["py39", "py310", "py311", "py312", "py313"]

[tool.isort]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
Expand Down
26 changes: 22 additions & 4 deletions suitesparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,29 @@ if [ -n "${SUITESPARSE_FASTEST_BUILD}" ]; then
cmake_params+=(-DCMAKE_CUDA_DEV=1)
fi

# Use `-DJITINIT=2` so that the JIT functionality is available, but disabled by default.
# Level 2, "run", means that pre-JIT kernels may be used, which does not require a compiler at runtime.
cmake .. -DJITINIT=2 -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' "${cmake_params[@]}"
if [ -n "${CMAKE_GNUtoMS}" ]; then
# Windows options
echo "Skipping JIT on Windows for now because it fails to build."
cmake_params+=(-DGRAPHBLAS_USE_JIT=OFF)
else
# Use `-DJITINIT=2` so that the JIT functionality is available, but disabled by default.
# Level 2, "run", means that pre-JIT kernels may be used, which does not require a compiler at runtime.
cmake_params+=(-DJITINIT=2)

# Disable JIT here too to not segfault in tests
cmake_params+=(-DGRAPHBLAS_USE_JIT=OFF)
fi

# some platforms require sudo for installation, some don't have sudo at all
if [ "$(uname)" == "Darwin" ]; then
SUDO=sudo
else
SUDO=""
fi

cmake .. -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' "${cmake_params[@]}"
make -j$NPROC
make install
$SUDO make install

if [ -n "${CMAKE_GNUtoMS}" ]; then
if [ -z "${GRAPHBLAS_PREFIX}" ]; then
Expand Down
5 changes: 4 additions & 1 deletion suitesparse_graphblas/create_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Run `python create_headers.py --help` to see more help.

"""

import argparse
import os
import re
Expand Down Expand Up @@ -325,6 +326,7 @@ def groupby(index, seq):
"RMM_WRAP_H",
"GXB_COMPLEX_H",
"GxB_STATIC_INLINE_VOID",
"GxB_HAVE_COMPLEX_C99",
# deprecated
"GxB_HYPER",
}
Expand Down Expand Up @@ -633,6 +635,7 @@ def handle_function_node(node):
"init": "core",
"wait": "core",
"deserialize": "core",
"Serialized": "core", # Added in version 9
}[group]
return {
"name": node.name,
Expand Down Expand Up @@ -782,7 +785,7 @@ def main():
parser.add_argument(
"--graphblas",
help="Path to GraphBLAS.h of SuiteSparse. Default will look in Python prefix path.",
default=os.path.join(sys.prefix, "include", "GraphBLAS.h"),
default=os.path.join(sys.prefix, "include", "suitesparse", "GraphBLAS.h"),
)
parser.add_argument(
"--show-skipped",
Expand Down
Loading
Loading