From 0b38387f4f1f0348986e8724aaae6c1a5e59e906 Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Fri, 3 Feb 2023 15:00:06 -0800 Subject: [PATCH 01/23] Setup cibuildwheel with Linux, macOS, Windows wheels --- .github/workflows/wheels.yml | 166 ++++++++++++++++++++---- build_graphblas_cffi.py | 7 + pyproject.toml | 2 +- suitesparse.sh | 63 ++++++++- suitesparse_graphblas/tests/__init__.py | 0 5 files changed, 208 insertions(+), 30 deletions(-) mode change 100644 => 100755 suitesparse.sh delete mode 100644 suitesparse_graphblas/tests/__init__.py diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f2fda55..d7a65b1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -4,36 +4,148 @@ on: release: types: [created] + # Enable Run Workflow button in GitHub UI + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - wheels: + build_sdist: + name: Build SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build SDist + run: pipx run build --sdist + + - name: Check metadata + run: pipx run twine check dist/* + + - uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz + + + build_wheels: + name: Wheels on ${{ matrix.platform_id }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -l {0} strategy: fail-fast: false matrix: - os: ["ubuntu-latest"] + # Loosely based on scikit-learn's config: + # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml + include: + - os: windows-latest + python-version: "3.8" + platform_id: win_amd64 + + - os: ubuntu-latest + python-version: "3.8" + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python-version: "3.8" + platform_id: manylinux_aarch64 + manylinux_image: manylinux2014 + + # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). + - os: macos-latest + python-version: "3.8" + platform_id: macosx_x86_64 + steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - name: Upgrade pip - run: | - python -m pip install --upgrade pip - - name: Build manylinux Python wheels - uses: RalfG/python-wheels-manylinux-build@v0.4.2-manylinux2014_x86_64 - with: - python-versions: 'cp38-cp38 cp39-cp39' - build-requirements: 'cffi numpy>=1.19,<1.20 cython' - pre-build-command: ${{ format('sh suitesparse.sh {0}', github.ref) }} - - name: Publish wheels to PyPI - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - pip install twine - twine upload dist/*-manylinux*.whl + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install tools (macOS) + if: contains(matrix.os, 'macos') + # * install coreutils which includes `nproc` used by `make -j` in suitesparse.sh + # * GitHub actions comes with libomp already installed. It's listed here to explicitly list this requirement. + run: | + brew install coreutils + brew install libomp + + - name: Build Wheels + env: + # very verbose + CIBW_BUILD_VERBOSITY: 3 + + # Build SuiteSparse + CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} + + # Ask suitesparse.sh to build libraries in MSVC style on Windows. + CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON + + # macOS libomp requires special configs. BREW_LIBOMP=1 asks suitesparse.sh to include them. + CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" + + # Uncomment to only build CPython wheels + # CIBW_BUILD: "cp*" + + # macOS: build x86_64 and arm64 + CIBW_ARCHS_MACOS: "x86_64 arm64" + + # No 32-bit builds + CIBW_SKIP: "*-win32 *_i686" + + # Use delvewheel on Windows. + # This copies graphblas.dll into the wheel. "repair" in cibuildwheel parlance includes copying any shared + # libraries from the build host into the wheel to make the wheel self-contained. + # Cibuildwheel includes tools for this for Linux and macOS, and they recommend delvewheel for Windows. + # Note: Currently using a workaround: --no-mangle instead of stripping graphblas.dll + # see https://github.com/adang1345/delvewheel/issues/33 + CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"C:\\Program Files (x86)\\bin\" --no-mangle \"libgomp-1.dll;libgcc_s_seh-1.dll\" -w {dest_dir} {wheel}" + + # make cibuildwheel install test dependencies from pyproject.toml + CIBW_TEST_EXTRAS: "test" + + # run tests + CIBW_TEST_COMMAND: "pytest {project}/suitesparse_graphblas/tests" + + # GitHub Actions macOS Intel runner cannot run ARM tests. + CIBW_TEST_SKIP: "*-macosx_arm64" + + run: | + python -m pip install cibuildwheel + python -m cibuildwheel --output-dir wheelhouse . + shell: bash + + - uses: actions/upload-artifact@v3 + with: + path: wheelhouse/*.whl + + + upload_all: + name: Upload to PyPI + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest +# if: github.event_name == 'release' && github.event.action == 'published' + + steps: + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + # PyPI does not allow replacing a file. Without this flag the entire action fails if even a single duplicate exists. + skip_existing: true + verbose: true + # Real PyPI: +# password: ${{ secrets.PYPI_TOKEN }} + + # Test PyPI: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ diff --git a/build_graphblas_cffi.py b/build_graphblas_cffi.py index 0de462b..fd74c78 100644 --- a/build_graphblas_cffi.py +++ b/build_graphblas_cffi.py @@ -16,6 +16,13 @@ include_dirs.append(os.path.join(sys.prefix, "Library", "include")) library_dirs.append(os.path.join(sys.prefix, "Library", "lib")) + # suitesparse.sh installs GraphBLAS.h here + include_dirs.append(os.path.join("C:\\", "Program Files (x86)", "include")) + # graphblas.lib and graphblas.dll.a + library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "lib")) + # graphblas.dll + library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "bin")) + ffibuilder.set_source( "suitesparse_graphblas._graphblas", (ss_g / "source.c").read_text(), diff --git a/pyproject.toml b/pyproject.toml index 4059c4e..60bba53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ classifiers = [ ] dependencies = [ # These are super-old; can/should we update them? - "cffi>=1.0.0", + "cffi>=1.11", "numpy>=1.19", ] [project.urls] diff --git a/suitesparse.sh b/suitesparse.sh old mode 100644 new mode 100755 index 77410fc..2a40515 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -1,14 +1,73 @@ +#!/bin/bash +# parse SuiteSparse version from first argument, a git tag that ends in the version (no leading v) if [[ $1 =~ refs/tags/([0-9]*\.[0-9]*\.[0-9]*)\..*$ ]]; then VERSION=${BASH_REMATCH[1]} else + echo "Specify a SuiteSparse version, such as: $0 refs/tags/7.4.3.0" exit -1 fi echo VERSION: $VERSION +NPROC="$(nproc)" +if [ -z "${NPROC}" ]; then + # Default for platforms that don't have nproc. Mostly Windows. + NPROC="2" +fi + +cmake_params=() +if [ -n "${BREW_LIBOMP}" ]; then + # macOS OpenMP flags. + # FindOpenMP doesn't find brew's libomp, so set the necessary configs manually. + cmake_params+=(-DOpenMP_C_FLAGS="-Xclang -fopenmp -I$(brew --prefix libomp)/include") + cmake_params+=(-DOpenMP_C_LIB_NAMES="libomp") + cmake_params+=(-DOpenMP_libomp_LIBRARY="omp") + export LDFLAGS="-L$(brew --prefix libomp)/lib" +fi + +if [ -n "${CMAKE_GNUtoMS}" ]; then + # Windows needs .lib libraries, not .a + cmake_params+=(-DCMAKE_GNUtoMS=ON) + # Windows expects 'graphblas.lib', not 'libgraphblas.lib' + cmake_params+=(-DCMAKE_SHARED_LIBRARY_PREFIX=) + cmake_params+=(-DCMAKE_STATIC_LIBRARY_PREFIX=) +fi + curl -L https://github.com/DrTimothyAldenDavis/GraphBLAS/archive/refs/tags/v${VERSION}.tar.gz | tar xzf - cd GraphBLAS-${VERSION}/build -cmake .. -DCMAKE_BUILD_TYPE=Release -make -j$(nproc) + +# Disable optimizing some rarely-used types for significantly faster builds and significantly smaller wheel size. +# Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits. +# These can still be used, they'll just have reduced performance (AFAIK similar to UDTs). +#echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # +#echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # +#echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # +#echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # +#echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h +echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h +#echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h +echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h +echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h +echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h +echo "#define GxB_NO_UINT8 1" >> ../Source/GB_control.h + +# Disable all Source/Generated2 kernels. For workflow development only. +#cmake_params+=(-DCMAKE_CUDA_DEV=1) + +cmake .. -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' "${cmake_params[@]}" +make -j$NPROC make install + +if [ -n "${CMAKE_GNUtoMS}" ]; then + # Windows: + # CMAKE_STATIC_LIBRARY_PREFIX is sometimes ignored, possibly when the MinGW toolchain is selected. + # Drop the 'lib' prefix manually. + echo "manually removing lib prefix" + mv "C:/Program Files (x86)/lib/libgraphblas.lib" "C:/Program Files (x86)/lib/graphblas.lib" + mv "C:/Program Files (x86)/lib/libgraphblas.dll.a" "C:/Program Files (x86)/lib/graphblas.dll.a" + # cp instead of mv because the GNU tools expect libgraphblas.dll and the MS tools expect graphblas.dll. + cp "C:/Program Files (x86)/bin/libgraphblas.dll" "C:/Program Files (x86)/bin/graphblas.dll" +fi diff --git a/suitesparse_graphblas/tests/__init__.py b/suitesparse_graphblas/tests/__init__.py deleted file mode 100644 index e69de29..0000000 From f00f7207c3c388bfee5edd88ac23579aef4729c4 Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Tue, 14 Feb 2023 17:34:43 -0800 Subject: [PATCH 02/23] Implement wheel PR comments --- .github/workflows/wheels.yml | 22 +++++++++++++++++++--- build_graphblas_cffi.py | 11 +++++------ pyproject.toml | 2 +- suitesparse.sh | 16 +++++++++++++--- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d7a65b1..5209564 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -17,6 +17,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Build SDist run: pipx run build --sdist @@ -58,6 +60,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-python@v4 with: @@ -79,8 +83,8 @@ jobs: # Build SuiteSparse CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} - # Ask suitesparse.sh to build libraries in MSVC style on Windows. - CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON + # CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows. + CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS" # macOS libomp requires special configs. BREW_LIBOMP=1 asks suitesparse.sh to include them. CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" @@ -101,7 +105,7 @@ jobs: # Note: Currently using a workaround: --no-mangle instead of stripping graphblas.dll # see https://github.com/adang1345/delvewheel/issues/33 CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"C:\\Program Files (x86)\\bin\" --no-mangle \"libgomp-1.dll;libgcc_s_seh-1.dll\" -w {dest_dir} {wheel}" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"C:\\GraphBLAS\\bin\" --no-mangle \"libgomp-1.dll;libgcc_s_seh-1.dll\" -w {dest_dir} {wheel}" # make cibuildwheel install test dependencies from pyproject.toml CIBW_TEST_EXTRAS: "test" @@ -118,9 +122,21 @@ jobs: shell: bash - uses: actions/upload-artifact@v3 + id: uploadAttempt1 + continue-on-error: true with: path: wheelhouse/*.whl + if-no-files-found: error + # Retry upload if first attempt failed. This happens somewhat randomly and for irregular reasons. + # Logic is a duplicate of previous step. + - uses: actions/upload-artifact@v3 + id: uploadAttempt2 + if: steps.uploadAttempt1.outcome == 'failure' + continue-on-error: false + with: + path: wheelhouse/*.whl + if-no-files-found: error upload_all: name: Upload to PyPI diff --git a/build_graphblas_cffi.py b/build_graphblas_cffi.py index fd74c78..dff21e6 100644 --- a/build_graphblas_cffi.py +++ b/build_graphblas_cffi.py @@ -16,12 +16,11 @@ include_dirs.append(os.path.join(sys.prefix, "Library", "include")) library_dirs.append(os.path.join(sys.prefix, "Library", "lib")) - # suitesparse.sh installs GraphBLAS.h here - include_dirs.append(os.path.join("C:\\", "Program Files (x86)", "include")) - # graphblas.lib and graphblas.dll.a - library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "lib")) - # graphblas.dll - library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "bin")) + # wheels.yml configures suitesparse.sh to install GraphBLAS here. + prefix = "C:\\GraphBLAS" + include_dirs.append(os.path.join(prefix, "include")) + library_dirs.append(os.path.join(prefix, "lib")) + library_dirs.append(os.path.join(prefix, "bin")) ffibuilder.set_source( "suitesparse_graphblas._graphblas", diff --git a/pyproject.toml b/pyproject.toml index 60bba53..7da88f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = [ "setuptools >=64", "setuptools-git-versioning", "wheel", - "cffi", + "cffi>=1.11", "cython", "oldest-supported-numpy", ] diff --git a/suitesparse.sh b/suitesparse.sh index 2a40515..49df5f3 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -34,6 +34,11 @@ if [ -n "${CMAKE_GNUtoMS}" ]; then cmake_params+=(-DCMAKE_STATIC_LIBRARY_PREFIX=) fi +if [ -n "${GRAPHBLAS_PREFIX}" ]; then + echo "GRAPHBLAS_PREFIX=${GRAPHBLAS_PREFIX}" + cmake_params+=(-DCMAKE_INSTALL_PREFIX="${GRAPHBLAS_PREFIX}") +fi + curl -L https://github.com/DrTimothyAldenDavis/GraphBLAS/archive/refs/tags/v${VERSION}.tar.gz | tar xzf - cd GraphBLAS-${VERSION}/build @@ -62,12 +67,17 @@ make -j$NPROC make install if [ -n "${CMAKE_GNUtoMS}" ]; then + if [ -z "${GRAPHBLAS_PREFIX}" ]; then + # Windows default + GRAPHBLAS_PREFIX="C:/Program Files (x86)" + fi + # Windows: # CMAKE_STATIC_LIBRARY_PREFIX is sometimes ignored, possibly when the MinGW toolchain is selected. # Drop the 'lib' prefix manually. echo "manually removing lib prefix" - mv "C:/Program Files (x86)/lib/libgraphblas.lib" "C:/Program Files (x86)/lib/graphblas.lib" - mv "C:/Program Files (x86)/lib/libgraphblas.dll.a" "C:/Program Files (x86)/lib/graphblas.dll.a" + mv "${GRAPHBLAS_PREFIX}/lib/libgraphblas.lib" "${GRAPHBLAS_PREFIX}/lib/graphblas.lib" + mv "${GRAPHBLAS_PREFIX}/lib/libgraphblas.dll.a" "${GRAPHBLAS_PREFIX}/lib/graphblas.dll.a" # cp instead of mv because the GNU tools expect libgraphblas.dll and the MS tools expect graphblas.dll. - cp "C:/Program Files (x86)/bin/libgraphblas.dll" "C:/Program Files (x86)/bin/graphblas.dll" + cp "${GRAPHBLAS_PREFIX}/bin/libgraphblas.dll" "${GRAPHBLAS_PREFIX}/bin/graphblas.dll" fi From f95521ddf2cbd995a955f25e0883c6412e41887e Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Thu, 16 Feb 2023 20:09:49 -0800 Subject: [PATCH 03/23] Mac x86 and arm builds --- .github/workflows/wheels.yml | 17 ++++++++++++----- add_arm_to_libomp_dylib.sh | 16 ++++++++++++++++ pyproject.toml | 4 +++- setup.py | 4 +++- suitesparse.sh | 16 ++++++++++------ suitesparse_graphblas/tests/test_package.py | 2 +- 6 files changed, 45 insertions(+), 14 deletions(-) create mode 100755 add_arm_to_libomp_dylib.sh diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5209564..7991df9 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -69,11 +69,14 @@ jobs: - name: Install tools (macOS) if: contains(matrix.os, 'macos') - # * install coreutils which includes `nproc` used by `make -j` in suitesparse.sh - # * GitHub actions comes with libomp already installed. It's listed here to explicitly list this requirement. + # 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. run: | brew install coreutils brew install libomp + sh add_arm_to_libomp_dylib.sh - name: Build Wheels env: @@ -81,7 +84,9 @@ jobs: CIBW_BUILD_VERBOSITY: 3 # Build SuiteSparse - CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} +# CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} + # TODO + CIBW_BEFORE_ALL: bash suitesparse.sh refs/tags/7.4.3.0 # CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows. CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS" @@ -90,13 +95,15 @@ jobs: CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" # Uncomment to only build CPython wheels - # CIBW_BUILD: "cp*" + # TODO + CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 CIBW_ARCHS_MACOS: "x86_64 arm64" # No 32-bit builds - CIBW_SKIP: "*-win32 *_i686" + # TODO + CIBW_SKIP: "*-win32 *_i686 *musl*" # Use delvewheel on Windows. # This copies graphblas.dll into the wheel. "repair" in cibuildwheel parlance includes copying any shared diff --git a/add_arm_to_libomp_dylib.sh b/add_arm_to_libomp_dylib.sh new file mode 100755 index 0000000..fe462ff --- /dev/null +++ b/add_arm_to_libomp_dylib.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +#mkdir x86lib +mkdir armlib + +# download and unzip both x86 and arm libomp tarballs +#brew fetch --force --bottle-tag=x86_64_monterey libomp +brew fetch --force --bottle-tag=arm64_big_sur libomp + +# untar +#tar -xzf $(brew --cache --bottle-tag=x86_64_monterey libomp) --strip-components 2 -C x86lib +tar -xzf $(brew --cache --bottle-tag=arm64_big_sur libomp) --strip-components 2 -C armlib + +# merge +lipo armlib/lib/libomp.dylib $(brew --prefix libomp)/lib/libomp.dylib -output libomp.dylib -create +cp -f libomp.dylib $(brew --prefix libomp)/lib \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7da88f4..5cc1519 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,9 @@ requires = [ [project] name = "suitesparse-graphblas" -dynamic = ["version"] +#dynamic = ["version"] +# TODO +version = "0.0.3" description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" diff --git a/setup.py b/setup.py index 53d4d58..860cd3a 100644 --- a/setup.py +++ b/setup.py @@ -58,8 +58,10 @@ if use_cython: ext_modules = cythonize(ext_modules, include_path=include_dirs) -ext_modules.append(build_graphblas_cffi.get_extension(extra_compile_args=extra_compile_args)) +if build_graphblas_cffi.is_win: + ext_modules.append(build_graphblas_cffi.get_extension(extra_compile_args=extra_compile_args)) setup( ext_modules=ext_modules, + cffi_modules=None if build_graphblas_cffi.is_win else ["build_graphblas_cffi.py:ffibuilder"], ) diff --git a/suitesparse.sh b/suitesparse.sh index 49df5f3..8fecb33 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -24,6 +24,9 @@ if [ -n "${BREW_LIBOMP}" ]; then cmake_params+=(-DOpenMP_C_LIB_NAMES="libomp") cmake_params+=(-DOpenMP_libomp_LIBRARY="omp") export LDFLAGS="-L$(brew --prefix libomp)/lib" + + # build both x86 and ARM + export CFLAGS="-arch x86_64 -arch arm64" fi if [ -n "${CMAKE_GNUtoMS}" ]; then @@ -45,14 +48,15 @@ cd GraphBLAS-${VERSION}/build # Disable optimizing some rarely-used types for significantly faster builds and significantly smaller wheel size. # Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits. # These can still be used, they'll just have reduced performance (AFAIK similar to UDTs). -#echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # -#echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # -#echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # -#echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # -#echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # +# TODO +echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h -#echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # +echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h diff --git a/suitesparse_graphblas/tests/test_package.py b/suitesparse_graphblas/tests/test_package.py index 36b83f6..f131c9b 100644 --- a/suitesparse_graphblas/tests/test_package.py +++ b/suitesparse_graphblas/tests/test_package.py @@ -7,4 +7,4 @@ def test_matrix_existence(): def test_version(): - assert suitesparse_graphblas.__version__ > "7.4.2.0" + assert suitesparse_graphblas.__version__ >= "0.0.1" From f15f08c19bb65d9fc73561f0078d10e99392a22a Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Wed, 22 Mar 2023 16:28:22 -0500 Subject: [PATCH 04/23] Formatting --- add_arm_to_libomp_dylib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add_arm_to_libomp_dylib.sh b/add_arm_to_libomp_dylib.sh index fe462ff..7394767 100755 --- a/add_arm_to_libomp_dylib.sh +++ b/add_arm_to_libomp_dylib.sh @@ -13,4 +13,4 @@ tar -xzf $(brew --cache --bottle-tag=arm64_big_sur libomp) --strip-components 2 # merge lipo armlib/lib/libomp.dylib $(brew --prefix libomp)/lib/libomp.dylib -output libomp.dylib -create -cp -f libomp.dylib $(brew --prefix libomp)/lib \ No newline at end of file +cp -f libomp.dylib $(brew --prefix libomp)/lib From 98b87270a71bfed7ebf1d0a248afba662f974a55 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 08:57:45 -0500 Subject: [PATCH 05/23] Bump version for testpypi --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5cc1519..38c094c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ requires = [ name = "suitesparse-graphblas" #dynamic = ["version"] # TODO -version = "0.0.3" +version = "0.0.4" description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" @@ -29,7 +29,7 @@ maintainers = [ {name = "Michel Pelletier", email = "michel@graphegon.com"}, ] classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", From 89c422fc413e5e083f677b300bac8063b75d9f0d Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 10:23:03 -0500 Subject: [PATCH 06/23] Update for linux images --- .github/workflows/wheels.yml | 16 ++++++++-------- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7991df9..d802769 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,23 +40,23 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: - - os: windows-latest - python-version: "3.8" - platform_id: win_amd64 +# - os: windows-latest +# python-version: "3.8" +# platform_id: win_amd64 - os: ubuntu-latest python-version: "3.8" platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 + manylinux_image: manylinux2014_x86_64 - os: ubuntu-latest python-version: "3.8" platform_id: manylinux_aarch64 - manylinux_image: manylinux2014 + manylinux_image: manylinux2014_aarch64 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). - - os: macos-latest - python-version: "3.8" - platform_id: macosx_x86_64 +# - os: macos-latest +# python-version: "3.8" +# platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 diff --git a/pyproject.toml b/pyproject.toml index 38c094c..6e861e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ requires = [ name = "suitesparse-graphblas" #dynamic = ["version"] # TODO -version = "0.0.4" +version = "0.0.4.1" description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" From c4bf20d30a5a921273d5d533654927716e28512b Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 13:40:57 -0500 Subject: [PATCH 07/23] Enable linux aarch64, disable osx-arm64 --- .github/workflows/wheels.yml | 5 ++++- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d802769..15fe47d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -98,8 +98,11 @@ jobs: # TODO CIBW_BUILD: "cp*" + # linux: build x86_64 and aarch64 + CIBW_ARCHS_LINUX: "x86_64 aarch64" + # macOS: build x86_64 and arm64 - CIBW_ARCHS_MACOS: "x86_64 arm64" + #CIBW_ARCHS_MACOS: "x86_64 arm64" # No 32-bit builds # TODO diff --git a/pyproject.toml b/pyproject.toml index 6e861e5..0630840 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ requires = [ name = "suitesparse-graphblas" #dynamic = ["version"] # TODO -version = "0.0.4.1" +version = "0.0.4.2" description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" From f890700fe7a8d502c11ee486cc029c64122b6361 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 15:02:02 -0500 Subject: [PATCH 08/23] Bunch of changes from scikit-learn's file --- .github/workflows/wheels.yml | 71 ++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 15fe47d..e9062c4 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -32,7 +32,7 @@ jobs: build_wheels: - name: Wheels on ${{ matrix.platform_id }} - ${{ matrix.os }} + name: Wheels on cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -40,23 +40,50 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: -# - os: windows-latest -# python-version: "3.8" -# platform_id: win_amd64 - + - os: windows-latest + python: 38 + platform_id: win_amd64 + - os: windows-latest + python: 39 + platform_id: win_amd64 + - os: windows-latest + python: 310 + platform_id: win_amd64 + - os: windows-latest + python: 311 + platform_id: win_amd64 + + # Linux 64 bit manylinux2014 - os: ubuntu-latest - python-version: "3.8" + python: 38 platform_id: manylinux_x86_64 - manylinux_image: manylinux2014_x86_64 + manylinux_image: manylinux2014 - os: ubuntu-latest - python-version: "3.8" - platform_id: manylinux_aarch64 - manylinux_image: manylinux2014_aarch64 - - # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). -# - os: macos-latest -# python-version: "3.8" -# platform_id: macosx_x86_64 + python: 39 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 310 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 311 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + + # MacOS x86_64 + - os: macos-latest + python: 38 + platform_id: macosx_x86_64 + - os: macos-latest + python: 39 + platform_id: macosx_x86_64 + - os: macos-latest + python: 310 + platform_id: macosx_x86_64 + - os: macos-latest + python: 311 + platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 @@ -65,7 +92,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.9' - name: Install tools (macOS) if: contains(matrix.os, 'macos') @@ -80,8 +107,8 @@ jobs: - name: Build Wheels env: - # very verbose - CIBW_BUILD_VERBOSITY: 3 + # somewhat verbose + CIBW_BUILD_VERBOSITY: 2 # Build SuiteSparse # CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} @@ -96,10 +123,14 @@ jobs: # Uncomment to only build CPython wheels # TODO - CIBW_BUILD: "cp*" + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + + CIBW_ARCHS: all # linux: build x86_64 and aarch64 - CIBW_ARCHS_LINUX: "x86_64 aarch64" +# CIBW_ARCHS_LINUX: "x86_64 aarch64" + + CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" From 200a443d8757dd8a02930ec0978c6b82227b0bd9 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 15:43:42 -0500 Subject: [PATCH 09/23] Undo last changes --- .github/workflows/wheels.yml | 54 ++++++------------------------------ pyproject.toml | 4 +-- 2 files changed, 10 insertions(+), 48 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e9062c4..22402a8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -32,7 +32,7 @@ jobs: build_wheels: - name: Wheels on cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} + name: Wheels on ${{ matrix.platform_id }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -41,48 +41,19 @@ jobs: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: - os: windows-latest - python: 38 - platform_id: win_amd64 - - os: windows-latest - python: 39 - platform_id: win_amd64 - - os: windows-latest - python: 310 - platform_id: win_amd64 - - os: windows-latest - python: 311 + python-version: "3.8" platform_id: win_amd64 # Linux 64 bit manylinux2014 - os: ubuntu-latest + python-version: "3.8" python: 38 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 39 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 310 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 311 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - # MacOS x86_64 + # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). - os: macos-latest - python: 38 - platform_id: macosx_x86_64 - - os: macos-latest - python: 39 - platform_id: macosx_x86_64 - - os: macos-latest - python: 310 - platform_id: macosx_x86_64 - - os: macos-latest - python: 311 + python-version: "3.8" platform_id: macosx_x86_64 steps: @@ -92,7 +63,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: ${{ matrix.python-version }} - name: Install tools (macOS) if: contains(matrix.os, 'macos') @@ -107,8 +78,8 @@ jobs: - name: Build Wheels env: - # somewhat verbose - CIBW_BUILD_VERBOSITY: 2 + # very verbose + CIBW_BUILD_VERBOSITY: 3 # Build SuiteSparse # CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} @@ -123,14 +94,7 @@ jobs: # Uncomment to only build CPython wheels # TODO - CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - - CIBW_ARCHS: all - - # linux: build x86_64 and aarch64 -# CIBW_ARCHS_LINUX: "x86_64 aarch64" - - CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} + CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" diff --git a/pyproject.toml b/pyproject.toml index 0630840..beccc7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,7 @@ requires = [ [project] name = "suitesparse-graphblas" -#dynamic = ["version"] -# TODO -version = "0.0.4.2" +dynamic = ["version"] description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" From 6397c7e9d668d8ea69deec2ba507d20b529a53fa Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Thu, 23 Mar 2023 16:48:27 -0500 Subject: [PATCH 10/23] Bump version for testpypi (#2) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes --- .github/workflows/wheels.yml | 8 +++----- pyproject.toml | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7991df9..22402a8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -44,14 +44,12 @@ jobs: python-version: "3.8" platform_id: win_amd64 + # Linux 64 bit manylinux2014 - os: ubuntu-latest python-version: "3.8" + python: 38 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-latest - python-version: "3.8" - platform_id: manylinux_aarch64 - manylinux_image: manylinux2014 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). - os: macos-latest @@ -99,7 +97,7 @@ jobs: CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 - CIBW_ARCHS_MACOS: "x86_64 arm64" + #CIBW_ARCHS_MACOS: "x86_64 arm64" # No 32-bit builds # TODO diff --git a/pyproject.toml b/pyproject.toml index 5cc1519..beccc7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,7 @@ requires = [ [project] name = "suitesparse-graphblas" -#dynamic = ["version"] -# TODO -version = "0.0.3" +dynamic = ["version"] description = "SuiteSparse:GraphBLAS Python bindings." readme = "README.md" requires-python = ">=3.8" @@ -29,7 +27,7 @@ maintainers = [ {name = "Michel Pelletier", email = "michel@graphegon.com"}, ] classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", From ec69ef74157522b342f2d56f4e6faca1bcb521ae Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 10:39:38 -0500 Subject: [PATCH 11/23] Try to see what is modifying repo --- .github/workflows/wheels.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 22402a8..2cfa36e 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,21 +40,20 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: - - os: windows-latest - python-version: "3.8" - platform_id: win_amd64 +# - os: windows-latest +# python-version: "3.8" +# platform_id: win_amd64 # Linux 64 bit manylinux2014 - os: ubuntu-latest python-version: "3.8" - python: 38 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). - - os: macos-latest - python-version: "3.8" - platform_id: macosx_x86_64 +# - os: macos-latest +# python-version: "3.8" +# platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 @@ -122,8 +121,11 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | + git status python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . + git status + git diff . shell: bash - uses: actions/upload-artifact@v3 From ca7e94e3f8e7912700fb9cb72c97e657df0d9b10 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 10:59:03 -0500 Subject: [PATCH 12/23] Cibw test (#3) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes * Try to see what is modifying repo --- .github/workflows/wheels.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 22402a8..2cfa36e 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,21 +40,20 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: - - os: windows-latest - python-version: "3.8" - platform_id: win_amd64 +# - os: windows-latest +# python-version: "3.8" +# platform_id: win_amd64 # Linux 64 bit manylinux2014 - os: ubuntu-latest python-version: "3.8" - python: 38 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). - - os: macos-latest - python-version: "3.8" - platform_id: macosx_x86_64 +# - os: macos-latest +# python-version: "3.8" +# platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 @@ -122,8 +121,11 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | + git status python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . + git status + git diff . shell: bash - uses: actions/upload-artifact@v3 From 633c8f164fc6ac5dbdac10a34917864e39a69d78 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 12:05:14 -0500 Subject: [PATCH 13/23] Modify dirty string --- .github/workflows/wheels.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2cfa36e..09c1021 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,9 +40,9 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: -# - os: windows-latest -# python-version: "3.8" -# platform_id: win_amd64 + - os: windows-latest + python-version: "3.8" + platform_id: win_amd64 # Linux 64 bit manylinux2014 - os: ubuntu-latest @@ -51,9 +51,9 @@ jobs: manylinux_image: manylinux2014 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). -# - os: macos-latest -# python-version: "3.8" -# platform_id: macosx_x86_64 + - os: macos-latest + python-version: "3.8" + platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 @@ -92,14 +92,12 @@ jobs: CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" # Uncomment to only build CPython wheels - # TODO CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" # No 32-bit builds - # TODO CIBW_SKIP: "*-win32 *_i686 *musl*" # Use delvewheel on Windows. @@ -121,11 +119,9 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | - git status + sed -i '' 's/{tag}+{ccount}.g{sha}.dirty/{tag}/g' pyproject.toml python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . - git status - git diff . shell: bash - uses: actions/upload-artifact@v3 From 23f7ea3b7280df5ff1e2b4d994a29221cb7388de Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 12:08:05 -0500 Subject: [PATCH 14/23] Cibw test (#4) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes * Try to see what is modifying repo * Modify dirty string --- .github/workflows/wheels.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2cfa36e..09c1021 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,9 +40,9 @@ jobs: # Loosely based on scikit-learn's config: # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml include: -# - os: windows-latest -# python-version: "3.8" -# platform_id: win_amd64 + - os: windows-latest + python-version: "3.8" + platform_id: win_amd64 # Linux 64 bit manylinux2014 - os: ubuntu-latest @@ -51,9 +51,9 @@ jobs: manylinux_image: manylinux2014 # Use x86 macOS runner to build both x86 and ARM. GitHub does not offer M1/M2 yet (only self-hosted). -# - os: macos-latest -# python-version: "3.8" -# platform_id: macosx_x86_64 + - os: macos-latest + python-version: "3.8" + platform_id: macosx_x86_64 steps: - uses: actions/checkout@v3 @@ -92,14 +92,12 @@ jobs: CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" # Uncomment to only build CPython wheels - # TODO CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" # No 32-bit builds - # TODO CIBW_SKIP: "*-win32 *_i686 *musl*" # Use delvewheel on Windows. @@ -121,11 +119,9 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | - git status + sed -i '' 's/{tag}+{ccount}.g{sha}.dirty/{tag}/g' pyproject.toml python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . - git status - git diff . shell: bash - uses: actions/upload-artifact@v3 From 8c3537a0d104a806cef57fe3a1142763d91d84b8 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 13:27:14 -0500 Subject: [PATCH 15/23] Try ignoring GraphBLAS-{version}/ checkout folder --- .github/workflows/wheels.yml | 1 - .gitignore | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 09c1021..96901e6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -119,7 +119,6 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | - sed -i '' 's/{tag}+{ccount}.g{sha}.dirty/{tag}/g' pyproject.toml python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . shell: bash diff --git a/.gitignore b/.gitignore index 609ca66..e382cda 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ share/python-wheels/ MANIFEST wheelhouse +# Wheel building stuff +GraphBLAS-*/ + # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. From ce05eb4c1b36dfe5b1e991a9f696fa61289ae1a7 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 13:28:40 -0500 Subject: [PATCH 16/23] Cibw test (#5) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes * Try to see what is modifying repo * Modify dirty string * Try ignoring GraphBLAS-{version}/ checkout folder --- .github/workflows/wheels.yml | 1 - .gitignore | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 09c1021..96901e6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -119,7 +119,6 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" run: | - sed -i '' 's/{tag}+{ccount}.g{sha}.dirty/{tag}/g' pyproject.toml python -m pip install cibuildwheel python -m cibuildwheel --output-dir wheelhouse . shell: bash diff --git a/.gitignore b/.gitignore index 609ca66..e382cda 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ share/python-wheels/ MANIFEST wheelhouse +# Wheel building stuff +GraphBLAS-*/ + # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. From 8c1208fdd787e36e126826ed32a89746b6ceb435 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 14:20:44 -0500 Subject: [PATCH 17/23] Just keep swimming --- .github/workflows/wheels.yml | 2 +- add_arm_to_libomp_dylib.sh | 2 ++ suitesparse.sh | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 96901e6..a19d6dc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -92,7 +92,7 @@ jobs: CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" # Uncomment to only build CPython wheels - CIBW_BUILD: "cp*" +# CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" diff --git a/add_arm_to_libomp_dylib.sh b/add_arm_to_libomp_dylib.sh index 7394767..8492c7c 100755 --- a/add_arm_to_libomp_dylib.sh +++ b/add_arm_to_libomp_dylib.sh @@ -14,3 +14,5 @@ tar -xzf $(brew --cache --bottle-tag=arm64_big_sur libomp) --strip-components 2 # merge lipo armlib/lib/libomp.dylib $(brew --prefix libomp)/lib/libomp.dylib -output libomp.dylib -create cp -f libomp.dylib $(brew --prefix libomp)/lib +rm libomp.dylib +rm -rf armlib diff --git a/suitesparse.sh b/suitesparse.sh index 8fecb33..d12cddc 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -49,15 +49,15 @@ cd GraphBLAS-${VERSION}/build # Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits. # These can still be used, they'll just have reduced performance (AFAIK similar to UDTs). # TODO -echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h -echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h From 7ced0a308168764cf8f9bad0f40b6630d4e5f04b Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 14:22:20 -0500 Subject: [PATCH 18/23] Cibw test (#6) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes * Try to see what is modifying repo * Modify dirty string * Try ignoring GraphBLAS-{version}/ checkout folder * Just keep swimming --- .github/workflows/wheels.yml | 2 +- add_arm_to_libomp_dylib.sh | 2 ++ suitesparse.sh | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 96901e6..a19d6dc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -92,7 +92,7 @@ jobs: CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1" # Uncomment to only build CPython wheels - CIBW_BUILD: "cp*" +# CIBW_BUILD: "cp*" # macOS: build x86_64 and arm64 #CIBW_ARCHS_MACOS: "x86_64 arm64" diff --git a/add_arm_to_libomp_dylib.sh b/add_arm_to_libomp_dylib.sh index 7394767..8492c7c 100755 --- a/add_arm_to_libomp_dylib.sh +++ b/add_arm_to_libomp_dylib.sh @@ -14,3 +14,5 @@ tar -xzf $(brew --cache --bottle-tag=arm64_big_sur libomp) --strip-components 2 # merge lipo armlib/lib/libomp.dylib $(brew --prefix libomp)/lib/libomp.dylib -output libomp.dylib -create cp -f libomp.dylib $(brew --prefix libomp)/lib +rm libomp.dylib +rm -rf armlib diff --git a/suitesparse.sh b/suitesparse.sh index 8fecb33..d12cddc 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -49,15 +49,15 @@ cd GraphBLAS-${VERSION}/build # Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits. # These can still be used, they'll just have reduced performance (AFAIK similar to UDTs). # TODO -echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h -echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # +# echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h From 7cf3595fc1d1abf9089e66ee6731ac7f59c96e1f Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 15:46:43 -0500 Subject: [PATCH 19/23] Moar dtypes! --- .github/workflows/wheels.yml | 4 +--- suitesparse.sh | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a19d6dc..95c8d9b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -81,9 +81,7 @@ jobs: CIBW_BUILD_VERBOSITY: 3 # Build SuiteSparse -# CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} - # TODO - CIBW_BEFORE_ALL: bash suitesparse.sh refs/tags/7.4.3.0 + CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} # CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows. CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS" diff --git a/suitesparse.sh b/suitesparse.sh index d12cddc..2e5f86e 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -54,13 +54,13 @@ cd GraphBLAS-${VERSION}/build # echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h -echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # # echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h -echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT8 1" >> ../Source/GB_control.h # Disable all Source/Generated2 kernels. For workflow development only. From 884de67687d0af18ec7c3ad1ecf5b9b8bfdb9ff3 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Fri, 24 Mar 2023 15:48:44 -0500 Subject: [PATCH 20/23] Cibw test (#7) * Bump version for testpypi * Update for linux images * Enable linux aarch64, disable osx-arm64 * Bunch of changes from scikit-learn's file * Undo last changes * Try to see what is modifying repo * Modify dirty string * Try ignoring GraphBLAS-{version}/ checkout folder * Just keep swimming * Moar dtypes! --- .github/workflows/wheels.yml | 4 +--- suitesparse.sh | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a19d6dc..95c8d9b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -81,9 +81,7 @@ jobs: CIBW_BUILD_VERBOSITY: 3 # Build SuiteSparse -# CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} - # TODO - CIBW_BEFORE_ALL: bash suitesparse.sh refs/tags/7.4.3.0 + CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }} # CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows. CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS" diff --git a/suitesparse.sh b/suitesparse.sh index d12cddc..2e5f86e 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -54,13 +54,13 @@ cd GraphBLAS-${VERSION}/build # echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_FC64 1" >> ../Source/GB_control.h # -echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h -echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT16 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_INT32 1" >> ../Source/GB_control.h # echo "#define GxB_NO_INT64 1" >> ../Source/GB_control.h # # echo "#define GxB_NO_INT8 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT16 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT32 1" >> ../Source/GB_control.h -echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h +# echo "#define GxB_NO_UINT64 1" >> ../Source/GB_control.h echo "#define GxB_NO_UINT8 1" >> ../Source/GB_control.h # Disable all Source/Generated2 kernels. For workflow development only. From ef34fc5591771ab0c75a3926e2cf1ac8eb0072c8 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Mon, 27 Mar 2023 14:06:00 -0500 Subject: [PATCH 21/23] Switch from test to normal PyPI --- .github/workflows/wheels.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 95c8d9b..0c65251 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -160,8 +160,8 @@ jobs: skip_existing: true verbose: true # Real PyPI: -# password: ${{ secrets.PYPI_TOKEN }} + password: ${{ secrets.PYPI_TOKEN }} # Test PyPI: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ +# password: ${{ secrets.TEST_PYPI_API_TOKEN }} +# repository_url: https://test.pypi.org/legacy/ From 66a399a20490e7b74e0d56c78088b26cb9fa9d95 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Mon, 27 Mar 2023 17:51:36 -0500 Subject: [PATCH 22/23] Only upload to PyPI from the main repo --- .github/workflows/wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 0c65251..6eb4e23 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -142,6 +142,7 @@ jobs: name: Upload to PyPI needs: [build_wheels, build_sdist] runs-on: ubuntu-latest + if: github.repository == 'GraphBLAS/python-suitesparse-graphblas' # if: github.event_name == 'release' && github.event.action == 'published' steps: From dbb7a046b49db38be57d65e1456221dcff4b27ed Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Wed, 29 Mar 2023 14:55:09 -0500 Subject: [PATCH 23/23] Remove mac arm options --- .github/workflows/wheels.yml | 20 ++++++++++---------- suitesparse.sh | 6 +++--- suitesparse_graphblas/tests/test_package.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 6eb4e23..7d59053 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -64,16 +64,16 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install tools (macOS) - 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. - run: | - brew install coreutils - brew install libomp - sh add_arm_to_libomp_dylib.sh +# - name: Install tools (macOS) +# 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. +# run: | +# brew install coreutils +# brew install libomp +# sh add_arm_to_libomp_dylib.sh - name: Build Wheels env: diff --git a/suitesparse.sh b/suitesparse.sh index 2e5f86e..72d805f 100755 --- a/suitesparse.sh +++ b/suitesparse.sh @@ -25,8 +25,9 @@ if [ -n "${BREW_LIBOMP}" ]; then cmake_params+=(-DOpenMP_libomp_LIBRARY="omp") export LDFLAGS="-L$(brew --prefix libomp)/lib" - # build both x86 and ARM - export CFLAGS="-arch x86_64 -arch arm64" + export CFLAGS="-arch x86_64" +# # build both x86 and ARM +# export CFLAGS="-arch x86_64 -arch arm64" fi if [ -n "${CMAKE_GNUtoMS}" ]; then @@ -48,7 +49,6 @@ cd GraphBLAS-${VERSION}/build # Disable optimizing some rarely-used types for significantly faster builds and significantly smaller wheel size. # Also the build with all types enabled sometimes stalls on GitHub Actions. Probably due to exceeded resource limits. # These can still be used, they'll just have reduced performance (AFAIK similar to UDTs). -# TODO # echo "#define GxB_NO_BOOL 1" >> ../Source/GB_control.h # # echo "#define GxB_NO_FP32 1" >> ../Source/GB_control.h # # echo "#define GxB_NO_FP64 1" >> ../Source/GB_control.h # diff --git a/suitesparse_graphblas/tests/test_package.py b/suitesparse_graphblas/tests/test_package.py index f131c9b..36b83f6 100644 --- a/suitesparse_graphblas/tests/test_package.py +++ b/suitesparse_graphblas/tests/test_package.py @@ -7,4 +7,4 @@ def test_matrix_existence(): def test_version(): - assert suitesparse_graphblas.__version__ >= "0.0.1" + assert suitesparse_graphblas.__version__ > "7.4.2.0"