![]() |
kspaceFirstOrder3D-CUDA
1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Abstract base class for index based matrices defining basic interface. Higher dimensional matrices stored as 1D arrays, row-major order. More...
#include <BaseIndexMatrix.h>
Public Member Functions | |
TBaseIndexMatrix () | |
Default constructor. More... | |
virtual | ~TBaseIndexMatrix () |
Destructor. | |
virtual struct TDimensionSizes | GetDimensionSizes () const |
Get dimension sizes of the matrix. | |
virtual size_t | GetElementCount () const |
Get total element count of the matrix. | |
virtual size_t | GetAllocatedElementCount () const |
Get total allocated element count (might differ from total element count used for the simulation because of padding). | |
virtual void | ZeroMatrix () |
Zero all elements of the matrix (NUMA first touch). More... | |
virtual size_t * | GetHostData () |
Get raw data out of the class (for direct CPU kernel access). | |
virtual const size_t * | GetHostData () const |
Get raw data out of the class (for direct CPU kernel access). | |
virtual size_t * | GetDeviceData () |
Get raw GPU data out of the class (for direct GPU kernel access). | |
virtual const size_t * | GetDeviceData () const |
Get raw GPU data out of the class (for direct GPU kernel access). | |
virtual void | CopyToDevice () |
Copy data from CPU -> GPU (Host -> Device). More... | |
virtual void | CopyFromDevice () |
Copy data from GPU -> CPU (Device -> Host). More... | |
![]() | |
TBaseMatrix () | |
Default constructor. | |
virtual | ~TBaseMatrix () |
Destructor. | |
virtual void | ReadDataFromHDF5File (THDF5_File &file, TMatrixName &matrixName)=0 |
Read matrix from the HDF5 file. More... | |
virtual void | WriteDataToHDF5File (THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)=0 |
Write data into the HDF5 file. More... | |
Protected Member Functions | |
virtual void | AllocateMemory () |
Memory allocation (both on CPU and GPU) More... | |
virtual void | FreeMemory () |
Memory deallocation (both on CPU and GPU) More... | |
TBaseIndexMatrix (const TBaseIndexMatrix &src) | |
Copy constructor is not allowed for public. | |
TBaseIndexMatrix & | operator= (const TBaseIndexMatrix &src) |
operator = is not allowed for public | |
Protected Attributes | |
size_t | nElements |
Total number of elements. | |
size_t | nAllocatedElements |
Total number of allocated elements (the array size). | |
struct TDimensionSizes | dimensionSizes |
Dimension sizes. | |
size_t | rowSize |
Size of 1D row in X dimension. | |
size_t | slabSize |
Size of 2D slab (X,Y). | |
size_t * | hostData |
Raw CPU matrix data. | |
size_t * | deviceData |
Raw GPU matrix data. | |
Abstract base class for index based matrices defining basic interface. Higher dimensional matrices stored as 1D arrays, row-major order. This matrix stores the data on both the CPU and GPU side.
Definition at line 49 of file BaseIndexMatrix.h.
TBaseIndexMatrix::TBaseIndexMatrix | ( | ) |
Default constructor
Definition at line 52 of file BaseIndexMatrix.cpp.
|
protectedvirtual |
Memory allocation based on the total number of elements.
CPU memory is aligned by the DATA_ALIGNMENT and then registered as pinned and zeroed. The GPU memory is allocated on GPU but not zeroed (no reason).
Definition at line 113 of file BaseIndexMatrix.cpp.
|
virtual |
Copy data from GPU -> CPU (Device -> Host).
Implements TBaseMatrix.
Definition at line 94 of file BaseIndexMatrix.cpp.
|
virtual |
Copy data from CPU -> GPU (Host -> Device).
Implements TBaseMatrix.
Definition at line 81 of file BaseIndexMatrix.cpp.
|
protectedvirtual |
Free memory.
Definition at line 138 of file BaseIndexMatrix.cpp.
|
virtual |
Zero all allocated elements.
Definition at line 68 of file BaseIndexMatrix.cpp.