Skip to content

Commit

Permalink
Sync DDC
Browse files Browse the repository at this point in the history
See merge request gysela-developpers/gyselalibxx!426

--------------------------------------------
  • Loading branch information
EmilyBourne committed Mar 28, 2024
1 parent b5aaf97 commit 279fc52
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 158 deletions.
1 change: 1 addition & 0 deletions vendor/ddc/.github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin || true
docker pull ghcr.io/cexa-project/ddc/doxygen || true
DOCKER_BUILDKIT=1 docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} \
Expand Down
5 changes: 3 additions & 2 deletions vendor/ddc/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set(DOXYGEN_ENUM_VALUES_PER_LINE 1)
set(DOXYGEN_EXAMPLE_PATH "${DDC_SOURCE_DIR}/examples")
set(DOXYGEN_EXPAND_ONLY_PREDEF YES)
set(DOXYGEN_EXTRACT_ALL YES)
set(DOXYGEN_EXCLUDE_SYMBOLS "detail" "details")
set(DOXYGEN_EXCLUDE_SYMBOLS "detail")
set(DOXYGEN_EXCLUDE_PATTERNS "*/experimental/*;*/detail/*")
set(DOXYGEN_EXTRACT_LOCAL_CLASSES YES)
set(DOXYGEN_FULL_PATH_NAMES NO)
set(DOXYGEN_GENERATE_TREEVIEW YES)
Expand All @@ -39,7 +40,7 @@ set(DOXYGEN_PREDEFINED "DOXYGEN_IGNORE")
set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/_template/logo.png")
set(DOXYGEN_PROJECT_NUMBER "${DDC_VERSION}")
set(DOXYGEN_QT_AUTOBRIEF YES)
set(DOXYGEN_RECURSIVE NO)
set(DOXYGEN_RECURSIVE YES)
set(DOXYGEN_SEARCHENGINE NO)
set(DOXYGEN_SHOW_FILES NO)
set(DOXYGEN_SHOW_INCLUDE_FILES NO)
Expand Down
1 change: 1 addition & 0 deletions vendor/ddc/include/ddc/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "ddc/chunk_common.hpp"
#include "ddc/chunk_span.hpp"
#include "ddc/chunk_traits.hpp"
#include "ddc/kokkos_allocator.hpp"
#include "ddc/parallel_deepcopy.hpp"

Expand Down
39 changes: 1 addition & 38 deletions vendor/ddc/include/ddc/chunk_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,12 @@

#include <Kokkos_Core.hpp>

#include "ddc/chunk_traits.hpp"
#include "ddc/detail/macros.hpp"
#include "ddc/discrete_domain.hpp"

