Peano
Loading...
Searching...
No Matches
exahype2::CellData< inType, outType > Struct Template Reference

Representation of a number of cells which contains all information that's required to process the stored patches or polynomial shape functions (given you know the semantics of the data). More...

#include <CellData.h>

Collaboration diagram for exahype2::CellData< inType, outType >:

Public Member Functions

 CellData (inType *QIn_, const tarch::la::Vector< Dimensions, double > &cellCentre_, const tarch::la::Vector< Dimensions, double > &cellSize_, double t_, double dt_, outType *QOut_, tarch::MemoryLocation memoryLocation_=tarch::MemoryLocation::Heap, int targetDevice_=tarch::accelerator::Device::HostDevice)
 Construct patch data object for one single cell.
 
 CellData (int numberOfCells_, tarch::MemoryLocation memoryLocation=tarch::MemoryLocation::Heap, int targetDevice=tarch::accelerator::Device::HostDevice)
 
 CellData (const CellData< inType, outType > &copy)=delete
 
 ~CellData ()
 
std::string toString () const
 

Data Fields

inType ** QIn
 QIn may not be const, as some kernels delete it straightaway once the input data has been handled.
 
tarch::la::Vector< Dimensions, double > * cellCentre
 
tarch::la::Vector< Dimensions, double > * cellSize
 
doublet
 
doubledt
 
intid
 Id of underlying task.
 
const int numberOfCells
 As we store data as SoA, we have to know how big the actual arrays are.
 
const tarch::MemoryLocation memoryLocation
 We might want to allocate data on the heap or an accelerator, therefore we save the target device id.
 
const int targetDevice
 We might want to allocate data on an accelerator, therefore we save the target device id.
 
outType ** QOut
 Out values.
 
doublemaxEigenvalue
 Out values.
 

Detailed Description

template<typename inType = double, typename outType = double>
struct exahype2::CellData< inType, outType >

Representation of a number of cells which contains all information that's required to process the stored patches or polynomial shape functions (given you know the semantics of the data).

This struct is a mixture of AoS and SoA. All data besides the Qin and result are SoA. The reason for this "inconsistent" model is that we want to transfer the patch data to accelerators quickly, while we also want to avoid to copy too much stuff around. So we leave the big input fields and basically manage just pointers to that. All scalar or small vector data are converted in SoA which makes it fairly straightforward later to move them over to an accelerator.

Memory responsibility

The PatchData object is a meta object. It does not administer any major heap data itself. That is, its QIn data has to be redirected to the reconstructed data, i.e. the patch data including the halos, by the user. This happens for example in applyKernelToCell() where we create a PatchData object over both allocated input and output data.

As the PatchData does maintain some internal tables which are allocated in the constructor and freed in the destructor, I do not provide a copy constructor. This one is explicitly deleted. Some backends might require a copy constructor one day

for (int i=0; i<numberOfCells; i++) {
QIn[i] = copy.QIn[i];
cellCentre[i] = copy.cellCentre[i];
cellSize[i] = copy.cellSize[i];
t[i] = copy.t[i];
dt[i] = copy.dt[i];
id[i] = copy.id[i];
QOut[i] = copy.QOut[i];
maxEigenvalue[i] = copy.maxEigenvalue[i];
}
}
Representation of a number of cells which contains all information that's required to process the sto...
Definition CellData.h:77
inType ** QIn
QIn may not be const, as some kernels delete it straightaway once the input data has been handled.
Definition CellData.h:82
const int numberOfCells
As we store data as SoA, we have to know how big the actual arrays are.
Definition CellData.h:99
CellData(inType *QIn_, const tarch::la::Vector< Dimensions, double > &cellCentre_, const tarch::la::Vector< Dimensions, double > &cellSize_, double t_, double dt_, outType *QOut_, tarch::MemoryLocation memoryLocation_=tarch::MemoryLocation::Heap, int targetDevice_=tarch::accelerator::Device::HostDevice)
Construct patch data object for one single cell.
Definition CellData.cpph:4

but for the time being, I do not offer such a variant.

SYCL

If you use SYCL, you might be tempted to declare the class as copyable. This is factually wrong: the class is not trivially copyable.

#if defined(SharedSYCL)
template<>
struct sycl::is_device_copyable<exahype2::CellData>: std::true_type {};
#endif
For the generic kernels that I use here most of the time.
Definition CellAccess.h:13

hence makes the file compile, but in all tests that I ran the code then did crash.

Definition at line 77 of file CellData.h.

Constructor & Destructor Documentation

◆ CellData() [1/3]

template<typename inType , typename outType >
exahype2::CellData< inType, outType >::CellData ( inType * QIn_,
const tarch::la::Vector< Dimensions, double > & cellCentre_,
const tarch::la::Vector< Dimensions, double > & cellSize_,
double t_,
double dt_,
outType * QOut_,
tarch::MemoryLocation memoryLocation_ = tarch::MemoryLocation::Heap,
int targetDevice_ = tarch::accelerator::Device::HostDevice )

Construct patch data object for one single cell.

Usually, I do so only to be able to use the same kernels everywhere: Kernels accept CellData, i.e. multiple patches. Even if we have only one cell, we thus wrap this cell's data into an instance of CellData and pass it in. The id can be set to any dummy in this case, as we know which task has wrapped this single cell, i.e. we usually do not read it later.

Definition at line 4 of file CellData.cpph.

References exahype2::CellData< inType, outType >::cellCentre, exahype2::CellData< inType, outType >::cellSize, exahype2::CellData< inType, outType >::dt, exahype2::CellData< inType, outType >::QIn, exahype2::CellData< inType, outType >::QOut, and exahype2::CellData< inType, outType >::t.

◆ CellData() [2/3]

◆ CellData() [3/3]

template<typename inType = double, typename outType = double>
exahype2::CellData< inType, outType >::CellData ( const CellData< inType, outType > & copy)
delete

◆ ~CellData()

template<typename inType , typename outType >
exahype2::CellData< inType, outType >::~CellData ( )

Definition at line 44 of file CellData.cpph.

References tarch::freeMemory().

Here is the call graph for this function:

Member Function Documentation

◆ toString()

template<typename inType , typename outType >
std::string exahype2::CellData< inType, outType >::toString ( ) const

Definition at line 56 of file CellData.cpph.

Field Documentation

◆ cellCentre

◆ cellSize

◆ dt

◆ id

template<typename inType = double, typename outType = double>
int* exahype2::CellData< inType, outType >::id

Id of underlying task.

Required when we fuse many enclave tasks and load them off to the GPU, as we have to know afterwards which outcome corresponds to which task.

Definition at line 93 of file CellData.h.

◆ maxEigenvalue

◆ memoryLocation

template<typename inType = double, typename outType = double>
const tarch::MemoryLocation exahype2::CellData< inType, outType >::memoryLocation

We might want to allocate data on the heap or an accelerator, therefore we save the target device id.

Definition at line 105 of file CellData.h.

◆ numberOfCells

◆ QIn

◆ QOut

◆ t

◆ targetDevice

template<typename inType = double, typename outType = double>
const int exahype2::CellData< inType, outType >::targetDevice

We might want to allocate data on an accelerator, therefore we save the target device id.

Definition at line 111 of file CellData.h.


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