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

Build with Numpy 2.0 #231

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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/debug-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Zfpy Dependencies
run: |
python -m pip install cython
python -m pip install oldest-supported-numpy
python -m pip install "numpy>=2.0"
python -m pip install setuptools

- name: Install OpenMP
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debug-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Zfpy Dependencies
run: |
python -m pip install cython
python -m pip install oldest-supported-numpy
python -m pip install "numpy>=2.0"
python -m pip install setuptools

- name: Install OpenMP
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Tests

on: [push, pull_request]
on:
push:
# branches:
# - develop
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
BUILD_TYPE: Release
Expand Down Expand Up @@ -48,7 +56,7 @@ jobs:
- name: Install zfpy dependencies
run: |
python -m pip install cython
python -m pip install oldest-supported-numpy
python -m pip install "numpy>=2.0"
python -m pip install setuptools

- name: Setup OpenMP (Linux)
Expand Down
8 changes: 4 additions & 4 deletions appveyor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ if [ $COMPILER == "msvc" ] && [ $BUILD_TYPE == "Release" ]; then
if [ $ACTIVE_PY_VERSION != $PYTHON_VERSION ]; then
exit 1
fi

BUILD_FLAGS="$BUILD_FLAGS -DBUILD_ZFPY=ON"
PYTHON_DIR=$(python -c 'import sys; print(sys.prefix)')
BUILD_FLAGS="$BUILD_FLAGS -DBUILD_ZFPY=ON -DPYTHON_INCLUDE_DIR=$PYTHON_DIR\\include"
fi

BUILD_FLAGS="$BUILD_FLAGS -DBUILD_OPENMP=OFF"
Expand All @@ -46,9 +46,9 @@ cd tmpBuild
# (CMAKE_SH satisfies mingw builds)
set +e
if [ $COMPILER != "msvc" ]; then
cmake -G "$GENERATOR" "$APPVEYOR_BUILD_FOLDER/tests/ci-utils" -DCMAKE_SH=CMAKE_SH-NOTFOUND
cmake -G "$GENERATOR" -A "$PLATFORM" "$APPVEYOR_BUILD_FOLDER/tests/ci-utils" -DCMAKE_SH=CMAKE_SH-NOTFOUND
else
cmake -G "$GENERATOR" "$APPVEYOR_BUILD_FOLDER/tests/ci-utils"
cmake -G "$GENERATOR" -A "$PLATFORM" "$APPVEYOR_BUILD_FOLDER/tests/ci-utils"
fi

if [ $? -eq 0 ]; then
Expand Down
41 changes: 23 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,50 @@ environment:
# zfpy only build for Release builds (otherwise need debug python libs python27_d.lib)
matrix:
- COMPILER: msvc
GENERATOR: Visual Studio 15 2017 Win64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
GENERATOR: Visual Studio 17 2022
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
PLATFORM: x64
BUILD_TYPE: Release
PYTHON_VERSION: 38
PYTHON_VERSION: 39

- COMPILER: msvc
GENERATOR: Visual Studio 15 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
GENERATOR: Visual Studio 17 2022
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
PLATFORM: Win32
BUILD_TYPE: Release
PYTHON_VERSION: 38
PYTHON_VERSION: 39

- COMPILER: msvc
GENERATOR: Visual Studio 14 2015 Win64
GENERATOR: Visual Studio 16 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PLATFORM: x64
BUILD_TYPE: Release
PYTHON_VERSION: 38
PYTHON_VERSION: 39

- COMPILER: msvc
GENERATOR: Visual Studio 14 2015
GENERATOR: Visual Studio 16 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PLATFORM: Win32
BUILD_TYPE: Release
PYTHON_VERSION: 38
PYTHON_VERSION: 39

- COMPILER: mingw
GENERATOR: MinGW Makefiles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think these MinGW builds also need Python version set to 3.9. Appears they use Python 2.7 otherwise

APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PLATFORM: Win32
BUILD_TYPE: Release
PYTHON_VERSION: 39

- COMPILER: mingw-w64
GENERATOR: MinGW Makefiles
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
PLATFORM: x64
BUILD_TYPE: Release
PYTHON_VERSION: 39

install:
- if "%COMPILER%"=="mingw" set PATH=C:\MinGW\bin;%PATH%
- if "%COMPILER%"=="mingw-w64" set PATH=C:\MinGW\bin;%PATH%
- if "%COMPILER%"=="mingw" set "PATH=C:\MinGW\bin;%PATH%"
- if "%COMPILER%"=="mingw-w64" set "PATH=C:\MinGW\bin;%PATH%"

# set env vars for Python system dir (assumed to always be MSVC)
- ps: |
Expand All @@ -50,21 +56,20 @@ install:
if ($env:PLATFORM -eq "x64") {
$env:PYTHON_DIR = "$env:PYTHON_DIR-x64"
}

$env:PYTHON_LIB_PATH = "$env:PYTHON_DIR\libs\python$env:PYTHON_VERSION.lib"
}

- if not "%PYTHON_DIR%" == "" if not exist "%PYTHON_DIR%" exit 1
# placing these behind a conditional for some reason prevents CMake from picking up the virtualenv
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" set PATH=%PYTHON_DIR%;%PYTHON_DIR%\Scripts;%PATH%
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" pip install virtualenv
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" set "PATH=%PYTHON_DIR%;%PYTHON_DIR%\Scripts;%PATH%"
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" pip3 install virtualenv
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" set VIRTUALENV_NAME=pyVirtualEnv
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" virtualenv %VIRTUALENV_NAME%
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" "%VIRTUALENV_NAME%\\Scripts\\activate.bat"
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" pip install -r python\requirements.txt
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" pip3 install -r python\requirements.txt
- if "%COMPILER%"=="msvc" if "%BUILD_TYPE%"=="Release" python --version


build_script:
- sh appveyor.sh
# uncomment to enable interactive remote desktop mode
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
4 changes: 2 additions & 2 deletions cmake/appveyor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ if(BUILD_ZFPY)
set(CTEST_SITE "${CTEST_SITE}_zfpy$ENV{PYTHON_VERSION}")

# sanitize python include dir path (ex. windows vs linux slashes)
set(PYTHON_INCLUDE_DIR "")
file(TO_CMAKE_PATH "${CTEST_SOURCE_DIRECTORY}\\$ENV{VIRTUALENV_NAME}\\Include" PYTHON_INCLUDE_DIR)
# set(PYTHON_INCLUDE_DIR "")
# file(TO_CMAKE_PATH "${CTEST_SOURCE_DIRECTORY}\\$ENV{VIRTUALENV_NAME}\\Include" PYTHON_INCLUDE_DIR)

list(APPEND cfg_options
-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonExtensions REQUIRED)
find_package(Cython 0.28 REQUIRED) # >= v0.28 required for const memoryview support
find_package(NumPy REQUIRED)
find_package(NumPy 2.0 REQUIRED)

include_directories(${ZFP_SOURCE_DIR}/include)
include_directories(${NumPy_INCLUDE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cython>=0.22
numpy>=1.8.0
numpy>=2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a runtime requirements file or a build time requirements file?

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
author_email="[email protected]",
url="https://zfp.llnl.gov",
description="zfp compression in Python",
python_requires=">=3.9",
long_description="zfp is a compressed format for representing multidimensional floating-point and integer arrays. zfp provides compressed-array classes that support high throughput read and write random access to individual array elements. zfp also supports serial and parallel compression of whole arrays using both lossless and lossy compression with error tolerances. zfp is primarily written in C and C++ but also includes Python and Fortran bindings.",
ext_modules=[Extension("zfpy", ["build/python/zfpy.c"],
include_dirs=["include", np.get_include()],
Expand Down