26#include "core/DataTypes.h"
27#include "core/logging/Logging.h"
29#include "gpu/GPUField.h"
30#include "gpu/GPUWrapper.h"
32#include "domain_decomposition/BlockDataID.h"
33#include "domain_decomposition/IBlock.h"
34#include "domain_decomposition/StructuredBlockStorage.h"
35#include "field/SwapableCompare.h"
38#include <unordered_map>
41#define RESTRICT __restrict__
43#define RESTRICT __restrict
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"
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)),
75 const CellInterval &globalCellInterval,
76 cell_idx_t ghostLayers, IBlock *
block,
77 gpuStream_t
stream =
nullptr);
87 return [kernel](IBlock *b) { kernel->run(b); };
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,
107 std::function<void(IBlock *)>
109 const CellInterval &globalCellInterval,
110 cell_idx_t ghostLayers = 1,
111 gpuStream_t
stream =
nullptr) {
112 return [
this, blocks, globalCellInterval, ghostLayers,
stream](IBlock *b) {
118 void configure(
const shared_ptr<StructuredBlockStorage> &blocks,
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]);
127 inline float getD()
const {
return D_; }
137 inline float getKt()
const {
return kT_; }
138 inline uint32_t
getSeed()
const {
return seed_; }
140 inline float getZ()
const {
return z_; }
141 inline void setD(
const float value) { D_ = value; }
143 block_offset_0_ = value;
146 block_offset_1_ = value;
149 block_offset_2_ = value;
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; }
157 inline void setKt(
const float value) { kT_ = value; }
158 inline void setSeed(
const uint32_t value) { seed_ = value; }
160 inline void setZ(
const float value) { z_ = value; }
167 inline void setPhiID(BlockDataID phiID_) { phiID = phiID_; }
172 uint32_t block_offset_0_;
173 uint32_t block_offset_1_;
174 uint32_t block_offset_2_;
178 uint32_t field_size_0_;
179 uint32_t field_size_1_;
180 uint32_t field_size_2_;
192#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
193 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
194#pragma GCC diagnostic pop
uint32_t getTime_step() const
std::function< void(IBlock *)> getSweepOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1, gpuStream_t stream=nullptr)
uint32_t getField_size_1() const
void setBlock_offset_1(const uint32_t value)
void setF_ext_1(const float value)
uint32_t getBlock_offset_0() const
uint32_t getBlock_offset_2() const
void setPhiID(BlockDataID phiID_)
void setTime_step(const uint32_t value)
void setZ(const float value)
void setKt(const float value)
void setSeed(const uint32_t value)
void setField_size_2(const uint32_t value)
std::function< void(IBlock *)> getSweep(gpuStream_t stream=nullptr)
void runOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers, IBlock *block, gpuStream_t stream=nullptr)
void setField_size_0(const uint32_t value)
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)
void setF_ext_2(const float value)
uint32_t getBlock_offset_1() const
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)
void setD(const float value)
void configure(const shared_ptr< StructuredBlockStorage > &blocks, IBlock *block)
void setField_size_1(const uint32_t value)
void setF_ext_0(const float value)
void operator()(IBlock *block, gpuStream_t stream=nullptr)
void setBlock_offset_2(const uint32_t value)
static std::function< void(IBlock *)> getSweep(const shared_ptr< DiffusiveFluxKernelWithElectrostaticThermalized_single_precision_CUDA > &kernel)
void run(IBlock *block, gpuStream_t stream=nullptr)
uint32_t getField_size_2() const
uint32_t getField_size_0() const
void setBlock_offset_0(const uint32_t value)
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)
\file PackInfoPdfDoublePrecision.cpp \author pystencils