namespace ddc {

template <class T>
inline constexpr bool enable_borrowed_chunk = false;

template <class T>
inline constexpr bool enable_chunk = false;

template <class T>
inline constexpr bool is_chunk_v = enable_chunk<std::remove_const_t<std::remove_reference_t<T>>>;

template <class T>
inline constexpr bool is_borrowed_chunk_v
= is_chunk_v<
T> && (std::is_lvalue_reference_v<T> || enable_borrowed_chunk<std::remove_cv_t<std::remove_reference_t<T>>>);

template <class T>
struct chunk_traits
{
static_assert(is_chunk_v<T>);
using value_type
= std::remove_cv_t<std::remove_pointer_t<decltype(std::declval<T>().data_handle())>>;
using pointer_type = decltype(std::declval<T>().data_handle());
using reference_type = decltype(*std::declval<T>().data_handle());
};

template <class T>
using chunk_value_t = typename chunk_traits<T>::value_type;

template <class T>
using chunk_pointer_t = typename chunk_traits<T>::pointer_type;

template <class T>
using chunk_reference_t = typename chunk_traits<T>::reference_type;

template <class T>
inline constexpr bool is_writable_chunk_v
= !std::is_const_v<std::remove_pointer_t<chunk_pointer_t<T>>>;

/** Access the domain (or subdomain) of a view
* @param[in] chunk the view whose domain to access
* @return the domain of view in the queried dimensions
Expand Down Expand Up @@ -351,5 +315,4 @@ class ChunkCommon<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy>
}
};


} // namespace ddc
49 changes: 49 additions & 0 deletions vendor/ddc/include/ddc/chunk_traits.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (C) The DDC development team, see COPYRIGHT.md file
//
// SPDX-License-Identifier: MIT

#pragma once

#include <type_traits>
#include <utility>

namespace ddc {

template <class T>
inline constexpr bool enable_borrowed_chunk = false;

template <class T>
inline constexpr bool enable_chunk = false;

template <class T>
inline constexpr bool is_chunk_v = enable_chunk<std::remove_const_t<std::remove_reference_t<T>>>;

template <class T>
inline constexpr bool is_borrowed_chunk_v
= is_chunk_v<
T> && (std::is_lvalue_reference_v<T> || enable_borrowed_chunk<std::remove_cv_t<std::remove_reference_t<T>>>);

template <class T>
struct chunk_traits
{
static_assert(is_chunk_v<T>);
using value_type
= std::remove_cv_t<std::remove_pointer_t<decltype(std::declval<T>().data_handle())>>;
using pointer_type = decltype(std::declval<T>().data_handle());
using reference_type = decltype(*std::declval<T>().data_handle());
};

template <class T>
using chunk_value_t = typename chunk_traits<T>::value_type;

template <class T>
using chunk_pointer_t = typename chunk_traits<T>::pointer_type;

template <class T>
using chunk_reference_t = typename chunk_traits<T>::reference_type;

template <class T>
inline constexpr bool is_writable_chunk_v
= !std::is_const_v<std::remove_pointer_t<chunk_pointer_t<T>>>;

} // namespace ddc
20 changes: 19 additions & 1 deletion vendor/ddc/include/ddc/coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

#pragma once

#include <type_traits>

#include "ddc/detail/tagged_vector.hpp"
#include "ddc/discrete_element.hpp"
#include "ddc/real_type.hpp"

namespace ddc {
Expand All @@ -22,9 +25,24 @@ using CoordinateElement = Real;
template <class... CDims>
using Coordinate = detail::TaggedVector<CoordinateElement, CDims...>;

template <class... DDim, std::enable_if_t<(sizeof...(DDim) > 1), int> = 0>
KOKKOS_FUNCTION Coordinate<typename DDim::continuous_dimension_type...> coordinate(
DiscreteElement<DDim...> const& c)
{
return Coordinate<typename DDim::continuous_dimension_type...>(
coordinate(DiscreteElement<DDim>(c))...);
}

// Gives access to the type of the coordinates of a discrete element
// Example usage : "using Coords = coordinate_of_t<DElem>;"
template <class T>
struct coordinate_of;
struct coordinate_of
{
static_assert(is_discrete_element_v<T>, "Parameter T must be of type DiscreteElement");
using type = decltype(coordinate(std::declval<T>()));
};

/// Helper type of \ref ddc::coordinate_of
template <class T>
using coordinate_of_t = typename coordinate_of<T>::type;

Expand Down
21 changes: 0 additions & 21 deletions vendor/ddc/include/ddc/coordinate_md.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/ddc/include/ddc/ddc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "ddc/aligned_allocator.hpp"
#include "ddc/chunk.hpp"
#include "ddc/chunk_span.hpp"
#include "ddc/chunk_traits.hpp"
#include "ddc/kokkos_allocator.hpp"

// Discretizations
#include "ddc/coordinate_md.hpp"
#include "ddc/discrete_domain.hpp"
#include "ddc/discrete_element.hpp"
#include "ddc/discrete_space.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <hip/hip_runtime.h>
#endif

namespace ddc {
namespace ddc::detail {

template <class DDim>
class DualDiscretization
Expand Down Expand Up @@ -80,4 +80,4 @@ class DualDiscretization
}
};

} // namespace ddc
} // namespace ddc::detail
14 changes: 7 additions & 7 deletions vendor/ddc/include/ddc/detail/tagged_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ template <class, class...>
class TaggedVector;

template <class T>
struct IsTaggedVector : std::false_type
struct is_tagged_vector : std::false_type
{
};

template <class ElementType, class... Tags>
struct IsTaggedVector<TaggedVector<ElementType, Tags...>> : std::true_type
struct is_tagged_vector<TaggedVector<ElementType, Tags...>> : std::true_type
{
};

template <class T>
inline constexpr bool is_tagged_vector_v = IsTaggedVector<T>::value;
inline constexpr bool is_tagged_vector_v = is_tagged_vector<T>::value;

template <class ElementType, class... Tags>
struct ToTypeSeq<TaggedVector<ElementType, Tags...>>
Expand Down Expand Up @@ -224,12 +224,12 @@ KOKKOS_FUNCTION constexpr auto const& take(


template <class T>
class ConversionOperators
class TaggedVectorConversionOperators
{
};

template <class ElementType, class Tag>
class ConversionOperators<TaggedVector<ElementType, Tag>>
class TaggedVectorConversionOperators<TaggedVector<ElementType, Tag>>
{
public:
KOKKOS_FUNCTION constexpr operator ElementType const &() const noexcept
Expand All @@ -244,9 +244,9 @@ class ConversionOperators<TaggedVector<ElementType, Tag>>
};

template <class ElementType, class... Tags>
class TaggedVector : public ConversionOperators<TaggedVector<ElementType, Tags...>>
class TaggedVector : public TaggedVectorConversionOperators<TaggedVector<ElementType, Tags...>>
{
friend class ConversionOperators<TaggedVector<ElementType, Tags...>>;
friend class TaggedVectorConversionOperators<TaggedVector<ElementType, Tags...>>;

using tags_seq = detail::TypeSeq<Tags...>;

Expand Down
6 changes: 3 additions & 3 deletions vendor/ddc/include/ddc/discrete_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ template <class... DDims>
class DiscreteDomain;

template <class T>
struct IsDiscreteDomain : std::false_type
struct is_discrete_domain : std::false_type
{
};

template <class... Tags>
struct IsDiscreteDomain<DiscreteDomain<Tags...>> : std::true_type
struct is_discrete_domain<DiscreteDomain<Tags...>> : std::true_type
{
};

template <class T>
inline constexpr bool is_discrete_domain_v = IsDiscreteDomain<T>::value;
inline constexpr bool is_discrete_domain_v = is_discrete_domain<T>::value;


namespace detail {
Expand Down
16 changes: 3 additions & 13 deletions vendor/ddc/include/ddc/discrete_element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <type_traits>
#include <utility>

#include "ddc/coordinate.hpp"
#include "ddc/detail/macros.hpp"
#include "ddc/detail/type_seq.hpp"
#include "ddc/discrete_vector.hpp"
Expand All @@ -21,17 +20,17 @@ template <class...>
class DiscreteElement;

template <class T>
struct IsDiscreteElement : std::false_type
struct is_discrete_element : std::false_type
{
};

template <class... Tags>
struct IsDiscreteElement<DiscreteElement<Tags...>> : std::true_type
struct is_discrete_element<DiscreteElement<Tags...>> : std::true_type
{
};

template <class T>
inline constexpr bool is_discrete_element_v = IsDiscreteElement<T>::value;
inline constexpr bool is_discrete_element_v = is_discrete_element<T>::value;


namespace detail {
Expand Down Expand Up @@ -443,13 +442,4 @@ KOKKOS_FUNCTION constexpr DiscreteVector<Tags...> operator-(
return DiscreteVector<Tags...>((uid<Tags>(lhs) - uid<Tags>(rhs))...);
}

// Gives access to the type of the coordinates of a discrete element
// Example usage : "using Coords = coordinate_of_t<DElem>;"
template <class... DDims>
struct coordinate_of<ddc::DiscreteElement<DDims...>>
{
// maybe a static_assert on DDims ?
using type = Coordinate<typename DDims::continuous_dimension_type...>;
};

} // namespace ddc
3 changes: 2 additions & 1 deletion vendor/ddc/include/ddc/discrete_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#include <Kokkos_Core.hpp>

#include "ddc/detail/dual_discretization.hpp"
#include "ddc/detail/macros.hpp"

#if defined(__CUDACC__)
#include <sstream>

Expand All @@ -29,7 +31,6 @@
#include <hip/hip_runtime.h>
#endif

#include "ddc/dual_discretization.hpp"

namespace ddc {

Expand Down
Loading

0 comments on commit 279fc52

Please sign in to comment.