Repository: computationalgeography/lue (language: python)

Issue:
Port to HPX 1.10.0



Discussion / hints:
https://github.com/STEllAR-GROUP/hpx/releases

Fix patch:
diff --git a/.github/actions/install_hpx/action.yaml b/.github/actions/install_hpx/action.yaml
index 84c6ea1bb..3e7f09429 100644
--- a/.github/actions/install_hpx/action.yaml
+++ b/.github/actions/install_hpx/action.yaml
@@ -13,7 +13,7 @@ inputs:
     required: true
   cmake_flags:
     required: true
-  hpx_version:
+  hpx_branch:
     required: true
   cache_key:
     required: true
@@ -38,7 +38,7 @@ runs:
       shell: bash -l {0}
       if: ${{ steps.cache-hpx.outputs.cache-hit != 'true' }}
       run: |
-        git clone --depth 1 --branch v${{ inputs.hpx_version }} https://github.com/STEllAR-GROUP/hpx.git ${{ inputs.source_directory }}
+        git clone --depth 1 --branch ${{ inputs.hpx_branch }} https://github.com/STEllAR-GROUP/hpx.git ${{ inputs.source_directory }}
         cp ${{ inputs.cmake_preset_file }} ${{ inputs.source_directory }}/CMakeUserPresets.json
 
         mkdir ${{ inputs.build_directory }}
@@ -50,7 +50,6 @@ runs:
             -G "Ninja" \
             -D CMAKE_CXX_COMPILER=${{ inputs.cxx_compiler }} \
             -D CMAKE_BUILD_TYPE=${{ inputs.build_type }} \
-            -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
             ${{ inputs.cmake_flags }}
         cmake --build ${{ inputs.build_directory }} --target all
         cmake --install ${{ inputs.build_directory }} --prefix ${{ inputs.install_directory }} --strip
diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml
index ec70b5c4a..1537e2af8 100644
--- a/.github/workflows/conda.yml
+++ b/.github/workflows/conda.yml
@@ -25,12 +25,12 @@ jobs:
             matrix:
                 include:
                 # Bug in HPX / Clang headers it seems
-                # - os: "macos-14"
-                #   target-platform: arm-64
-                #   conda-bld-dir: "/Users/runner/miniconda3/envs/test/conda-bld/arm-64/"
-                # - os: "macos-13"
-                #   target-platform: osx-64
-                #   conda-bld-dir: "/Users/runner/miniconda3/envs/test/conda-bld/osx-64/"
+                - os: "macos-14"
+                  target-platform: arm-64
+                  conda-bld-dir: "/Users/runner/miniconda3/envs/test/conda-bld/arm-64/"
+                - os: "macos-13"
+                  target-platform: osx-64
+                  conda-bld-dir: "/Users/runner/miniconda3/envs/test/conda-bld/osx-64/"
                 - os: "ubuntu-22.04"
                   target-platform: linux-64
                   conda-bld-dir: "/home/runner/miniconda3/envs/test/conda-bld/linux-64/"
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 90ef00734..23c879d4e 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -51,10 +51,12 @@ jobs:
           lue_development_install_directory: lue_development_install
           lue_consume_source_directory: lue_consume_source
           lue_consume_build_directory: lue_consume_build
-          hpx_version: 1.9.1
+          hpx_version: 1.10.0
+          hpx_branch: v1.10.0
           hpx_source_directory: hpx_source
           hpx_build_directory: hpx_build
           hpx_install_directory: hpx_install
+          mdspan_tag: 9ceface91483775a6c74d06ebf717bbb2768452f  # 0.6.0
           mdspan_source_directory: mdspan_source
           mdspan_build_directory: mdspan_build
           mdspan_install_directory: mdspan_install
@@ -102,10 +104,9 @@ jobs:
             c_compiler: ${{ matrix.compiler.c }}
             cxx_compiler: ${{ matrix.compiler.cxx }}
             build_type: Release
-            cmake_flags: "-D CMAKE_POLICY_DEFAULT_CMP0148=OLD"
             cmake_preset: hpx_release_linux_node_configuration
             cmake_preset_file: ${{ env.lue_source_directory }}/CMakeHPXPresets.json
-            hpx_version: ${{ env.hpx_version }}
+            hpx_branch: ${{ env.hpx_branch }}
             source_directory: ${{ env.hpx_source_directory }}
             build_directory: ${{ env.hpx_build_directory }}
             install_directory: ${{ env.hpx_install_directory }}
