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
 
double * t
 
double * dt
 
int * id
 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.
 
double * maxEigenvalue
 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.

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 = double, typename outType = double>
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.

◆ CellData() [2/3]

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

◆ 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 = double, typename outType = double>
exahype2::CellData< inType, outType >::~CellData ( )

Member Function Documentation

◆ in()

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

◆ out()

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

◆ toString()

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

Field Documentation

◆ cellCentre

template<typename inType = double, typename outType = double>
tarch::la::Vector<Dimensions,double>* exahype2::CellData< inType, outType >::cellCentre

Definition at line 83 of file CellData.h.

◆ cellSize

template<typename inType = double, typename outType = double>
tarch::la::Vector<Dimensions,double>* exahype2::CellData< inType, outType >::cellSize

Definition at line 84 of file CellData.h.

◆ dt

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

Definition at line 87 of file CellData.h.

◆ id

◆ maxEigenvalue

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

Out values.

Definition at line 121 of file CellData.h.

◆ 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

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

As we store data as SoA, we have to know how big the actual arrays are.

Definition at line 99 of file CellData.h.

◆ QIn

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

QIn may not be const, as some kernels delete it straightaway once the input data has been handled.

Definition at line 82 of file CellData.h.

◆ QOut

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

Out values.

Definition at line 116 of file CellData.h.

◆ t

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

Definition at line 86 of file CellData.h.

◆ 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 file: