www.cemf.ir
KokkosTypes.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 #ifndef __KokkosTypes_hpp__
21 #define __KokkosTypes_hpp__
22 
31 #include <Kokkos_Core.hpp>
32 #include <Kokkos_DualView.hpp>
33 #include <Kokkos_UnorderedMap.hpp>
34 
35 #include "builtinTypes.hpp"
36 
37 namespace pFlow
38 {
39 
42 
45 
46 #ifdef _OPENMP
47 using OpenMP = Kokkos::OpenMP;
49 #endif
50 
51 #ifdef __CUDACC__
52 using Cuda = Kokkos::Cuda;
54 #endif
55 
58 
62 
63 using deviceRPolicyStatic = Kokkos::RangePolicy<
65  Kokkos::Schedule<Kokkos::Static>,
66  Kokkos::IndexType<pFlow::uint32>>;
67 
68 using hostRPolicyStatic = Kokkos::RangePolicy<
70  Kokkos::Schedule<Kokkos::Static>,
71  Kokkos::IndexType<pFlow::uint32>>;
72 
73 using deviceRPolicyDynamic = Kokkos::RangePolicy<
75  Kokkos::Schedule<Kokkos::Dynamic>,
76  Kokkos::IndexType<pFlow::uint32>>;
77 
78 using hostRPolicyDynamic = Kokkos::RangePolicy<
80  Kokkos::Schedule<Kokkos::Dynamic>,
81  Kokkos::IndexType<pFlow::uint32>>;
82 
84 template<typename T1, typename T2>
85 using Pair = Kokkos::pair<T1, T2>;
86 
88 template<typename T, typename... properties>
89 using ViewTypeScalar = Kokkos::View<T, properties...>;
90 
92 template<typename T, typename... properties>
93 using ViewType1D = Kokkos::View<T*, properties...>;
94 
96 template<typename T, typename... properties>
97 using ViewType2D = Kokkos::View<T**, properties...>;
98 
100 template<typename T, typename... properties>
101 using ViewType3D = Kokkos::View<T***, properties...>;
102 
104 template<typename T, typename... properties>
105 using DualViewType1D = Kokkos::DualView<T*, properties...>;
106 
108 template<typename Key, typename Value, typename... properties>
109 using unorderedMap = Kokkos::UnorderedMap<Key, Value, properties...>;
110 
112 template<typename Key, typename... properties>
113 using unorderedSet = Kokkos::UnorderedMap<Key, void, properties...>;
114 
116 template<typename T>
117 using deviceViewTypeScalar = Kokkos::View<T>;
118 
120 template<typename T>
121 using deviceViewType1D = Kokkos::View<T*>;
122 
124 template<typename T, typename Layout = void>
125 using deviceViewType2D = Kokkos::View<T**, Layout, void>;
126 
128 template<typename T, typename Layout = void>
129 using deviceViewType3D = Kokkos::View<T***, Layout, void>;
130 
131 template<typename T>
132 using hostViewTypeScalar = Kokkos::View<T, Kokkos::HostSpace>;
133 
135 template<typename T>
136 using hostViewType1D = Kokkos::View<T*, Kokkos::HostSpace>;
137 
139 template<typename T, typename Layout = void>
140 using hostViewType2D = Kokkos::View<T**, Layout, Kokkos::HostSpace>;
141 
143 template<typename T, typename Layout = void>
144 using hostViewType3D = Kokkos::View<T***, Layout, Kokkos::HostSpace>;
145 
147 template<typename T>
148 using deviceAtomicViewType1D = Kokkos::View<
149  T*,
150  Kokkos::MemoryTraits<
151  std::is_same_v<DefaultExecutionSpace, Serial> ? 0 : Kokkos::Atomic>>;
152 
154 template<typename T>
155 using deviceAtomicViewType3D = Kokkos::View<
156  T***,
157  Kokkos::MemoryTraits<
158  std::is_same_v<DefaultExecutionSpace, Serial> ? 0 : Kokkos::Atomic>>;
159 
160 } // pFlow
161 
162 #endif //__KokkosTypes_hpp__
pFlow::hostViewType2D
Kokkos::View< T **, Layout, Kokkos::HostSpace > hostViewType2D
2D array on host
Definition: KokkosTypes.hpp:140
pFlow::DefaultHostExecutionSpace
Kokkos::DefaultHostExecutionSpace DefaultHostExecutionSpace
Default Host execution space, on top of all host execution spaces.
Definition: KokkosTypes.hpp:57
pFlow::Serial
Kokkos::Serial Serial
Serial execution space.
Definition: KokkosTypes.hpp:44
pFlow::Pair
Kokkos::pair< T1, T2 > Pair
Pair of two variables.
Definition: KokkosTypes.hpp:85
pFlow::ViewType2D
Kokkos::View< T **, properties... > ViewType2D
2D view as an array
Definition: KokkosTypes.hpp:97
pFlow::deviceViewTypeScalar
Kokkos::View< T > deviceViewTypeScalar
Scalar on device.
Definition: KokkosTypes.hpp:117
pFlow::hostRPolicyDynamic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Dynamic >, Kokkos::IndexType< pFlow::uint32 > > hostRPolicyDynamic
Definition: KokkosTypes.hpp:81
pFlow::DefaultExecutionSpace
Kokkos::DefaultExecutionSpace DefaultExecutionSpace
Default execution space, it can be device exe.
Definition: KokkosTypes.hpp:61
pFlow::deviceViewType2D
Kokkos::View< T **, Layout, void > deviceViewType2D
2D view on device as an array on device
Definition: KokkosTypes.hpp:125
pFlow::DualViewType1D
Kokkos::DualView< T *, properties... > DualViewType1D
1D dual view as a vector
Definition: KokkosTypes.hpp:105
pFlow::HostSpace
Kokkos::HostSpace HostSpace
Host memory space.
Definition: KokkosTypes.hpp:41
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
1D array (vector) with default device (memory space and execution space)
Definition: KokkosTypes.hpp:121
pFlow::deviceAtomicViewType1D
Kokkos::View< T *, Kokkos::MemoryTraits< std::is_same_v< DefaultExecutionSpace, Serial > ? 0 :Kokkos::Atomic > > deviceAtomicViewType1D
1D vector on device with atomic capabilities
Definition: KokkosTypes.hpp:151
pFlow
Definition: demGeometry.hpp:27
pFlow::unorderedSet
Kokkos::UnorderedMap< Key, void, properties... > unorderedSet
unordered set
Definition: KokkosTypes.hpp:113
pFlow::deviceViewType3D
Kokkos::View< T ***, Layout, void > deviceViewType3D
3D view on device as an array on device
Definition: KokkosTypes.hpp:129
pFlow::hostViewType3D
Kokkos::View< T ***, Layout, Kokkos::HostSpace > hostViewType3D
3D array on host
Definition: KokkosTypes.hpp:144
pFlow::ViewTypeScalar
Kokkos::View< T, properties... > ViewTypeScalar
View for a scalar.
Definition: KokkosTypes.hpp:89
pFlow::unorderedMap
Kokkos::UnorderedMap< Key, Value, properties... > unorderedMap
unordered map
Definition: KokkosTypes.hpp:109
pFlow::hostRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > hostRPolicyStatic
Definition: KokkosTypes.hpp:71
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
1D veiw as a vector
Definition: KokkosTypes.hpp:93
pFlow::hostViewTypeScalar
Kokkos::View< T, Kokkos::HostSpace > hostViewTypeScalar
Definition: KokkosTypes.hpp:132
pFlow::ViewType3D
Kokkos::View< T ***, properties... > ViewType3D
3D view as an array
Definition: KokkosTypes.hpp:101
pFlow::hostViewType1D
Kokkos::View< T *, Kokkos::HostSpace > hostViewType1D
1D array (vector with host memeory space)
Definition: KokkosTypes.hpp:136
pFlow::deviceRPolicyDynamic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Dynamic >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyDynamic
Definition: KokkosTypes.hpp:76
pFlow::deviceRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyStatic
Definition: KokkosTypes.hpp:66
builtinTypes.hpp
pFlow::deviceAtomicViewType3D
Kokkos::View< T ***, Kokkos::MemoryTraits< std::is_same_v< DefaultExecutionSpace, Serial > ? 0 :Kokkos::Atomic > > deviceAtomicViewType3D
3D array on device with atomic capabilities
Definition: KokkosTypes.hpp:158