@@ -115,7 +116,7 @@ jobs:
           with:
             cxx_compiler: ${{ matrix.compiler.cxx }}
             build_type: Release
-            mdspan_tag: 721efd8  # 20240305
+            mdspan_tag: ${{ env.mdspan_tag }}
             source_directory: ${{ env.mdspan_source_directory }}
             build_directory: ${{ env.mdspan_build_directory }}
             install_directory: ${{ env.mdspan_install_directory }}
@@ -144,7 +145,6 @@ jobs:
                       -B ${{ env.lue_build_directory }} \
                       --preset conan-release \
                       -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
-                      -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
                       -D LUE_BUILD_DOCUMENTATION=TRUE \
                       -D LUE_BUILD_QA=TRUE \
                       -D LUE_QA_WITH_PYTHON_API=TRUE \
@@ -156,7 +156,7 @@ jobs:
                       -D LUE_FRAMEWORK_WITH_IMAGE_LAND=TRUE \
                       -D LUE_FRAMEWORK_WITH_PYTHON_API=TRUE \
                       -D HPX_ROOT=${{ env.hpx_install_directory }} \
-                      -D MDSPAN_ROOT=${{ env.mdspan_install_directory }}
+                      -D mdspan_ROOT=${{ env.mdspan_install_directory }}
 
         - name: build
           run: |
@@ -178,7 +178,10 @@ jobs:
         - name: test
           run: |
               # Unit tests
-              ctest --test-dir ${{ env.lue_build_directory }} --output-on-failure
+              ctest \
+                  --test-dir ${{ env.lue_build_directory }} \
+                  --output-on-failure \
+                  --exclude-regex lue_py_image_land_python_test
 
               # Test of runtime targets
               ${{ env.lue_runtime_install_directory }}/bin/lue_translate --version
@@ -203,10 +206,9 @@ jobs:
                   -G "Ninja" \
                   -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
                   -D CMAKE_BUILD_TYPE=Release \
-                  -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
-                  -D LUE_ROOT=${{ env.lue_development_install_directory }} \
+                  -D lue_ROOT=${{ env.lue_development_install_directory }} \
                   -D HPX_ROOT=${{ env.hpx_install_directory }} \
-                  -D MDSPAN_ROOT=${{ env.mdspan_install_directory }}
+                  -D mdspan_ROOT=${{ env.mdspan_install_directory }}
               cmake --build ${{ env.lue_consume_build_directory }} --target all
 
               ${{ env.lue_consume_build_directory }}/lue_consume_data_model
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index d1b149c62..88ddb938d 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -45,10 +45,12 @@ jobs:
           lue_development_install_directory: lue_development_install
           lue_consume_source_directory: lue_consume_source
           lue_consume_build_directory: lue_consume_build
-          hpx_version: 1.9.1
+          hpx_version: 1.10.0
+          hpx_branch: v1.10.0
           hpx_source_directory: hpx_source
           hpx_build_directory: hpx_build
           hpx_install_directory: hpx_install
+          mdspan_tag: 9ceface91483775a6c74d06ebf717bbb2768452f  # 0.6.0
           mdspan_source_directory: mdspan_source
           mdspan_build_directory: mdspan_build
           mdspan_install_directory: mdspan_install
@@ -97,7 +99,7 @@ jobs:
             cmake_flags: "-D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos_version }}.0 -D CMAKE_POLICY_DEFAULT_CMP0148=OLD"
             cmake_preset: hpx_release_macos_node_configuration
             cmake_preset_file: ${{ env.lue_source_directory }}/CMakeHPXPresets.json
-            hpx_version: ${{ env.hpx_version }}
+            hpx_branch: ${{ env.hpx_branch }}
             source_directory: ${{ env.hpx_source_directory }}
             build_directory: ${{ env.hpx_build_directory }}
             install_directory: ${{ env.hpx_install_directory }}
@@ -107,7 +109,7 @@ jobs:
           with:
             cxx_compiler: ${{ matrix.compiler.cxx }}
             build_type: Release
-            mdspan_tag: 721efd8  # 20240305
+            mdspan_tag: ${{ env.mdspan_tag }}
             source_directory: ${{ env.mdspan_source_directory }}
             build_directory: ${{ env.mdspan_build_directory }}
             install_directory: ${{ env.mdspan_install_directory }}
@@ -141,7 +143,6 @@ jobs:
                       -B ${{ env.lue_build_directory }} \
                       --preset conan-release \
                       -D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos_version }}.0 \
