ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA.h
Go to the documentation of this file.
1//======================================================================================================================
2//
3// This file is part of waLBerla. waLBerla is free software: you can
4// redistribute it and/or modify it under the terms of the GNU General Public
5// License as published by the Free Software Foundation, either version 3 of
6// the License, or (at your option) any later version.
7//
8// waLBerla is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11// for more details.
12//
13// You should have received a copy of the GNU General Public License along
14// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
15//
16//! \\file
17//! DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA.h
18//! \\author pystencils
19//======================================================================================================================
20
21// kernel generated with pystencils v1.3.7+13.gdfd203a, lbmpy
22// v1.3.7+10.gd3f6236, sympy v1.12.1, lbmpy_walberla/pystencils_walberla from
23// waLBerla commit c69cb11d6a95d32b2280544d3d9abde1fe5fdbb5
24
25#pragma once
26#include "core/DataTypes.h"
27#include "core/logging/Logging.h"
28
29#include "gpu/GPUField.h"
30#include "gpu/GPUWrapper.h"
31
32#include "domain_decomposition/BlockDataID.h"
33#include "domain_decomposition/IBlock.h"
34#include "domain_decomposition/StructuredBlockStorage.h"
35#include "field/SwapableCompare.h"
36
37#include <functional>
38#include <unordered_map>
39
40#ifdef __GNUC__
41#define RESTRICT __restrict__
42#elif _MSC_VER
43#define RESTRICT __restrict
44#else
45#define RESTRICT
46#endif
47
48#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
49 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
50#pragma GCC diagnostic push
51#pragma GCC diagnostic ignored "-Wunused-parameter"
52#pragma GCC diagnostic ignored "-Wreorder"
53#endif
54
55namespace walberla {
56namespace pystencils {
57
59public:
61 BlockDataID jID_, BlockDataID phiID_, BlockDataID rhoID_, float D,
62 float f_ext_0, float f_ext_1, float f_ext_2, uint32_t field_size_0,
63 uint32_t field_size_1, uint32_t field_size_2, float kT, uint32_t seed,
64 uint32_t time_step, float z)
65 : jID(jID_), phiID(phiID_), rhoID(rhoID_), D_(D), f_ext_0_(f_ext_0),
66 f_ext_1_(f_ext_1), f_ext_2_(f_ext_2), field_size_0_(field_size_0),
67 field_size_1_(field_size_1), field_size_2_(field_size_2), kT_(kT),
68 seed_(seed), time_step_(time_step), z_(z), block_offset_0_(uint32_t(0)),
69 block_offset_1_(uint32_t(0)), block_offset_2_(uint32_t(0)),
70 configured_(false) {}
71
72 void run(IBlock *block, gpuStream_t stream = nullptr);
73
74 void runOnCellInterval(const shared_ptr<StructuredBlockStorage> &blocks,
75 const CellInterval &globalCellInterval,
76 cell_idx_t ghostLayers, IBlock *block,
77 gpuStream_t stream = nullptr);
78
79 void operator()(IBlock *block, gpuStream_t stream = nullptr) {
81 }
82
83 static std::function<void(IBlock *)> getSweep(
84 const shared_ptr<
86 &kernel) {
87 return [kernel](IBlock *b) { kernel->run(b); };
88 }
89
90 static std::function<void(IBlock *, gpuStream_t)> getSweepOnCellInterval(
91 const shared_ptr<
93 &kernel,
94 const shared_ptr<StructuredBlockStorage> &blocks,
95 const CellInterval &globalCellInterval, cell_idx_t ghostLayers = 1) {
96 return [kernel, blocks, globalCellInterval,
97 ghostLayers](IBlock *b, gpuStream_t stream = nullptr) {
98 kernel->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b,
99 stream);
100 };
101 }
102
103 std::function<void(IBlock *)> getSweep(gpuStream_t stream = nullptr) {
104 return [this, stream](IBlock *b) { this->run(b, stream); };
105 }
106
107 std::function<void(IBlock *)>
108 getSweepOnCellInterval(const shared_ptr<StructuredBlockStorage> &blocks,
109 const CellInterval &globalCellInterval,
110 cell_idx_t ghostLayers = 1,
111 gpuStream_t stream = nullptr) {
112 return [this, blocks, globalCellInterval, ghostLayers, stream](IBlock *b) {
113 this->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b,
114 stream);
115 };
116 }
117
118 void configure(const shared_ptr<StructuredBlockStorage> &blocks,
119 IBlock *block) {
120 Cell BlockCellBB = blocks->getBlockCellBB(*block).min();
121 block_offset_0_ = uint32_t(BlockCellBB[0]);
122 block_offset_1_ = uint32_t(BlockCellBB[1]);
123 block_offset_2_ = uint32_t(BlockCellBB[2]);
124 configured_ = true;
125 }
126
127 inline float getD() const { return D_; }
128 inline uint32_t getBlock_offset_0() const { return block_offset_0_; }
129 inline uint32_t getBlock_offset_1() const { return block_offset_1_; }
130 inline uint32_t getBlock_offset_2() const { return block_offset_2_; }
131 inline float getF_ext_0() const { return f_ext_0_; }
132 inline float getF_ext_1() const { return f_ext_1_; }
133 inline float getF_ext_2() const { return f_ext_2_; }
134 inline uint32_t getField_size_0() const { return field_size_0_; }
135 inline uint32_t getField_size_1() const { return field_size_1_; }
136 inline uint32_t getField_size_2() const { return field_size_2_; }
137 inline float getKt() const { return kT_; }
138 inline uint32_t getSeed() const { return seed_; }
139 inline uint32_t getTime_step() const { return time_step_; }
140 inline float getZ() const { return z_; }
141 inline void setD(const float value) { D_ = value; }
142 inline void setBlock_offset_0(const uint32_t value) {
143 block_offset_0_ = value;
144 }
145 inline void setBlock_offset_1(const uint32_t value) {
146 block_offset_1_ = value;
147 }
148 inline void setBlock_offset_2(const uint32_t value) {
149 block_offset_2_ = value;
150 }
151 inline void setF_ext_0(const float value) { f_ext_0_ = value; }
152 inline void setF_ext_1(const float value) { f_ext_1_ = value; }
153 inline void setF_ext_2(const float value) { f_ext_2_ = value; }
154 inline void setField_size_0(const uint32_t value) { field_size_0_ = value; }
155 inline void setField_size_1(const uint32_t value) { field_size_1_ = value; }
156 inline void setField_size_2(const uint32_t value) { field_size_2_ = value; }
157 inline void setKt(const float value) { kT_ = value; }
158 inline void setSeed(const uint32_t value) { seed_ = value; }
159 inline void setTime_step(const uint32_t value) { time_step_ = value; }
160 inline void setZ(const float value) { z_ = value; }
161
162private:
163 BlockDataID jID;
164 BlockDataID phiID;
165
166public:
167 inline void setPhiID(BlockDataID phiID_) { phiID = phiID_; }
168
169private:
170 BlockDataID rhoID;
171 float D_;
172 uint32_t block_offset_0_;
173 uint32_t block_offset_1_;
174 uint32_t block_offset_2_;
175 float f_ext_0_;
176 float f_ext_1_;
177 float f_ext_2_;
178 uint32_t field_size_0_;
179 uint32_t field_size_1_;
180 uint32_t field_size_2_;
181 float kT_;
182 uint32_t seed_;
183 uint32_t time_step_;
184 float z_;
185
186 bool configured_;
187};
188
189} // namespace pystencils
190} // namespace walberla
191
192#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
193 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
194#pragma GCC diagnostic pop
195#endif
Definition Cell.hpp:96
std::function< void(IBlock *)> getSweepOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1, gpuStream_t stream=nullptr)
void runOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers, IBlock *block, gpuStream_t stream=nullptr)
static std::function< void(IBlock *, gpuStream_t)> getSweepOnCellInterval(const shared_ptr< DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA > &kernel, const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1)
DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA(BlockDataID jID_, BlockDataID phiID_, BlockDataID rhoID_, float D, float f_ext_0, float f_ext_1, float f_ext_2, uint32_t field_size_0, uint32_t field_size_1, uint32_t field_size_2, float kT, uint32_t seed, uint32_t time_step, float z)
static std::function< void(IBlock *)> getSweep(const shared_ptr< DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA > &kernel)
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
static double * block(double *p, std::size_t index, std::size_t size)
Definition elc.cpp:176
\file PackInfoPdfDoublePrecision.cpp \author pystencils