``MDRangePolicy`` ================= .. role:: cpp(code) :language: cpp Header File: ```` Usage ----- .. code-block:: cpp Kokkos::MDRangePolicy<..., Rank, ...>(begin, end) Kokkos::MDRangePolicy<..., Rank, ...>(Space, begin, end) Kokkos::MDRangePolicy<..., Rank, ...>(begin, end, tiling) Kokkos::MDRangePolicy<..., Rank, ...>(Space, begin, end, tiling) ``MDRangePolicy`` defines an execution policy for a multidimensional iteration space starting at a ``begin`` tuple and going to ``end`` with an open interval. The iteration space will be tiled, and the user can optionally provide tiling sizes. Interface --------- .. code-block:: cpp template class Kokkos::MDRangePolicy; Parameters ---------- General Template Arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~ Valid template arguments for ``MDRangePolicy`` are described `here <../Execution-Policies.html#common-arguments-for-all-execution-policies>`_ Required Arguments Specific to MDRangePolicy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: cpp template class Kokkos::Rank; * Determines the rank of the index space as well as in which order to iterate over the tiles and how to iterate within the tiles. ``outer`` and ``inner`` can be ``Kokkos::Iterate::Default``, ``Kokkos::Iterate::Left``, or ``Kokkos::Iterate::Right``. Public Class Members -------------------- Constructors ~~~~~~~~~~~~ .. cpp:function:: MDRangePolicy() * Default Constructor uninitialized policy. .. cpp:function:: MDRangePolicy(const Kokkos::Array& begin, const Kokkos::Array& end) * Provide a start and end index. .. cpp:function:: MDRangePolicy(const Kokkos::Array& begin, const Kokkos::Array& end, const Kokkos::Array& tiling) * Provide a start and end index as well as the tiling dimensions. .. cpp:function:: template MDRangePolicy(const std::initializer_list& begin, const std::initializer_list& end) * Provide a start and end index. The length of the lists must match the rank of the policy. .. cpp:function:: template MDRangePolicy(const std::initializer_list& begin, const std::initializer_list& end, std::initializer_list& tiling) * Provide a start and end index as well as the tiling dimensions. The length of the lists must match the rank of the policy. CTAD Constructors (since 4.3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: cpp DefaultExecutionSpace des; SomeExecutionSpace ses; // different from DefaultExecutionSpace // Deduces to MDRangePolicy> MDRangePolicy pl0({0, 0, 0}, {4, 5, 10}}; MDRangePolicy pl1({0, 0, 0}, {4, 5, 10}, {3, 3, 3}}; // Deduces to MDRangePolicy> MDRangePolicy pl4(ses, {0, 0, 0}, {4, 5, 10}}; MDRangePolicy pl5(ses, {0, 0, 0}, {4, 5, 10}, {3, 3, 3}}; int cbegin[3]; int cend[3]; int64_t ctiling[3]; // Deduces to MDRangePolicy> MDRangePolicy pc0(cbegin, cend); MDRangePolicy pc1(cbegin, cend, ctiling); MDRangePolicy pc2(des, cbegin, cend); MDRangePolicy pc3(des, cbegin, cend, ctiling); // Deduces to MDRangePolicy> MDRangePolicy pc4(ses, cbegin, cend); MDRangePolicy pc5(ses, cbegin, cend, ctiling); Array abegin; Array aend; Array atiling; // Deduces to MDRangePolicy> MDRangePolicy pa0(abegin, aend); MDRangePolicy pa1(abegin, aend, atiling); MDRangePolicy pa2(des, abegin, aend); MDRangePolicy pa3(des, abegin, aend, atiling); // Deduces to MDRangePolicy> MDRangePolicy pa4(ses, abegin, aend); MDRangePolicy pa5(ses, abegin, aend, atiling); Member Functions ^^^^^^^^^^^^^^^^ .. cpp:function:: tile_type tile_size_recommended() const * Returns a ``Kokkos::Array`` type containing per-rank tile sizes that ``MDRangePolicy`` internally uses by default. The default tile sizes are static and are set based on the specified backend. .. note:: ``tile_size_recommended()`` available since Kokkos 4.5 .. cpp:function:: int max_total_tile_size() const * Returns a value that represents the upper limit for the product of all tile sizes. .. note:: ``max_total_tile_size()`` available since Kokkos 4.5 Notes ^^^^^ * The start index must not be greater than the matching end index for all ranks. * The begin and end array ranks must match. * The tiling array rank must be less than or equal to the begin/end array rank. Examples -------- .. code-block:: cpp MDRangePolicy> policy_1({0,0,0},{N0,N1,N2}); MDRangePolicy> policy_2({5,5,5},{N0-5,N1-5,N2-5},{T0,T1,T2});