-                      -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
                       -D LUE_BUILD_QA=TRUE \
                       -D LUE_QA_WITH_PYTHON_API=TRUE \
                       -D LUE_QA_WITH_TESTS=TRUE \
@@ -152,7 +153,7 @@ jobs:
                       -D LUE_FRAMEWORK_WITH_IMAGE_LAND=TRUE \
                       -D LUE_FRAMEWORK_WITH_PYTHON_API=TRUE \
                       -D HPX_ROOT=${{ env.hpx_install_directory }} \
-                      -D MDSPAN_ROOT=${{ env.mdspan_install_directory }} \
+                      -D mdspan_ROOT=${{ env.mdspan_install_directory }} \
                       -D Python_FIND_VIRTUALENV=ONLY
 
         - name: build
@@ -177,7 +178,10 @@ jobs:
               source env/bin/activate
 
               # Unit tests
-              ctest --test-dir ${{ env.lue_build_directory }} --output-on-failure
+              ctest \
+                  --test-dir ${{ env.lue_build_directory }} \
+                  --output-on-failure \
+                  --exclude-regex lue_py_image_land_python_test
 
               # Test of runtime targets
               ${{ env.lue_runtime_install_directory }}/bin/lue_translate --version
@@ -207,10 +211,9 @@ jobs:
                   -G "Ninja" \
                   -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
                   -D CMAKE_BUILD_TYPE=Release \
-                  -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
-                  -D LUE_ROOT=${{ env.lue_development_install_directory }} \
+                  -D lue_ROOT=${{ env.lue_development_install_directory }} \
                   -D HPX_ROOT=${{ env.hpx_install_directory }} \
-                  -D MDSPAN_ROOT=${{ env.mdspan_install_directory }}
+                  -D mdspan_ROOT=${{ env.mdspan_install_directory }}
               cmake --build ${{ env.lue_consume_build_directory }} --target all
 
               ${{ env.lue_consume_build_directory }}/lue_consume_data_model
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 8fde6d7f4..9a7af8243 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -25,8 +25,7 @@ jobs:
                 compiler:
                   - { name: "visual studio", c: cl, cxx: cl }
                 vs:
-                  # HPX can't be built with toolset 14.39 yet
-                  - { name: "Visual Studio Enterprise 2022", version: "17", msvc_toolset: "14.38" }
+                  - { name: "Visual Studio Enterprise 2022", version: "17", msvc_toolset: "14" }
                 python_version: ["3.9"]
                 architecture: ["amd64"]
             fail-fast: false
@@ -49,10 +48,12 @@ jobs:
           lue_development_install_directory: lue_development_install
           lue_consume_source_directory: lue_consume_source
           lue_consume_build_directory: lue_consume_build
-          hpx_version: 1.9.1
+          hpx_version: 1.10.0
+          hpx_branch: v1.10.0
           hpx_source_directory: hpx_source
           hpx_build_directory: hpx_build
           hpx_install_directory: hpx_install
+          mdspan_tag: 9ceface91483775a6c74d06ebf717bbb2768452f  # 0.6.0
           mdspan_source_directory: mdspan_source
           mdspan_build_directory: mdspan_build
           mdspan_install_directory: mdspan_install
@@ -108,10 +109,8 @@ jobs:
             build_type: Release
             cmake_preset: hpx_release_windows_node_configuration
             cmake_preset_file: ${{ env.lue_source_directory }}/CMakeHPXPresets.json
-            # Boost root is here: $CONDA_PREFIX/Library, but this results in a backslashes in a Windows path in the HPXConfig.cmake
-            # That is a bug in the HPX CMake scripts. Forward slashes should be used, e.g.: file(TO_CMAKE_PATH BOOST_ROOT HPX_BOOST_ROOT).
-            cmake_flags: "-D CMAKE_POLICY_DEFAULT_CMP0148=OLD -D BOOST_ROOT=C:/Users/runneradmin/miniconda3/envs/test/Library -D HWLOC_ROOT=$CONDA_PREFIX/Library -D HWLOC_LIBRARY=$CONDA_PREFIX/Library/lib/hwloc.lib"
-            hpx_version: ${{ env.hpx_version }}
+            cmake_flags: "-D Boost_ROOT=$CONDA_PREFIX/Library -D Hwloc_ROOT=$CONDA_PREFIX/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 }}
             install_directory: ${{ env.hpx_install_directory }}
@@ -121,7 +120,7 @@ jobs:
           with:
             cxx_compiler: ${{ matrix.compiler.cxx }}
             build_type: Release
