Skip to content

Commit

Permalink
Rename ddc::ddc_detail into ddc::detail (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau authored Apr 20, 2023
1 parent c2a8d3a commit 50aed6d
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 186 deletions.
8 changes: 4 additions & 4 deletions include/ddc/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ class Chunk<ElementType, DiscreteDomain<DDims...>, Allocator>
constexpr auto allocation_kokkos_view()
{
auto s = this->allocation_mdspan();
auto kokkos_layout = ddc_detail::build_kokkos_layout(
auto kokkos_layout = detail::build_kokkos_layout(
s.extents(),
s.mapping(),
std::make_index_sequence<sizeof...(DDims)> {});
return Kokkos::View<
ddc_detail::mdspan_to_kokkos_element_t<ElementType, sizeof...(DDims)>,
detail::mdspan_to_kokkos_element_t<ElementType, sizeof...(DDims)>,
decltype(kokkos_layout),
typename Allocator::memory_space>(s.data(), kokkos_layout);
}
Expand All @@ -273,12 +273,12 @@ class Chunk<ElementType, DiscreteDomain<DDims...>, Allocator>
constexpr auto allocation_kokkos_view() const
{
auto s = this->allocation_mdspan();
auto kokkos_layout = ddc_detail::build_kokkos_layout(
auto kokkos_layout = detail::build_kokkos_layout(
s.extents(),
s.mapping(),
std::make_index_sequence<sizeof...(DDims)> {});
return Kokkos::View<
ddc_detail::mdspan_to_kokkos_element_t<const ElementType, sizeof...(DDims)>,
detail::mdspan_to_kokkos_element_t<const ElementType, sizeof...(DDims)>,
decltype(kokkos_layout),
typename Allocator::memory_space>(s.data(), kokkos_layout);
}
Expand Down
8 changes: 4 additions & 4 deletions include/ddc/chunk_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ class ChunkCommon<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy>
constexpr DiscreteVector<DDims...> extents() const noexcept
{
return DiscreteVector<DDims...>(
(m_internal_mdspan.extent(type_seq_rank_v<DDims, ddc_detail::TypeSeq<DDims...>>)
(m_internal_mdspan.extent(type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>)
- front<DDims>(m_domain).uid())...);
}

template <class QueryDDim>
constexpr size_type extent() const noexcept
{
return m_internal_mdspan.extent(type_seq_rank_v<QueryDDim, ddc_detail::TypeSeq<DDims...>>)
return m_internal_mdspan.extent(type_seq_rank_v<QueryDDim, detail::TypeSeq<DDims...>>)
- front<QueryDDim>(m_domain).uid();
}

Expand Down Expand Up @@ -209,7 +209,7 @@ class ChunkCommon<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy>
template <class QueryDDim>
constexpr size_type stride() const
{
return m_internal_mdspan.stride(type_seq_rank_v<QueryDDim, ddc_detail::TypeSeq<DDims...>>);
return m_internal_mdspan.stride(type_seq_rank_v<QueryDDim, detail::TypeSeq<DDims...>>);
}

/** Provide access to the domain on which this chunk is defined
Expand Down Expand Up @@ -261,7 +261,7 @@ class ChunkCommon<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy>

extents_type extents_s((front<DDims>(domain) + ddc::extents<DDims>(domain)).uid()...);
std::array<std::size_t, sizeof...(DDims)> strides_s {
mapping_r.stride(type_seq_rank_v<DDims, ddc_detail::TypeSeq<DDims...>>)...};
mapping_r.stride(type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>)...};
stdex::layout_stride::mapping<extents_type> mapping_s(extents_s, strides_s);

// Pointer offset to handle non-zero indexing
Expand Down
18 changes: 9 additions & 9 deletions include/ddc/chunk_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
auto get_slicer_for(DiscreteElement<ODDims...> const& c) const
{
DDC_IF_NVCC_THEN_PUSH_AND_SUPPRESS(implicit_return_from_non_void_function)
if constexpr (in_tags_v<QueryDDim, ddc_detail::TypeSeq<ODDims...>>) {
if constexpr (in_tags_v<QueryDDim, detail::TypeSeq<ODDims...>>) {
return (uid<QueryDDim>(c) - front<QueryDDim>(this->m_domain).uid());
} else {
return std::experimental::full_extent;
Expand All @@ -108,7 +108,7 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
auto get_slicer_for(DiscreteDomain<ODDims...> const& c) const
{
DDC_IF_NVCC_THEN_PUSH_AND_SUPPRESS(implicit_return_from_non_void_function)
if constexpr (in_tags_v<QueryDDim, ddc_detail::TypeSeq<ODDims...>>) {
if constexpr (in_tags_v<QueryDDim, detail::TypeSeq<ODDims...>>) {
return std::pair<std::size_t, std::size_t>(
front<QueryDDim>(c) - front<QueryDDim>(this->m_domain),
back<QueryDDim>(c) + 1 - front<QueryDDim>(this->m_domain));
Expand Down Expand Up @@ -185,7 +185,7 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
namespace stdex = std::experimental;
extents_type extents_s((front<DDims>(domain) + extents<DDims>(domain)).uid()...);
std::array<std::size_t, sizeof...(DDims)> strides_s {allocation_mdspan.mapping().stride(
type_seq_rank_v<DDims, ddc_detail::TypeSeq<DDims...>>)...};
type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>)...};
stdex::layout_stride::mapping<extents_type> mapping_s(extents_s, strides_s);
this->m_internal_mdspan = internal_mdspan_type(
allocation_mdspan.data() - mapping_s(front<DDims>(domain).uid()...),
Expand All @@ -200,7 +200,7 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
template <class KokkosView, class = std::enable_if_t<Kokkos::is_view<KokkosView>::value>>
constexpr ChunkSpan(KokkosView const& view, mdomain_type const& domain) noexcept
: ChunkSpan(
ddc_detail::build_mdspan(view, std::make_index_sequence<sizeof...(DDims)> {}),
detail::build_mdspan(view, std::make_index_sequence<sizeof...(DDims)> {}),
domain)
{
}
Expand All @@ -224,7 +224,7 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
{
auto subview = std::experimental::
submdspan(allocation_mdspan(), get_slicer_for<DDims>(slice_spec)...);
using ddc_detail::TypeSeq;
using detail::TypeSeq;
using selected_meshes = type_seq_remove_t<TypeSeq<DDims...>, TypeSeq<QueryDDims...>>;
return ChunkSpan<
ElementType,
Expand Down Expand Up @@ -301,12 +301,12 @@ class ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, Memo
constexpr auto allocation_kokkos_view() const
{
auto s = this->allocation_mdspan();
auto kokkos_layout = ddc_detail::build_kokkos_layout(
auto kokkos_layout = detail::build_kokkos_layout(
s.extents(),
s.mapping(),
std::make_index_sequence<sizeof...(DDims)> {});
return Kokkos::View<
ddc_detail::mdspan_to_kokkos_element_t<ElementType, sizeof...(DDims)>,
detail::mdspan_to_kokkos_element_t<ElementType, sizeof...(DDims)>,
decltype(kokkos_layout),
MemorySpace>(s.data(), kokkos_layout);
}
Expand All @@ -327,9 +327,9 @@ template <
class... DDims,
class = std::enable_if_t<Kokkos::is_view<KokkosView>::value>>
ChunkSpan(KokkosView const& view, DiscreteDomain<DDims...> domain) -> ChunkSpan<
ddc_detail::kokkos_to_mdspan_element_t<typename KokkosView::data_type>,
detail::kokkos_to_mdspan_element_t<typename KokkosView::data_type>,
DiscreteDomain<DDims...>,
ddc_detail::kokkos_to_mdspan_layout_t<typename KokkosView::array_layout>,
detail::kokkos_to_mdspan_layout_t<typename KokkosView::array_layout>,
typename KokkosView::memory_space>;

template <
Expand Down
2 changes: 1 addition & 1 deletion include/ddc/coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ using CoordinateElement = double;
* It is tagged by its dimensions.
*/
template <class... CDims>
using Coordinate = ddc_detail::TaggedVector<CoordinateElement, CDims...>;
using Coordinate = detail::TaggedVector<CoordinateElement, CDims...>;

} // namespace ddc
4 changes: 2 additions & 2 deletions include/ddc/detail/kokkos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "macros.hpp"

namespace ddc::ddc_detail {
namespace ddc::detail {

template <class T>
struct type_holder
Expand Down Expand Up @@ -156,4 +156,4 @@ auto build_mdspan(Kokkos::View<DataType, Properties...> const view, std::index_s
DDC_IF_NVCC_THEN_POP
}

} // namespace ddc::ddc_detail
} // namespace ddc::detail
Loading

0 comments on commit 50aed6d

Please sign in to comment.