Skip to content

Commit

Permalink
Merge branch 'ddc_sync' into 'main'
Browse files Browse the repository at this point in the history
ddc sync

See merge request gysela-developpers/gyselalibxx!641
  • Loading branch information
EmilyBourne committed Aug 2, 2024
1 parent 1f91259 commit c31617b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 35 deletions.
6 changes: 3 additions & 3 deletions src/collisions/collisions_dimensions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct ExtractRDim<Field<ElementType, IdxRange, Layout, MemSpace>>
std::is_same_v<MemSpace, Kokkos::DefaultExecutionSpace::memory_space>,
"The radial profile should be provided on the GPU");
static_assert(
(ddcHelper::type_seq_length_v<ddc::to_type_seq_t<IdxRange>>) > 1,
(ddc::type_seq_size_v<ddc::to_type_seq_t<IdxRange>>) > 1,
"The radial profile should not be defined on more than 1 dimensions.");
};

Expand Down Expand Up @@ -168,7 +168,7 @@ struct ExtractThetaDim<Field<ElementType, IdxRange, Layout, MemSpace>, GridR>
std::is_same_v<MemSpace, Kokkos::DefaultExecutionSpace::memory_space>,
"The poloidal profile should be provided on the GPU");
static_assert(
(ddcHelper::type_seq_length_v<ddc::to_type_seq_t<IdxRange>>) > 2,
(ddc::type_seq_size_v<ddc::to_type_seq_t<IdxRange>>) > 2,
"The poloidal profile should not be defined on more than 2 dimensions.");
};

Expand Down Expand Up @@ -209,7 +209,7 @@ template <class OrderedGrids, class... ExpectedGrids>
constexpr bool order_of_last_grids()
{
int n_real_dims = ((is_spoofed_dim_v<ExpectedGrids> ? 0 : 1) + ...);
int idx(ddcHelper::type_seq_length_v<OrderedGrids> - n_real_dims);
int idx(ddc::type_seq_size_v<OrderedGrids> - n_real_dims);
return ((check_dimension_location<ExpectedGrids, OrderedGrids>(idx)) && ...);
}

Expand Down
2 changes: 1 addition & 1 deletion src/data_types/derivative_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class DerivField<ElementType, ddc::DiscreteDomain<DDims...>, NDerivs, Allocator>
* direction is defined. This object is used internally to initialise the chunks.
*/
using physical_deriv_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<physical_deriv_dims>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<physical_deriv_dims>;

/// @brief The DiscreteDomain which describes the derivatives present on each chunk.
using discrete_deriv_domain_type = typename base_type::discrete_deriv_domain_type;
Expand Down
20 changes: 10 additions & 10 deletions src/data_types/derivative_field_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>

/// @brief The domain for the chunk excluding derivatives
using physical_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<physical_dims>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<physical_dims>;

/// @brief The DiscreteElement which describes the physical position where values are defined.
using physical_element_type = typename physical_domain_type::discrete_element_type;

/// @brief The DiscreteDomain which describes the derivatives present on each chunk.
using discrete_deriv_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<deriv_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<deriv_tags>;