-            mdspan_tag: 721efd8  # 20240305
+            mdspan_tag: ${{ env.mdspan_tag }}
             source_directory: ${{ env.mdspan_source_directory }}
             build_directory: ${{ env.mdspan_build_directory }}
             install_directory: ${{ env.mdspan_install_directory }}
@@ -152,7 +151,6 @@ jobs:
                       -S ${{ env.lue_source_directory }} \
                       -B ${{ env.lue_build_directory }} \
                       --preset conan-release \
-                      -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
                       -D LUE_BUILD_QA=TRUE \
                       -D LUE_QA_WITH_PYTHON_API=TRUE \
                       -D LUE_QA_WITH_TESTS=TRUE \
@@ -162,8 +160,10 @@ jobs:
                       -D LUE_DATA_MODEL_WITH_UTILITIES=TRUE \
                       -D LUE_FRAMEWORK_WITH_IMAGE_LAND=TRUE \
                       -D LUE_FRAMEWORK_WITH_PYTHON_API=TRUE \
-                      -D MDSPAN_ROOT=${{ env.mdspan_install_directory }} \
-                      -D HPX_ROOT=${{ env.hpx_install_directory }}
+                      -D mdspan_ROOT=${{ env.mdspan_install_directory }} \
+                      -D HPX_ROOT=${{ env.hpx_install_directory }} \
+                      -D Hwloc_ROOT=$CONDA_PREFIX/Library \
+                      -D Hwloc_LIBRARY=$CONDA_PREFIX/Library/lib/hwloc.lib
 
         - name: build
           run: |
@@ -185,7 +185,10 @@ jobs:
         - name: test
           run: |
               # Unit tests
-              ctest --test-dir ${{ env.lue_build_directory }} --output-on-failure
+              ctest \
+                  --test-dir ${{ env.lue_build_directory }} \
+                  --output-on-failure \
+                  --exclude-regex lue_py_image_land_python_test
 
               # Tests of runtime targets
               # Add location of dependencies installed with Conan to the runtime environment
@@ -222,10 +225,11 @@ jobs:
                   -G "Ninja" \
                   -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
                   -D CMAKE_BUILD_TYPE=Release \
-                  -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
-                  -D LUE_ROOT=${{ env.lue_development_install_directory }} \
+                  -D lue_ROOT=${{ env.lue_development_install_directory }} \
                   -D HPX_ROOT=${{ env.hpx_install_directory }} \
-                  -D MDSPAN_ROOT=${{ env.mdspan_install_directory }}
+                  -D Hwloc_ROOT=$CONDA_PREFIX/Library \
+                  -D Hwloc_LIBRARY=$CONDA_PREFIX/Library/lib/hwloc.lib \
+                  -D mdspan_ROOT=${{ env.mdspan_install_directory }}
               cmake --build ${{ env.lue_consume_build_directory }} --target all
 
               export PATH="${{ env.lue_development_install_directory }}/bin:${{ env.hpx_install_directory }}/bin:$PATH"
diff --git a/environment/cmake/LueConfiguration.cmake b/environment/cmake/LueConfiguration.cmake
index 734b49190..e276cc8bf 100644
--- a/environment/cmake/LueConfiguration.cmake
+++ b/environment/cmake/LueConfiguration.cmake
@@ -279,7 +279,7 @@ endif()
 if(LUE_MDSPAN_REQUIRED)
     FetchContent_Declare(mdspan
         GIT_REPOSITORY https://github.com/kokkos/mdspan.git
-        GIT_TAG 721efd80b222b2c2c472fc7cae210c66cac194d6  # 20240305
+        GIT_TAG 9ceface91483775a6c74d06ebf717bbb2768452f  # 0.6.0
         SYSTEM
         FIND_PACKAGE_ARGS
     )
@@ -472,6 +472,7 @@ if(LUE_HPX_REQUIRED)
                 list(APPEND hpx_versions_to_try ${LUE_HPX_VERSION})
             else()
                 # Try these versions in turn
+                list(APPEND hpx_versions_to_try v1.10.0)
                 list(APPEND hpx_versions_to_try v1.9.1)
                 list(APPEND hpx_versions_to_try v1.9.0)
             endif()
diff --git a/environment/conda/bld.bat b/environment/conda/bld.bat
index 1a21d2f43..324677a5b 100644
--- a/environment/conda/bld.bat
+++ b/environment/conda/bld.bat
@@ -39,7 +39,6 @@ set CMAKE_PREFIX_PATH=build
 cmake --preset conan-release ^
     %CMAKE_ARGS% ^
     -D CMAKE_INSTALL_LIBDIR=lib ^
