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

Add support for numpy 2.0 #678

Merged
merged 11 commits into from
Jul 16, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Conda packages

on:
pull_request:
types: [opened, reopened, synchronize, closed]
push:
branches-ignore:
- "ghxyz"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux-consume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Linux consume LUE

on:
pull_request:
types: [opened, reopened, synchronize]
branches-ignore:
- "*"
push:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Linux CI

on:
pull_request:
types: [opened, reopened, synchronize, closed]
push:
branches-ignore:
- "ghxyz"
Expand Down Expand Up @@ -144,6 +145,7 @@ jobs:
-S ${{ env.lue_source_directory }} \
-B ${{ env.lue_build_directory }} \
--preset conan-release \
-D CMAKE_POLICY_DEFAULT_CMP0167=OLD \
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
-D LUE_BUILD_DOCUMENTATION=TRUE \
-D LUE_BUILD_QA=TRUE \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: macOS CI

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches-ignore:
- "ghxyz"
Expand Down Expand Up @@ -143,6 +144,7 @@ jobs:
-B ${{ env.lue_build_directory }} \
--preset conan-release \
-D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos_version }}.0 \
-D CMAKE_POLICY_DEFAULT_CMP0167=OLD \
-D LUE_BUILD_QA=TRUE \
-D LUE_QA_WITH_PYTHON_API=TRUE \
-D LUE_QA_WITH_TESTS=TRUE \
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Windows CI

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches-ignore:
- "ghxyz"
Expand Down Expand Up @@ -86,7 +87,8 @@ jobs:
conan \
conda-build \
docopt \
gdal \
libgdal \
hdf5 \
jinja2 \
libhwloc \
matplotlib \
Expand All @@ -109,7 +111,15 @@ jobs:
build_type: Release
cmake_preset: hpx_release_windows_node_configuration
cmake_preset_file: ${{ env.lue_source_directory }}/CMakeHPXPresets.json
cmake_flags: "-D Boost_ROOT=$CONDA_PREFIX/Library -D Hwloc_ROOT=$CONDA_PREFIX/Library -D Hwloc_LIBRARY=$CONDA_PREFIX/Library/lib/hwloc.lib"
# Passing path for Hwloc_ROOT to prevent:
# HPXConfig.cmake:160 (set):
# Syntax error in cmake code at
# D:/a/lue/lue/hpx_install/lib/cmake/HPX/HPXConfig.cmake:160
# when parsing string
# C:\Users\runneradmin\miniconda3\envs\test/Library
# Invalid character escape '\U'.
# HPX install logic needs to be updated, similar to how Boost_ROOT is handled
cmake_flags: "-D CMAKE_POLICY_DEFAULT_CMP0167=OLD -D CMAKE_POLICY_DEFAULT_CMP0169=OLD -D Boost_ROOT=$CONDA_PREFIX/Library -D Hwloc_ROOT=C:/Users/runneradmin/miniconda3/envs/test/Library -D Hwloc_LIBRARY=$CONDA_PREFIX/Library/lib/hwloc.lib"
hpx_branch: ${{ env.hpx_branch }}
source_directory: ${{ env.hpx_source_directory }}
build_directory: ${{ env.hpx_build_directory }}
Expand Down Expand Up @@ -151,6 +161,8 @@ jobs:
-S ${{ env.lue_source_directory }} \
-B ${{ env.lue_build_directory }} \
--preset conan-release \
-D CMAKE_POLICY_DEFAULT_CMP0167=OLD \
-D CMAKE_POLICY_DEFAULT_CMP0169=OLD \
-D LUE_BUILD_QA=TRUE \
-D LUE_QA_WITH_PYTHON_API=TRUE \
-D LUE_QA_WITH_TESTS=TRUE \
Expand Down
1 change: 1 addition & 0 deletions CMakeHPXPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"hidden": true,
"cacheVariables": {
"HPX_WITH_MALLOC": "mimalloc",
"HPX_WITH_FETCH_HWLOC": "TRUE",
"HPX_WITH_GOOGLE_PERFTOOLS": "FALSE"
}
},
Expand Down
11 changes: 2 additions & 9 deletions environment/cmake/LueConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,6 @@ if(LUE_PYBIND11_REQUIRED)
)
FetchContent_MakeAvailable(pybind11)

# Disable support for numpy 2.0 for now
# https://github.com/computationalgeography/lue/issues/664
target_compile_definitions(pybind11::module
INTERFACE
PYBIND11_NUMPY_1_ONLY)

