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

Static Public Member Functions

static int in (int index[Dimensions+2])
static int out (int index[Dimensions+2])

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];
}
}
outType ** QOut
Out values.
Definition CellData.h:116
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:5
int * id
Id of underlying task.
Definition CellData.h:93
double * maxEigenvalue
Out values.
Definition CellData.h:121
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:83
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:84

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
This file is part of the multigrid project within Peano 4.
Definition __init__.py:1

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 5 of file CellData.cpph.

References cellCentre, CellData(), cellSize, dt, QIn, QOut, and t.

Referenced by CellData(), and CellData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CellData() [2/3]

template<typename inType, typename outType>
exahype2::CellData< inType, outType >::CellData ( int numberOfCells_,
tarch::MemoryLocation memoryLocation = tarch::MemoryLocation::Heap,
int targetDevice = tarch::accelerator::Device::HostDevice )

Definition at line 26 of file CellData.cpph.

References tarch::allocateMemory(), cellCentre, cellSize, dt, maxEigenvalue, memoryLocation, numberOfCells, QIn, QOut, t, and targetDevice.

Here is the call graph for this function:

◆ CellData() [3/3]

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

References CellData().

Here is the call graph for this function:

◆ ~CellData()

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

Definition at line 45 of file CellData.cpph.

References cellCentre, cellSize, dt, tarch::freeMemory(), maxEigenvalue, memoryLocation, QIn, QOut, t, and targetDevice.

Here is the call graph for this function:

Member Function Documentation

◆ in()

template<typename inType = double, typename outType = double>
int exahype2::CellData< inType, outType >::in ( int index[Dimensions+2])
static

◆ out()

template<typename inType = double, typename outType = double>
int exahype2::CellData< inType, outType >::out ( int index[Dimensions+2])
static

◆ toString()

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

Definition at line 57 of file CellData.cpph.

References cellCentre, cellSize, dt, maxEigenvalue, numberOfCells, and t.

Field Documentation

◆ cellCentre

◆ cellSize

◆ dt

◆ id

◆ 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.

Referenced by CellData(), and ~CellData().

◆ 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.

Referenced by CellData(), and ~CellData().


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