-    -D CMAKE_POLICY_DEFAULT_CMP0144=NEW ^
     -D LUE_INSTALL_PYTHON_PACKAGE_DIR="%SP_DIR%/lue" ^
     -D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE ^
     -D LUE_DATA_MODEL_WITH_UTILITIES=TRUE ^
diff --git a/environment/conda/build.sh b/environment/conda/build.sh
index 27b6add18..4c3427c6b 100644
--- a/environment/conda/build.sh
+++ b/environment/conda/build.sh
@@ -24,7 +24,6 @@ LUE_CONAN_PACKAGES="imgui" conan install . \
 CMAKE_PREFIX_PATH=build \
     cmake --preset conan-release \
         ${CMAKE_ARGS} \
-        -D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
         -D LUE_INSTALL_PYTHON_PACKAGE_DIR="${SP_DIR}/lue" \
         -D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE \
         -D LUE_DATA_MODEL_WITH_UTILITIES=TRUE \
diff --git a/source/framework/core/include/lue/framework/core/span.hpp b/source/framework/core/include/lue/framework/core/span.hpp
index 2f55d50b5..e788db2a1 100644
--- a/source/framework/core/include/lue/framework/core/span.hpp
+++ b/source/framework/core/include/lue/framework/core/span.hpp
@@ -1,19 +1,21 @@
 #pragma once
 #include "lue/framework/core/define.hpp"
-#include <mdspan/mdspan.hpp>
+#include <experimental/mdspan>
 
 
 namespace lue {
 
     template<Rank rank>
-    using DynamicExtents = Kokkos::dextents<Index, rank>;
+    using DynamicExtents = std::experimental::dextents<Index, rank>;
 
     template<typename Element, Rank rank>
-    using DynamicSpan = Kokkos::mdspan<Element, DynamicExtents<rank>, Kokkos::layout_right>;
+    using DynamicSpan =
+        std::experimental::mdspan<Element, DynamicExtents<rank>, std::experimental::layout_right>;
 
     template<typename Element, Rank rank>
-    using DynamicSubspan = Kokkos::mdspan<Element, DynamicExtents<rank>, Kokkos::layout_stride>;
+    using DynamicSubspan =
+        std::experimental::mdspan<Element, DynamicExtents<rank>, std::experimental::layout_stride>;
 
-    using Kokkos::submdspan;
+    using std::experimental::submdspan;
 
 }  // namespace lue


Test patch:
diff --git a/source/framework/core/test/span_test.cpp b/source/framework/core/test/span_test.cpp
index 6119c4f28..3f788f4a6 100644
--- a/source/framework/core/test/span_test.cpp
+++ b/source/framework/core/test/span_test.cpp
@@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(dynamic_span_test)
 
     // Select a single row
     {
-        auto const row = lue::submdspan(raster, 3, Kokkos::full_extent);
+        auto const row = lue::submdspan(raster, 3, std::experimental::full_extent);
         BOOST_CHECK_EQUAL(row.rank(), 1);
         BOOST_REQUIRE_EQUAL(row.extent(0), nr_cols);
         BOOST_CHECK_EQUAL(row(0), idx(3, 0));
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(dynamic_span_test)
 
     // Select a single column
     {
-        auto const col = lue::submdspan(raster, Kokkos::full_extent, 4);
+        auto const col = lue::submdspan(raster, std::experimental::full_extent, 4);
         BOOST_CHECK_EQUAL(col.rank(), 1);
         BOOST_REQUIRE_EQUAL(col.extent(0), nr_rows);
         BOOST_CHECK_EQUAL(col(0), idx(0, 4));
diff --git a/source/framework/python/test/algorithm/routing_operation/first_n_test.py b/source/framework/python/test/algorithm/routing_operation/first_n_test.py
index 12104909c..84e0a84ed 100644
--- a/source/framework/python/test/algorithm/routing_operation/first_n_test.py
+++ b/source/framework/python/test/algorithm/routing_operation/first_n_test.py
@@ -25,4 +25,7 @@ def test_overloads(self):
             zones = lfr.create_array(array_shape, zone_dtype, fill_zone)
             route = lfr.decreasing_order(zones, values)
 
-            lfr.first_n(route, max_nr_cells)
+            # TODO
+            # RuntimeError: this promise has no valid shared state: HPX(no_state)
+            # https://github.com/computationalgeography/lue/issues/629
+            # lfr.first_n(route, max_nr_cells)