67 sensorMask(sensorMask),
70 eventSamplingFinished()
105 size_t actualPositionInBuffer = 0;
107 for (
size_t cuboidIdx = 0; cuboidIdx < nCuboids; cuboidIdx++)
157 size_t actualPositionInBuffer = 0;
162 for (
size_t CuboidIdx = 0; CuboidIdx < nCuboids; CuboidIdx++)
166 const string datasetName = std::to_string(CuboidIdx + 1);
209 size_t cuboidInBufferStart = 0;
216 for (
size_t cuboidIdx = 0; cuboidIdx <
cuboidsInfo.size(); cuboidIdx++)
236 OutputStreamsCUDAKernels::SampleCuboid<NONE>
247 OutputStreamsCUDAKernels::SampleCuboid<RMS>
258 OutputStreamsCUDAKernels::SampleCuboid<MAX>
269 OutputStreamsCUDAKernels::SampleCuboid<MIN>
280 cuboidInBufferStart += nSamples;
352 if (
group != H5I_BADID)
355 for (
size_t cuboidIdx = 0; cuboidIdx <
cuboidsInfo.size(); cuboidIdx++)
400 cuboidChunkSize.
nz = nSlabs;
404 const string datasetName = std::to_string(cuboidIdx + 1);
430 for (
size_t cuboidIdx = 0; cuboidIdx <
cuboidsInfo.size(); cuboidIdx++)
size_t nx
number of elements in the x direction
size_t GetTotalNumberOfElementsInAllCuboids() const
Get the total number of elements to be sampled within all cuboids.
THDF5_File & file
HDF5 file handle.
hid_t CreateFloatDataset(const hid_t parentGroup, TMatrixName &datasetName, const TDimensionSizes &dimensionSizes, const TDimensionSizes &chunkSizes, const size_t compressionLevel)
Create a float HDF5 dataset at a specified place in the file tree (3D/4D).
hid_t group
Handle to a HDF5 dataset.
size_t GetStartTimeIndex() const
Get start time index for sensor recording.
void WriteMatrixDomainType(const hid_t parentGroup, TMatrixName &datasetName, const TMatrixDomainType &matrixDomainType)
Write matrix domain type into the dataset under the root group.
size_t startingPossitionInBuffer
Having a single buffer for all cuboids, where this one starts.
size_t nt
Number of time steps (for time series datasets).
TDimensionSizes GetBottomRightCorner(const size_t &index) const
Get the bottom right corner of the index-th cuboid.
virtual void CopyDataFromDevice()
Copy data deviceBuffer -> hostBuffer.
calculate root mean square
std::string rootObjectName
Dataset name.
static TParameters & GetInstance()
Get instance of the singleton class.
virtual struct TDimensionSizes GetDimensionSizes() const
Get dimension sizes of the matrix.
hid_t CreateGroup(const hid_t parentGroup, TMatrixName &groupName)
Create a HDF5 group at a specified place in the file tree.
const TReduceOperator reduceOp
Reduce operator.
The header file containing the parameters of the simulation.
The header file of cuda kernels used for data sampling (output streams).
static const size_t CHUNK_SIZE_4MB
chunk size of 4MB in number of float elements
const std::string TMatrixName
Datatype for matrix names.
virtual hid_t CreateCuboidDataset(const size_t cuboidIdx)
Create a new dataset for a given cuboid specified by index (order).
#define checkCudaErrors(val)
Macro checking cuda errors and printing the file name and line. Inspired by CUDA common checking rout...
virtual void PostProcess()
Apply post-processing on the buffer and flush it to the file.
hid_t dataset
HDF5 dataset handle.
virtual void AllocateMemory()
A generic function to allocate memory - not used in the base class.
virtual TDimensionSizes GetDimensionSizes() const
Get dimension sizes of the matrix.
void WriteMatrixDataType(const hid_t parentGroup, TMatrixName &datasetName, const TMatrixDataType &matrixDataType)
Write matrix data type into the dataset under a specified group.
const TRealMatrix & sourceMatrix
Source matrix to be sampled.
size_t Get_t_index() const
Get simulation time step.
The header file containing a class responsible for printing out info and error messages (stdout...
Class storing all parameters of the simulation.
TDimensionSizes GetTopLeftCorner(const size_t &index) const
Get the top left corner of the index-th cuboid.
virtual void PostProcess()
Apply post-processing on the buffer and flush it to the file.
virtual void FlushRaw()
Flush data to disk (from raw streams only).
hid_t GetRootGroup() const
Get handle to the root group.
std::vector< TCuboidInfo > cuboidsInfo
vector keeping handles and positions of all cuboids
virtual void Create()
Create a HDF5 stream and allocate data for it.
TReduceOperator
How to aggregate data.
float * deviceBuffer
Temporary buffer on the GPU side - only for aggregated quantities.
store actual data (time series)
size_t GetElementCount() const
Get element count, in 3D only spatial domain, in 4D with time.
size_t ny
number of elements in the y direction
cudaEvent_t eventSamplingFinished
Has the sampling finished?
Abstract base class for output data streams (sampled data).
virtual void Checkpoint()
Checkpoint the stream and close.
virtual void FreeMemory()
A generic function to free memory - not used in the base class.
size_t sampledTimeStep
Timestep to store (N/A for aggregated).
The class for real matrices.
float * hostBuffer
Temporary buffer for store on the GPU side.
This structure information about one cuboid. Namely, its HDF5_ID, starting position in a lineup buffe...
virtual void CopyDataToDevice()
Copy data hostBuffer-> deviceBuffer.
const TIndexMatrix & sensorMask
Sensor mask to sample data.
The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mas...
TDimensionSizes position
Position in the dataset.
virtual void Sample()
Sample data into buffer, apply reduce or copy to the CPU side.
virtual void Close()
Close stream (apply post-processing if necessary, flush data and close).
size_t GetCompressionLevel() const
Get compression level.
void WriteHyperSlab(const hid_t dataset, const TDimensionSizes &position, const TDimensionSizes &size, const float *data)
Write a hyper-slab into the dataset - float dataset.
virtual float * GetDeviceData()
Get raw GPU data out of the class (for direct GPU kernel access).
The header file of classes responsible for storing output quantities based on the cuboid sensor mask ...
size_t bufferSize
Buffer size.
virtual void Reopen()
Reopen the output stream after restart and reload data.
hid_t OpenGroup(const hid_t parentGroup, TMatrixName &groupName)
Open a HDF5 group at a specified place in the file tree.
size_t nz
number of elements in the z direction
void CloseGroup(const hid_t group)
Close group.
void ReadCompleteDataset(const hid_t parentGroup, TMatrixName &datasetName, const TDimensionSizes &dimensionSizes, float *data)
Read data from the dataset under a specified group, float dataset.
size_t Get_nt() const
Get Nt value.
virtual void FlushBufferToFile()
Flush the buffer to the file.
void CloseDataset(const hid_t dataset)
Close the HDF5 dataset.
TCuboidOutputHDF5Stream(THDF5_File &file, TMatrixName &groupName, const TRealMatrix &sourceMatrix, const TIndexMatrix &sensorMask, const TReduceOperator reduceOp)
Constructor.
hid_t cuboidIdx
Idx of the dataset storing the given cuboid.
Class wrapping the HDF5 routines.
Structure with 4D dimension sizes (3 in space and 1 in time).
hid_t OpenDataset(const hid_t parentGroup, TMatrixName &datasetName)
Open the HDF5 dataset at a specified place in the file tree.
virtual ~TCuboidOutputHDF5Stream()
Destructor.