alpaka
Abstraction Library for Parallel Kernel Acceleration
IdxBtZero.hpp
Go to the documentation of this file.
1 /* Copyright 2022 Axel Huebl, Benjamin Worpitz, Matthias Werner, Jan Stephan, Bernhard Manfred Gruber
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
9 #include "alpaka/idx/Traits.hpp"
10 #include "alpaka/vec/Vec.hpp"
11 
12 namespace alpaka
13 {
14  namespace bt
15  {
16  //! A zero block thread index provider.
17  template<typename TDim, typename TIdx>
18  class IdxBtZero : public concepts::Implements<ConceptIdxBt, IdxBtZero<TDim, TIdx>>
19  {
20  };
21  } // namespace bt
22 
23  namespace trait
24  {
25  //! The zero block thread index provider dimension get trait specialization.
26  template<typename TDim, typename TIdx>
27  struct DimType<bt::IdxBtZero<TDim, TIdx>>
28  {
29  using type = TDim;
30  };
31 
32  //! The zero block thread index provider block thread index get trait specialization.
33  template<typename TDim, typename TIdx>
34  struct GetIdx<bt::IdxBtZero<TDim, TIdx>, origin::Block, unit::Threads>
35  {
36  //! \return The index of the current thread in the block.
37  template<typename TWorkDiv>
38  ALPAKA_FN_HOST static auto getIdx(
39  bt::IdxBtZero<TDim, TIdx> const& /* idx */,
40  TWorkDiv const& /* workDiv */) -> Vec<TDim, TIdx>
41  {
42  return Vec<TDim, TIdx>::zeros();
43  }
44  };
45 
46  //! The zero block thread index idx type trait specialization.
47  template<typename TDim, typename TIdx>
48  struct IdxType<bt::IdxBtZero<TDim, TIdx>>
49  {
50  using type = TIdx;
51  };
52  } // namespace trait
53 } // namespace alpaka
ALPAKA_NO_HOST_ACC_WARNING static constexpr ALPAKA_FN_HOST_ACC auto zeros() -> Vec< TDim, TVal >
Zero value constructor.
Definition: Vec.hpp:126
A zero block thread index provider.
Definition: IdxBtZero.hpp:19
#define ALPAKA_FN_HOST
Definition: Common.hpp:40
The alpaka accelerator library.
Tag used in class inheritance hierarchies that describes that a specific concept (TConcept) is implem...
Definition: Concepts.hpp:15
The dimension getter type trait.
Definition: Traits.hpp:14
static ALPAKA_FN_HOST auto getIdx(bt::IdxBtZero< TDim, TIdx > const &, TWorkDiv const &) -> Vec< TDim, TIdx >
Definition: IdxBtZero.hpp:38
The index get trait.
Definition: Traits.hpp:42
The idx type trait.
Definition: Traits.hpp:25