![]() |
kspaceFirstOrder3D-CUDA
1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Output stream for quantities sampled by a cuboid corner sensor mask. More...
#include <CuboidOutputHDF5Stream.h>
Classes | |
struct | TCuboidInfo |
This structure information about one cuboid. Namely, its HDF5_ID, starting position in a lineup buffer. More... | |
Public Member Functions | |
TCuboidOutputHDF5Stream (THDF5_File &file, TMatrixName &groupName, const TRealMatrix &sourceMatrix, const TIndexMatrix &sensorMask, const TReduceOperator reduceOp) | |
Constructor. More... | |
virtual | ~TCuboidOutputHDF5Stream () |
Destructor. More... | |
virtual void | Create () |
Create a HDF5 stream and allocate data for it. More... | |
virtual void | Reopen () |
Reopen the output stream after restart and reload data. More... | |
virtual void | Sample () |
Sample data into buffer, apply reduce or copy to the CPU side. More... | |
virtual void | FlushRaw () |
Flush data to disk (from raw streams only). More... | |
virtual void | PostProcess () |
Apply post-processing on the buffer and flush it to the file. | |
virtual void | Checkpoint () |
Checkpoint the stream and close. More... | |
virtual void | Close () |
Close stream (apply post-processing if necessary, flush data and close). More... | |
![]() | |
TBaseOutputHDF5Stream (THDF5_File &file, TMatrixName &rootObjectName, const TRealMatrix &sourceMatrix, const TReduceOperator reduceOp) | |
Constructor. More... | |
virtual | ~TBaseOutputHDF5Stream () |
Destructor. | |
Protected Member Functions | |
virtual hid_t | CreateCuboidDataset (const size_t cuboidIdx) |
Create a new dataset for a given cuboid specified by index (order). More... | |
virtual void | FlushBufferToFile () |
Flush the buffer to the file. More... | |
![]() | |
TBaseOutputHDF5Stream () | |
Default constructor not allowed. | |
TBaseOutputHDF5Stream (const TBaseOutputHDF5Stream &src) | |
Copy constructor not allowed. | |
TBaseOutputHDF5Stream & | operator= (const TBaseOutputHDF5Stream &src) |
Operator = not allowed (we don't want any data movements). | |
virtual void | AllocateMemory () |
A generic function to allocate memory - not used in the base class. More... | |
virtual void | FreeMemory () |
A generic function to free memory - not used in the base class. More... | |
virtual void | CopyDataToDevice () |
Copy data hostBuffer-> deviceBuffer. More... | |
virtual void | CopyDataFromDevice () |
Copy data deviceBuffer -> hostBuffer. More... | |
Protected Attributes | |
const TIndexMatrix & | sensorMask |
Sensor mask to sample data. | |
hid_t | group |
Handle to a HDF5 dataset. | |
std::vector< TCuboidInfo > | cuboidsInfo |
vector keeping handles and positions of all cuboids | |
size_t | sampledTimeStep |
Timestep to store (N/A for aggregated). | |
cudaEvent_t | eventSamplingFinished |
Has the sampling finished? | |
![]() | |
THDF5_File & | file |
HDF5 file handle. | |
std::string | rootObjectName |
Dataset name. | |
const TRealMatrix & | sourceMatrix |
Source matrix to be sampled. | |
hid_t | dataset |
HDF5 dataset handle. | |
const TReduceOperator | reduceOp |
Reduce operator. | |
TDimensionSizes | position |
Position in the dataset. | |
size_t | bufferSize |
Buffer size. | |
float * | hostBuffer |
Temporary buffer for store on the GPU side. | |
float * | deviceBuffer |
Temporary buffer on the GPU side - only for aggregated quantities. | |
Additional Inherited Members | |
![]() | |
enum | TReduceOperator { NONE, RMS, MAX, MIN } |
How to aggregate data. More... | |
![]() | |
static const size_t | CHUNK_SIZE_4MB = 1048576 |
chunk size of 4MB in number of float elements | |
static const size_t | MIN_GRIDPOINTS_TO_SAMPLE_IN_PARALLEL = 1048576 |
The minimum number of elements to start sampling in parallel (4MB) | |
Output stream for quantities sampled by a cuboid corner sensor mask. This class writes data into separated datasets (one per cuboid) under a given dataset in the HDF5 file (time-series as well as aggregations).
Definition at line 49 of file CuboidOutputHDF5Stream.h.
TCuboidOutputHDF5Stream::TCuboidOutputHDF5Stream | ( | THDF5_File & | file, |
TMatrixName & | groupName, | ||
const TRealMatrix & | sourceMatrix, | ||
const TIndexMatrix & | sensorMask, | ||
const TReduceOperator | reduceOp | ||
) |
Constructor - links the HDF5 dataset, source (sampled matrix), sensor mask and the reduce operator together. The constructor DOES NOT allocate memory because the size of the sensor mask is not known at the time the instance of the class is being created.
[in] | file | - HDF5 file to write the output to |
[in] | groupName | - The name of the HDF5 group with datasets for particular cuboids |
[in] | sourceMatrix | - Source matrix to be sampled |
[in] | sensorMask | - Sensor mask with the cuboid coordinates |
[in] | reduceOp | - Reduce operator |
Definition at line 61 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Destructor. if the file is still opened, it applies the post processing and flush the data. Then, the object memory is freed and the object destroyed.
Definition at line 82 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Checkpoint the stream and close.
Implements TBaseOutputHDF5Stream.
Definition at line 332 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Close stream (apply post-processing if necessary, flush data, close datasets and the group).
Implements TBaseOutputHDF5Stream.
Definition at line 349 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Create a HDF5 stream and allocate data for it. It also creates a HDF5 group with particular datasets (one per cuboid).
Implements TBaseOutputHDF5Stream.
Definition at line 97 of file CuboidOutputHDF5Stream.cpp.
|
protectedvirtual |
Create a new dataset for a given cuboid specified by index (order).
[in] | cuboidIdx | - Index of the cuboid in the sensor mask |
Definition at line 378 of file CuboidOutputHDF5Stream.cpp.
|
protectedvirtual |
Flush the buffer to the file (to multiple datasets if necessary).
Definition at line 423 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Flush data for the timestep. Only applicable on RAW data series.
Implements TBaseOutputHDF5Stream.
Definition at line 294 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Reopen the output stream after restart and reload data.
Implements TBaseOutputHDF5Stream.
Definition at line 136 of file CuboidOutputHDF5Stream.cpp.
|
virtual |
Sample grid points, line them up in the buffer, if necessary a reduce operator is applied.
Implements TBaseOutputHDF5Stream.
Definition at line 207 of file CuboidOutputHDF5Stream.cpp.