Skip to content

Commit

Permalink
Merge branch 'gh542'
Browse files Browse the repository at this point in the history
  • Loading branch information
kordejong committed Mar 29, 2024
2 parents 9bcf116 + c89907d commit 547acad
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- os: "ubuntu-22.04"
target-platform: linux-64
conda-bld-dir: "/home/runner/miniconda3/envs/test/conda-bld/linux-64/"
- os: "windows-2019"
- os: "windows-2022"
target-platform: win-64
conda-bld-dir: "C:/Users/runneradmin/miniconda3/envs/test/conda-bld/win-64/"
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
# 'msvc', 'qcc', 'sun-cc'
- { name: gcc , version: 9, c: gcc-9 , cxx: g++-9 , package: g++-9 }
- { name: gcc , version: 12, c: gcc-12 , cxx: g++-12 , package: g++-12 }
- { name: clang, version: 11, c: clang-11, cxx: clang++-11, package: clang-11 }
- { name: clang, version: 15, c: clang-15, cxx: clang++-15, package: clang-15 }
fail-fast: false

Expand Down Expand Up @@ -115,7 +114,7 @@ jobs:
with:
cxx_compiler: ${{ matrix.compiler.cxx }}
build_type: Release
mdspan_tag: a799088 # 20191010
mdspan_tag: 721efd8 # 20240305
source_directory: ${{ env.mdspan_source_directory }}
build_directory: ${{ env.mdspan_build_directory }}
install_directory: ${{ env.mdspan_install_directory }}
Expand Down Expand Up @@ -201,6 +200,7 @@ jobs:
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_POLICY_DEFAULT_CMP0144=NEW \
-D FETCHCONTENT_QUIET=OFF \
-D LUE_ROOT=${{ env.lue_development_install_directory }} \
-D HPX_ROOT=${{ env.hpx_install_directory }} \
-D MDSPAN_ROOT=${{ env.mdspan_install_directory }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
with:
cxx_compiler: ${{ matrix.compiler.cxx }}
build_type: Release
mdspan_tag: a799088 # 20191010
mdspan_tag: 721efd8 # 20240305
source_directory: ${{ env.mdspan_source_directory }}
build_directory: ${{ env.mdspan_build_directory }}
install_directory: ${{ env.mdspan_install_directory }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
with:
cxx_compiler: ${{ matrix.compiler.cxx }}
build_type: Release
mdspan_tag: a799088 # 20191010
mdspan_tag: 721efd8 # 20240305
source_directory: ${{ env.mdspan_source_directory }}
build_directory: ${{ env.mdspan_build_directory }}
install_directory: ${{ env.mdspan_install_directory }}
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def requirements(self):
self.requires("docopt.cpp/[>=0.6.2]")

if install_conan_package("fmt"):
self.requires("fmt/[>=8.1.1 <10]")
self.requires("fmt/[>=10]")

# 20230829 Conan package for more recent versions seem broken
# https://github.com/conan-io/conan-center-index/issues/17830
Expand Down
2 changes: 1 addition & 1 deletion environment/cmake/Lue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ useCompilerCache()
include(FetchContent)
include(GenerateExportHeader)

set(LUE_CXX_STANDARD 17)
set(LUE_CXX_STANDARD 20)

# Handle configuration and 3rd party libraries and tools, and ...
include(LueConfiguration)
Expand Down
10 changes: 5 additions & 5 deletions environment/cmake/LueConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ endif()


if(LUE_MDSPAN_REQUIRED)
FetchContent_Declare(MDSpan
FetchContent_Declare(mdspan
GIT_REPOSITORY https://github.com/kokkos/mdspan.git
GIT_TAG a7990884f090365787a90cdc12e689822d642c65 # 20191010
GIT_TAG 721efd80b222b2c2c472fc7cae210c66cac194d6 # 20240305
SYSTEM
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(MDSpan)
FetchContent_MakeAvailable(mdspan)
endif()


Expand Down Expand Up @@ -616,9 +616,9 @@ if(LUE_FMT_REQUIRED)
set(FMT_INSTALL ON)
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG a33701196adfad74917046096bf5a2aa0ab0bb50 # 9.1.0
GIT_TAG e69e5f977d458f2650bb346dadf2ad30c5320281 # 10.2.1
SYSTEM
FIND_PACKAGE_ARGS
FIND_PACKAGE_ARGS 10
)
FetchContent_MakeAvailable(fmt)
endif()
Expand Down
6 changes: 3 additions & 3 deletions environment/cmake/lue-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ if(LUE_BOOST_REQUIRED)
endif()

if(LUE_FMT_REQUIRED)
find_dependency(fmt)
find_dependency(fmt 10)
endif()

if(LUE_HDF5_REQUIRED)
find_dependency(HDF5)
endif()

if(LUE_HPX_REQUIRED)
find_dependency(HPX)
find_dependency(HPX 1.9)
endif()

if(LUE_MDSPAN_REQUIRED)
find_dependency(MDSpan)
find_dependency(mdspan)
endif()


Expand Down
20 changes: 10 additions & 10 deletions environment/conda/bld.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
echo on

mkdir build
if errorlevel 1 exit 1
if errorlevel 1 exit /b 1

%PYTHON% environment/script/write_conan_profile.py %CXX% host_profile
if errorlevel 1 exit 1
if errorlevel 1 exit /b 1

%PYTHON% environment/script/write_conan_profile.py %CXX% build_profile
if errorlevel 1 exit 1
if errorlevel 1 exit /b 1

set LUE_CONAN_PACKAGES=imgui

Expand All @@ -16,7 +16,7 @@ conan install . ^
--profile:build=build_profile ^
--build=missing ^
--output-folder=build
if errorlevel 1 exit 1
if errorlevel 1 exit /b 1

:: Unset CMAKE_GENERATOR_PLATFORM. The platform is already specified in Conan's preset. Otherwise:
:: Generator
Expand All @@ -37,7 +37,7 @@ set CMAKE_GENERATOR_TOOLSET=
set CMAKE_PREFIX_PATH=build

cmake --preset conan-release ^
-D CMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^
%CMAKE_ARGS% ^
-D CMAKE_INSTALL_LIBDIR=lib ^
-D LUE_INSTALL_PYTHON_PACKAGE_DIR="%SP_DIR%/lue" ^
-D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE ^
Expand All @@ -49,10 +49,10 @@ cmake --preset conan-release ^
-D LUE_FRAMEWORK_WITH_PYTHON_API=TRUE ^
-D HPX_IGNORE_COMPILER_COMPATIBILITY=TRUE ^
-D Python3_EXECUTABLE="%PYTHON%"
if errorlevel 1 exit 1
if errorlevel 1 exit /b 1

cmake --build build --target all
if errorlevel 1 exit 1
cmake --build build --config Release --target all
if errorlevel 1 exit /b 1

cmake --install build --component lue_runtime
if errorlevel 1 exit 1
cmake --install build --config Release --component lue_runtime
if errorlevel 1 exit /b 1
5 changes: 3 additions & 2 deletions environment/conda/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -e


mkdir build

if [[ $target_platform == osx* ]]; then
Expand Down Expand Up @@ -34,5 +35,5 @@ CMAKE_PREFIX_PATH=build \
-D HPX_IGNORE_COMPILER_COMPATIBILITY=TRUE \
-D Python3_EXECUTABLE="${PYTHON}"

cmake --build build --target all
cmake --install build --component lue_runtime
cmake --build build --config Release --target all
cmake --install build --config Release --component lue_runtime
20 changes: 4 additions & 16 deletions environment/conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# Keep in sync with https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/main/recipe/conda_build_config.yaml
# Except for: numpy, python
c_compiler:
- vs2019 # [win and x86_64]
- vs2022 # [win and arm64]
cxx_compiler:
- vs2019 # [win and x86_64]
- vs2022 # [win and arm64]
fmt:
- 10
hdf5:
- 1.14.3
libgdal:
- 3.8
python:
- 3.10
c_compiler: # [win]
- vs2022 # [win]
cxx_compiler: # [win]
- vs2022 # [win]
8 changes: 4 additions & 4 deletions environment/script/write_conan_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def gcc_settings(compiler_filename):
Return a dictionary with the GCC compiler settings
"""
compiler = "gcc"
compiler_cppstd = "17"
compiler_cppstd = "20"
compiler_libcxx = "libstdc++11"
compiler_version = gcc_version(compiler_filename)

Expand All @@ -187,7 +187,7 @@ def apple_clang_settings(compiler_filename):
Return a dictionary with the Apple Clang compiler settings
"""
compiler = "apple-clang"
compiler_cppstd = "17"
compiler_cppstd = "20"
compiler_libcxx = "libc++"
compiler_version = clang_version(compiler_filename)

Expand All @@ -204,7 +204,7 @@ def clang_settings(compiler_filename):
Return a dictionary with the Clang compiler settings
"""
compiler = "clang"
compiler_cppstd = "17"
compiler_cppstd = "20"
compiler_libcxx = "libstdc++11"
compiler_version = clang_version(compiler_filename)

Expand All @@ -221,7 +221,7 @@ def msvc_settings(compiler_filename):
Return a dictionary with the MSVC compiler settings
"""
compiler = "msvc"
compiler_cppstd = "17"
compiler_cppstd = "20"
compiler_version = msvc_version(compiler_filename)
compiler_runtime = "dynamic"

Expand Down
2 changes: 1 addition & 1 deletion source/framework/core/include/lue/framework/core/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ namespace lue {
// lue_hpx_assert(_span.size() == _elements.size());
// lue_hpx_assert(_span.data_handle() == _elements.data());
lue_hpx_assert(static_cast<Count>(_span.size()) == static_cast<Count>(_elements.size()));
lue_hpx_assert(_span.data() == _elements.data());
lue_hpx_assert(_span.data_handle() == _elements.data());
}


Expand Down
89 changes: 6 additions & 83 deletions source/framework/core/include/lue/framework/core/span.hpp
Original file line number Diff line number Diff line change
@@ -1,96 +1,19 @@
#pragma once
#include "lue/framework/core/define.hpp"
#include <boost/predef.h>
#include <experimental/mdspan>
#include <mdspan/mdspan.hpp>


namespace lue {
namespace detail {

// TODO The code that used mdspan has been ported to a much more recent version, but
// since MSV 2019 can't handle it, we have back-ported the code to the older
// version again. Once we can leave MSVS 2019 behind, we can use the newer
// code again. Currently, we only need MSVS 2019 for building the Conda package.
// Once conda-forge is on MSVS 2022 we can migrate as well.

// template<Rank rank>
// using DynamicExtents = std::experimental::dextents<Index, rank>;


// -----------------------------------------------------------------------------
template<Rank rank>
class RankToDynamicExtents;


template<>
class RankToDynamicExtents<1>
{

public:

using Type = std::experimental::extents<std::experimental::dynamic_extent>;
};


template<>
class RankToDynamicExtents<2>
{

public:

using Type = std::experimental::
extents<std::experimental::dynamic_extent, std::experimental::dynamic_extent>;
};


template<>
class RankToDynamicExtents<3>
{

public:

using Type = std::experimental::extents<
std::experimental::dynamic_extent,
std::experimental::dynamic_extent,
std::experimental::dynamic_extent>;
};

template<Rank rank>
using DynamicExtents = typename RankToDynamicExtents<rank>::Type;

} // namespace detail


// template<typename Element, Rank rank>
// using DynamicSpan =
// std::experimental::mdspan<Element, detail::DynamicExtents<rank>, std::experimental::layout_right>;
template<Rank rank>
using DynamicExtents = Kokkos::dextents<Index, rank>;

template<typename Element, Rank rank>
using DynamicSpan = std::experimental::
basic_mdspan<Element, detail::DynamicExtents<rank>, std::experimental::layout_right>;

// template<typename Element, Rank rank>
// using DynamicSubspan =
// std::experimental::mdspan<Element, detail::DynamicExtents<rank>, std::experimental::layout_stride>;
using DynamicSpan = Kokkos::mdspan<Element, DynamicExtents<rank>, Kokkos::layout_right>;

template<typename Element, Rank rank>
using DynamicSubspan = std::experimental::
basic_mdspan<Element, detail::DynamicExtents<rank>, std::experimental::layout_stride<-1, 1>>;
using DynamicSubspan = Kokkos::mdspan<Element, DynamicExtents<rank>, Kokkos::layout_stride>;

// using std::experimental::submdspan;

using std::experimental::subspan;
using Kokkos::submdspan;

} // namespace lue


#define submdspan subspan


// namespace std::experimental {
//
// using std::experimental::all;
//
// }

#define full_extent all
4 changes: 2 additions & 2 deletions source/framework/core/test/span_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(dynamic_span_test)

// Select a single row
{
auto const row = lue::submdspan(raster, 3, std::experimental::full_extent);
auto const row = lue::submdspan(raster, 3, Kokkos::full_extent);
BOOST_CHECK_EQUAL(row.rank(), 1);
BOOST_REQUIRE_EQUAL(row.extent(0), nr_cols);
BOOST_CHECK_EQUAL(row(0), idx(3, 0));
Expand All @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(dynamic_span_test)

// Select a single column
{
auto const col = lue::submdspan(raster, std::experimental::full_extent, 4);
auto const col = lue::submdspan(raster, Kokkos::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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ namespace lue {
// lue_hpx_assert(_span.size() == _elements.size());
// lue_hpx_assert(_span.data_handle() == _elements.data());
lue_hpx_assert(static_cast<Count>(_span.size()) == static_cast<Count>(_elements.size()));
lue_hpx_assert(_span.data() == _elements.data());
lue_hpx_assert(_span.data_handle() == _elements.data());
}


Expand Down
Loading

0 comments on commit 547acad

Please sign in to comment.