# Silence pybind11 for now
# https://github.com/computationalgeography/lue/issues/484
target_compile_definitions(pybind11::module
Expand All @@ -356,9 +350,8 @@ if(LUE_BOOST_REQUIRED)
list(APPEND LUE_REQUIRED_BOOST_COMPONENTS regex)
endif()

set(Boost_NO_BOOST_CMAKE TRUE)

find_package(Boost REQUIRED COMPONENTS ${LUE_REQUIRED_BOOST_COMPONENTS})
# Use Boost's own FindBoost module instead of the deprecated CMake version
find_package(Boost REQUIRED COMPONENTS ${LUE_REQUIRED_BOOST_COMPONENTS} CONFIG)

if(Boost_VERSION VERSION_EQUAL "1.75")
message(FATAL_ERROR
Expand Down
13 changes: 6 additions & 7 deletions environment/cmake/LueMacro.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endfunction()
function(add_unit_tests)
set(prefix ARG)
set(no_values "")
set(single_values SCOPE)
set(single_values SCOPE TARGETS)
set(multi_values NAMES LIBRARIES)

cmake_parse_arguments(PARSE_ARGV 0 ${prefix} "${no_values}" "${single_values}" "${multi_values}")
Expand All @@ -30,21 +30,20 @@ function(add_unit_tests)

add_executable(${test_name} ${module_name}.cpp)

target_compile_definitions(${test_name}
PRIVATE
BOOST_TEST_DYN_LINK
)

target_link_libraries(${test_name}
PRIVATE
${ARG_LIBRARIES}
Boost::unit_test_framework
Boost::headers
)

add_test(NAME ${test_name}
COMMAND ${test_name}
)

list(APPEND test_names ${test_name})
endforeach()

set(${ARG_TARGETS} ${test_names} PARENT_SCOPE)
endfunction()


Expand Down
1 change: 1 addition & 0 deletions environment/conda/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if errorlevel 1 exit /b 1
cmake -S . -B build %CMAKE_ARGS% ^
--preset lue_release_windows_node ^
-G Ninja ^
-D CMAKE_POLICY_DEFAULT_CMP0167=OLD ^
-D CMAKE_INSTALL_LIBDIR=lib ^
-D LUE_INSTALL_PYTHON_PACKAGE_DIR="%SP_DIR%/lue" ^
-D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE ^
Expand Down
1 change: 1 addition & 0 deletions environment/conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fi
cmake -S . -B build $CMAKE_ARGS \
--preset $lue_preset \
-G Ninja \
-D CMAKE_POLICY_DEFAULT_CMP0167=OLD \
-D LUE_INSTALL_PYTHON_PACKAGE_DIR="${SP_DIR}/lue" \
-D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE \
-D LUE_DATA_MODEL_WITH_UTILITIES=TRUE \
Expand Down
5 changes: 4 additions & 1 deletion environment/configuration/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ docopt==0.6.2
jinja2==3.1.4
matplotlib==3.9.0
mypy==1.10.1
numpy==1.26.4

# Build against numpy 2, while also supporting running against numpy 1
numpy>=2.0

pre-commit==3.7.1
pybind11==2.12.0
ruamel.yaml==0.18.6
Expand Down
13 changes: 13 additions & 0 deletions source/data_model/cxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,17 @@ add_unit_tests(
NAMES ${names}
LIBRARIES
lue::data_model_test
TARGETS
test_names
)

foreach(test_name ${test_names})
set_property(
TEST
${test_name}
APPEND
PROPERTY
ENVIRONMENT_MODIFICATION
PATH=path_list_prepend:$<$<PLATFORM_ID:Windows>:$<TARGET_FILE_DIR:hdf5::hdf5>/../bin>
)
endforeach()
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array different_shape constant_shape value
#include "lue/array/different_shape/constant_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array different_shape value
#include "lue/array/different_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array different_shape variable_shape value
#include "lue/array/different_shape/variable_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array same_shape constant_shape value
#include "lue/array/same_shape/constant_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/test/array/same_shape/value_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array same_shape value
#include "lue/array/same_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue array same_shape variable_shape value
#include "lue/array/same_shape/variable_shape/value.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/test/core/time/clock_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE lue core time clock
#include "lue/core/time.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


BOOST_AUTO_TEST_CASE(seconds)
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/test/core/time/duration_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE lue core time duration
#include "lue/core/time.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


namespace ldm = lue::data_model;
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/test/core/time/tick_period_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE lue core time tick_period
#include "lue/core/time.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


BOOST_AUTO_TEST_CASE(seconds)
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/test/core/time/time_point_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE lue core time point
#include "lue/core/time.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


BOOST_AUTO_TEST_CASE(seconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lue/core/tag.hpp"
#include "lue/info/identity/active_object_id.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lue/core/tag.hpp"
#include "lue/info/identity/active_object_index.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lue/core/tag.hpp"
#include "lue/info/identity/active_set_index.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lue/core/tag.hpp"
#include "lue/info/identity/object_id.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property different_shape constant_shape property
#include "lue/info/property/different_shape/constant_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property different_shape property
#include "lue/info/property/different_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property different_shape variable_shape property
#include "lue/info/property/different_shape/variable_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property same_shape constant_shape property
#include "lue/info/property/same_shape/constant_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property same_shape property
#include "lue/info/property/same_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define BOOST_TEST_MODULE lue info property same_shape variable_shape property
#include "lue/info/property/same_shape/variable_shape/property.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lue/core/tag.hpp"
#include "lue/info/space/mobile_space_box.hpp"
#include "lue/test.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>


class Fixture: public lue::data_model::test::FileFixture
Expand Down
Loading
Loading