/** @brief The DiscreteElement which describes the order of the derivatives in each dimension.
* (e.g. second-order derivative).
Expand All @@ -107,7 +107,7 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>
using discrete_deriv_vector_type = typename discrete_deriv_domain_type::mlength_type;

/// @brief The number of chunks which must be created to describe this object.
static constexpr int n_chunks = 1 << ddcHelper::type_seq_length_v<deriv_tags>;
static constexpr int n_chunks = 1 << ddc::type_seq_size_v<deriv_tags>;

template <class, class, int, class>
friend class DerivField;
Expand Down Expand Up @@ -313,7 +313,7 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>
// Get the types related to the implicit information
using remaining_deriv_tags = ddc::type_seq_remove_t<deriv_tags, provided_deriv_tags>;
using remaining_deriv_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<remaining_deriv_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<remaining_deriv_tags>;

// Find the domain of the derivatives (either provided or a domain containing only the 0-th derivative)
remaining_deriv_domain_type no_deriv_domain = detail::get_domain_from_element(
Expand Down Expand Up @@ -343,7 +343,7 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>
local_chunk(subview, full_domain);

// If necessary, slice off the derivative dimensions deduced implicitly
if constexpr (ddcHelper::type_seq_length_v<remaining_deriv_tags> == 0) {
if constexpr (ddc::type_seq_size_v<remaining_deriv_tags> == 0) {
return local_chunk;
} else {
return local_chunk[no_deriv_domain.front()];
Expand All @@ -369,25 +369,25 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>
using provided_deriv_tags = detail::deriv_sub_set_t<provided_tags>;
using provided_physical_tags = ddc::type_seq_remove_t<provided_tags, provided_deriv_tags>;
using provided_deriv_domain_type
= ddc::detail::convert_type_seq_to_discrete_domain<provided_deriv_tags>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<provided_deriv_tags>;
using provided_deriv_element_type =
typename provided_deriv_domain_type::discrete_element_type;

// Get the types related to the implicit information
using remaining_deriv_tags = ddc::type_seq_remove_t<deriv_tags, provided_deriv_tags>;
using remaining_deriv_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<remaining_deriv_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<remaining_deriv_tags>;
using remaining_deriv_element_type =
typename remaining_deriv_domain_type::discrete_element_type;

// Get the types related to the final chunk type
using sliced_tags = ddc::type_seq_merge_t<provided_physical_tags, deriv_tags>;
using sliced_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<sliced_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<sliced_tags>;
using sliced_element_type = typename sliced_domain_type::discrete_element_type;
using final_tags = ddc::type_seq_remove_t<ddc::detail::TypeSeq<DDims...>, sliced_tags>;
using final_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<final_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<final_tags>;

// Get the index of the relevant derivatives
provided_deriv_element_type requested_derivs(elem);
Expand Down Expand Up @@ -524,7 +524,7 @@ class DerivFieldCommon<ChunkType, ddc::DiscreteDomain<DDims...>>
using provided_deriv_tags = ddc::detail::TypeSeq<ODims...>;
using remaining_deriv_tags = ddc::type_seq_remove_t<deriv_tags, provided_deriv_tags>;
using remaining_deriv_domain_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<remaining_deriv_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<remaining_deriv_tags>;
using remaining_deriv_element_type =
typename remaining_deriv_domain_type::discrete_element_type;

Expand Down
18 changes: 9 additions & 9 deletions src/mpi_parallelisation/mpitransposealltoall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class MPITransposeAllToAll : public IMPITranspose<Layout1, Layout2>
using layout_2_mpi_dims = ddcHelper::
apply_template_to_type_seq_t<MPIDim, typename Layout2::distributed_type_seq>;
using layout_1_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<layout_1_mpi_dims>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<layout_1_mpi_dims>;
using layout_2_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<layout_2_mpi_dims>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<layout_2_mpi_dims>;

private:
int m_comm_size;
Expand Down Expand Up @@ -228,23 +228,23 @@ class MPITransposeAllToAll : public IMPITranspose<Layout1, Layout2>
// Get the index ranges of objects which will be distributed across processes
using scatter_idx_range_type = typename OutLayout::distributed_sub_idx_range;
// Get the index range of objects that are not distributed across processes
using batch_idx_range_type = ddc::detail::convert_type_seq_to_discrete_domain<batch_dims>;
using batch_idx_range_type = ddc::detail::convert_type_seq_to_discrete_domain_t<batch_dims>;
using gather_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<gather_mpi_dims>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<gather_mpi_dims>;
using scatter_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<scatter_mpi_dims>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<scatter_mpi_dims>;
// Get the index range containing MPI tags which can be used to describe the function input
using input_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<input_mpi_idx_range_tags>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<input_mpi_idx_range_tags>;
// Get the index range containing MPI tags which can be used to describe the function output
using output_mpi_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<output_mpi_idx_range_tags>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<output_mpi_idx_range_tags>;
// Get the index range that should be used when scattering data
using input_alltoall_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<input_alltoall_dim_order>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<input_alltoall_dim_order>;
// Get the index range that should be used when gathering data
using output_alltoall_idx_range_type
= ddc::detail::convert_type_seq_to_discrete_domain<output_alltoall_dim_order>;
= ddc::detail::convert_type_seq_to_discrete_domain_t<output_alltoall_dim_order>;

/*****************************************************************
* Build index ranges
Expand Down
2 changes: 1 addition & 1 deletion src/pde_solvers/fem_1d_poisson_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class FEM1DPoissonSolver
using RHSQuadTags = ddc::
type_seq_merge_t<typename base_type::batch_tags, ddc::detail::TypeSeq<GridPDEDimQ>>;

using RHSQuadratureIdxRange = ddc::detail::convert_type_seq_to_discrete_domain<RHSQuadTags>;
using RHSQuadratureIdxRange = ddc::detail::convert_type_seq_to_discrete_domain_t<RHSQuadTags>;

using RHSQuadratureIdx = typename RHSQuadratureIdxRange::discrete_element_type;

Expand Down
6 changes: 3 additions & 3 deletions src/pde_solvers/ipoisson_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IPoissonSolver<IdxRange<ODims...>, FullIdxRange, LayoutSpace, MemorySpace>

protected:
/// @brief Indicates whether the gradient is represented by a VectorFieldSpan or a ChunkSpan.
static constexpr bool using_vector_span = ddcHelper::type_seq_length_v<laplacian_tags> == 1;
static constexpr bool using_vector_span = ddc::type_seq_size_v<laplacian_tags> == 1;

public:
/// @brief The ChunkSpan type of the arguments to operator().
Expand All @@ -45,13 +45,13 @@ class IPoissonSolver<IdxRange<ODims...>, FullIdxRange, LayoutSpace, MemorySpace>

/// @brief The type of the derivative of @f$ \phi @f$.
using vector_field_type = std::conditional_t<
ddcHelper::type_seq_length_v<laplacian_tags> == 1,
ddc::type_seq_size_v<laplacian_tags> == 1,
field_type,
VectorFieldSpan<double, FullIdxRange, real_laplacian_tags, LayoutSpace, MemorySpace>>;

/// @brief The DiscreteDomain describing the batch dimensions.
using batch_idx_range_type =
typename ddc::detail::convert_type_seq_to_discrete_domain<batch_tags>;
typename ddc::detail::convert_type_seq_to_discrete_domain_t<batch_tags>;
/// @brief The DiscreteElement for indexing a batch dimension.
using batch_index_type = typename batch_idx_range_type::discrete_element_type;

Expand Down
7 changes: 0 additions & 7 deletions src/utils/ddc_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,6 @@ using device_t = on_memory_space_t<Kokkos::DefaultExecutionSpace::memory_space,


namespace ddcHelper {
/// A helper to determine the number of tags in a type sequence.
template <class TypeSeq>
constexpr std::size_t type_seq_length_v = std::numeric_limits<std::size_t>::max();

template <class... Tags>
constexpr std::size_t type_seq_length_v<ddc::detail::TypeSeq<Tags...>> = sizeof...(Tags);

/// A helper to get a type sequence by applying a template to a sequence of type tags.
template <template <class Tag> class Templ, class TypeSeq>
using apply_template_to_type_seq_t = typename detail::ApplyTemplateToTypeSeq<Templ, TypeSeq>::type;
Expand Down

0 comments on commit c31617b

Please sign in to comment.