OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS > Class Template Referencefinal

Representation of (Dynamics,Operator)Parameters<DYNAMICS> for CUDA block lattice. More...

#include <context.h>

+ Inheritance diagram for olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >:
+ Collaboration diagram for olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >:

Public Member Functions

 ConcreteParametersD (std::size_t)
 
AbstractParameters< T, DESCRIPTOR > & asAbstract () override
 
void setProcessingContext (ProcessingContext context) override
 
ParametersD * deviceData ()
 
std::size_t getNblock () const override
 Number of data blocks for the serializable interface.
 
std::size_t getSerializableSize () const override
 Binary size for the serializer.
 
bool * getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
 Return a pointer to the memory of the current block and its size for the serializable interface.
 
- Public Member Functions inherited from olb::Serializable
virtual ~Serializable ()=default
 
template<bool includeLogOutputDir = true>
bool save (std::string fileName="", const bool enforceUint=false)
 Save Serializable into file fileName
 
template<bool includeLogOutputDir = true>
bool load (std::string fileName="", const bool enforceUint=false)
 Load Serializable from file fileName
 
bool save (std::uint8_t *buffer)
 Save Serializable into buffer of length getSerializableSize
 
bool load (const std::uint8_t *buffer)
 Load Serializable from buffer of length getSerializableSize
 
virtual void postLoad ()
 

Public Attributes

ParametersD parameters
 

Additional Inherited Members

- Protected Member Functions inherited from olb::Serializable
template<typename DataType >
void registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const
 Register primitive data types (int, double, ...) or arrays of those.
 
template<typename DataType >
void registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false)
 Register Serializable object of constant size.
 
template<typename DataType >
void registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false)
 Register an array of Serializable objects of constant size.
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename PARAMETERS>
class olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >

Representation of (Dynamics,Operator)Parameters<DYNAMICS> for CUDA block lattice.

Definition at line 33 of file context.h.

Constructor & Destructor Documentation

◆ ConcreteParametersD()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::ConcreteParametersD ( std::size_t )

Definition at line 323 of file context.hh.

323 :
324 _deviceParameters{gpu::cuda::device::malloc<ParametersD>(1)},
325 parameters{}
326{
328 _deviceParameters.get(),
329 sizeof(ParametersD));
330}
void copyToDevice(void *src, void *dst, std::size_t count)
Copy data from host to device.
Definition device.hh:83

References olb::gpu::cuda::device::copyToDevice(), olb::ParametersD< T, DESCRIPTOR, FIELDS >::get(), and olb::ConcreteParametersD< T, DESCRIPTOR, PLATFORM, PARAMETERS >::parameters.

+ Here is the call graph for this function:

Member Function Documentation

◆ asAbstract()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
AbstractParameters< T, DESCRIPTOR > & olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::asAbstract ( )
inlineoverridevirtual

◆ deviceData()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
ParametersD * olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::deviceData ( )
inline

Definition at line 51 of file context.h.

51 {
52 return _deviceParameters.get();
53 }

References olb::gpu::cuda::device::unique_ptr< T >::get().

+ Here is the call graph for this function:

◆ getBlock()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
bool * olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::getBlock ( std::size_t iBlock,
std::size_t & sizeBlock,
bool loadingMode )
overridevirtual

Return a pointer to the memory of the current block and its size for the serializable interface.

Implements olb::Serializable.

Definition at line 361 of file context.hh.

363{
364 std::size_t currentBlock = 0;
365 bool* dataPtr = nullptr;
366 decltype(parameters)::fields_t::for_each([&](auto field) {
367 using field_t = typename decltype(field)::type;
368 if constexpr (DESCRIPTOR::template size<field_t>() == 1) {
369 registerVar(iBlock, sizeBlock, currentBlock, dataPtr,
370 parameters.template get<field_t>(), loadingMode);
371 } else {
372 registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr,
373 parameters.template get<field_t>(), loadingMode);
374 }
375 });
376 return dataPtr;
377}
void registerVar(const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const
Register primitive data types (int, double, ...) or arrays of those.
Definition serializer.h:212
void registerSerializableOfConstSize(const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false)
Register Serializable object of constant size.
Definition serializer.h:239
std::enable_if_t< DESCRIPTOR::d==2, std::shared_ptr< SuperF2D< T > > > field(SuperLattice< T, DESCRIPTOR > &sLattice)
Returns external field functor.

◆ getNblock()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
std::size_t olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 344 of file context.hh.

345{
346 return decltype(parameters)::fields_t::size;
347}

◆ getSerializableSize()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
std::size_t olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::getSerializableSize ( ) const
overridevirtual

Binary size for the serializer.

Implements olb::Serializable.

Definition at line 350 of file context.hh.

351{
352 std::size_t size = 0;
353 decltype(parameters)::fields_t::for_each([&size](auto field) {
354 using field_t = typename decltype(field)::type;
355 size += FieldD<T,DESCRIPTOR,field_t>{}.getSerializableSize();
356 });
357 return size;
358}

References olb::Vector< T, D >::getSerializableSize().

+ Here is the call graph for this function:

◆ setProcessingContext()

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
void olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::setProcessingContext ( ProcessingContext context)
overridevirtual

Implements olb::AbstractedConcreteParameters< T, DESCRIPTOR >.

Definition at line 333 of file context.hh.

335{
336 if (context == ProcessingContext::Simulation) {
338 _deviceParameters.get(),
339 sizeof(ParametersD));
340 }
341}
@ Simulation
Data available on host for e.g. functor evaluation.

References olb::gpu::cuda::device::copyToDevice(), and olb::Simulation.

+ Here is the call graph for this function:

Member Data Documentation

◆ parameters

template<typename T , typename DESCRIPTOR , typename PARAMETERS >
ParametersD olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >::parameters

Definition at line 41 of file context.h.


The documentation for this class was generated from the following files: