TCudaTensor Class.
The TCudaTensor class extends the TCudaMatrix class for dimensions > 2.
Definition at line 81 of file CudaTensor.h.
Classes | |
| struct | TensorDescriptor |
Public Types | |
| using | MemoryLayout = TMVA::Experimental:: MemoryLayout |
| using | Scalar_t = AFloat |
| using | Shape_t = std::vector<size_t> |
Static Public Member Functions | |
| static std::vector< std::size_t > | ComputeStridesFromShape (const std::vector< std::size_t > &shape, bool rowmajorLayout) |
| This information is needed for the multi-dimensional indexing. | |
Private Member Functions | |
| void | InitializeCuda () |
| Initializes all shared devices resource and makes sure that a sufficient number of curand states are allocated on the device and initialized as well as that the one-vector for the summation over columns has the right size. | |
| void | InitializeCurandStates () |
Private Attributes | |
| int | fDevice |
| Device associated with current tensor instance. | |
| TCudaDeviceBuffer< AFloat > | fElementBuffer |
| MemoryLayout | fMemoryLayout |
| size_t | fNDim |
| Dimension of the tensor (first dimension is the batch size, second is the no. channels) | |
| Shape_t | fShape |
| The shape vector (size of dimensions) needs to be ordered as no. | |
| size_t | fSize |
| No. of elements. | |
| int | fStreamIndx |
| Cuda stream associated with current instance. | |
| Shape_t | fStrides |
| Strides between tensor dimensions (always assume dense, non overlapping tensor) | |
| std::shared_ptr< TensorDescriptor > | fTensorDescriptor |
Static Private Attributes | |
| static std::vector< int > | fInstances |
| For each GPU device keep the CUDA streams in which tensors are used. | |
#include <TMVA/DNN/Architectures/Cuda/CudaTensor.h>
| using TMVA::DNN::TCudaTensor< AFloat >::MemoryLayout = TMVA::Experimental:: MemoryLayout |
Definition at line 86 of file CudaTensor.h.
| using TMVA::DNN::TCudaTensor< AFloat >::Scalar_t = AFloat |
Definition at line 87 of file CudaTensor.h.
| using TMVA::DNN::TCudaTensor< AFloat >::Shape_t = std::vector<size_t> |
Definition at line 85 of file CudaTensor.h.
| TMVA::DNN::TCudaTensor< AFloat >::TCudaTensor | ( | ) |
Definition at line 71 of file CudaTensor.cu.
| TMVA::DNN::TCudaTensor< AFloat >::TCudaTensor | ( | const AFloat * | data, |
| const std::vector< size_t > & | shape, | ||
| TCudaTensor< AFloat >::MemoryLayout | layout = MemoryLayout::ColumnMajor, | ||
| int | deviceIndx = 0, | ||
| int | streamIndx = 0 ) |
Definition at line 99 of file CudaTensor.cu.
| TMVA::DNN::TCudaTensor< AFloat >::TCudaTensor | ( | TCudaDeviceBuffer< AFloat > | buffer, |
| const std::vector< size_t > & | shape, | ||
| MemoryLayout | memlayout = MemoryLayout::ColumnMajor, | ||
| int | deviceIndx = 0, | ||
| int | streamIndx = 0 ) |
Definition at line 122 of file CudaTensor.cu.
| TMVA::DNN::TCudaTensor< AFloat >::TCudaTensor | ( | const std::vector< size_t > & | shape, |
| TCudaTensor< AFloat >::MemoryLayout | layout = MemoryLayout::ColumnMajor, | ||
| int | deviceIndx = 0, | ||
| int | streamIndx = 0 ) |
Definition at line 80 of file CudaTensor.cu.
|
inline |
Definition at line 147 of file CudaTensor.h.
|
inline |
Definition at line 152 of file CudaTensor.h.
|
inline |
Definition at line 160 of file CudaTensor.h.
| TMVA::DNN::TCudaTensor< AFloat >::TCudaTensor | ( | const TCudaMatrix< AFloat > & | m, |
| size_t | dim = 2 ) |
Definition at line 157 of file CudaTensor.cu.
|
inline |
Definition at line 167 of file CudaTensor.h.
|
inline |
Definition at line 171 of file CudaTensor.h.
|
default |
|
default |
| TMVA::DNN::TCudaTensor< AFloat >::~TCudaTensor | ( | ) |
Definition at line 362 of file CudaTensor.cu.
|
inline |
Definition at line 362 of file CudaTensor.h.
|
inlinestatic |
This information is needed for the multi-dimensional indexing.
See here: https://en.wikipedia.org/wiki/Row-_and_column-major_order https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.strides.html
Definition at line 43 of file CudaTensor.cu.
|
inline |
Definition at line 211 of file CudaTensor.h.
|
inline |
Definition at line 277 of file CudaTensor.h.
|
inline |
Definition at line 195 of file CudaTensor.h.
|
inline |
Definition at line 194 of file CudaTensor.h.
|
inline |
Definition at line 193 of file CudaTensor.h.
|
inline |
Definition at line 192 of file CudaTensor.h.
|
inline |
Definition at line 199 of file CudaTensor.h.
|
inline |
Definition at line 197 of file CudaTensor.h.
|
inline |
Definition at line 203 of file CudaTensor.h.
|
inline |
Definition at line 202 of file CudaTensor.h.
|
inline |
Definition at line 188 of file CudaTensor.h.
|
inline |
Definition at line 272 of file CudaTensor.h.
|
inline |
Definition at line 274 of file CudaTensor.h.
|
inline |
Definition at line 281 of file CudaTensor.h.
|
inline |
Definition at line 184 of file CudaTensor.h.
|
inline |
Definition at line 302 of file CudaTensor.h.
|
inline |
Definition at line 298 of file CudaTensor.h.
|
inline |
Definition at line 189 of file CudaTensor.h.
|
inline |
Definition at line 297 of file CudaTensor.h.
|
inline |
Definition at line 186 of file CudaTensor.h.
|
inline |
Definition at line 190 of file CudaTensor.h.
|
inline |
Definition at line 187 of file CudaTensor.h.
|
inline |
Definition at line 287 of file CudaTensor.h.
|
private |
Initializes all shared devices resource and makes sure that a sufficient number of curand states are allocated on the device and initialized as well as that the one-vector for the summation over columns has the right size.
Definition at line 366 of file CudaTensor.cu.
|
private |
Definition at line 377 of file CudaTensor.cu.
|
inline |
Definition at line 236 of file CudaTensor.h.
|
inline |
Definition at line 218 of file CudaTensor.h.
| TMVA::DNN::TCudaTensor< AFloat >::operator TMatrixT< AFloat > | ( | ) | const |
Convert cuda matrix to Root TMatrix.
Performs synchronous data transfer.
Definition at line 175 of file CudaTensor.cu.
|
inline |
Definition at line 378 of file CudaTensor.h.
|
inline |
Definition at line 392 of file CudaTensor.h.
|
inline |
Definition at line 407 of file CudaTensor.h.
|
default |
|
default |
|
inline |
Definition at line 330 of file CudaTensor.h.
| void TMVA::DNN::TCudaTensor< AFloat >::Print | ( | const char * | name = "Tensor", |
| bool | truncate = false ) const |
Definition at line 385 of file CudaTensor.cu.
| void TMVA::DNN::TCudaTensor< AFloat >::PrintShape | ( | const char * | name = "Tensor" | ) | const |
Definition at line 410 of file CudaTensor.cu.
|
inline |
Definition at line 352 of file CudaTensor.h.
|
inline |
Definition at line 340 of file CudaTensor.h.
|
inline |
Definition at line 214 of file CudaTensor.h.
|
inline |
Definition at line 259 of file CudaTensor.h.
| void TMVA::DNN::TCudaTensor< AFloat >::SetTensorDescriptor | ( | ) |
Definition at line 370 of file CudaTensor.cu.
|
inline |
Definition at line 255 of file CudaTensor.h.
|
private |
Device associated with current tensor instance.
Definition at line 118 of file CudaTensor.h.
|
private |
Definition at line 122 of file CudaTensor.h.
|
staticprivate |
For each GPU device keep the CUDA streams in which tensors are used.
Instances belonging to the same stream on the same deviceshare a cudnn library handel to keep cudnn contexts separated
Definition at line 109 of file CudaTensor.h.
|
private |
Definition at line 124 of file CudaTensor.h.
|
private |
Dimension of the tensor (first dimension is the batch size, second is the no. channels)
Definition at line 116 of file CudaTensor.h.
|
private |
The shape vector (size of dimensions) needs to be ordered as no.
channels, image dimensions. spatial subdimensions
Definition at line 114 of file CudaTensor.h.
|
private |
No. of elements.
Definition at line 117 of file CudaTensor.h.
|
private |
Cuda stream associated with current instance.
Definition at line 119 of file CudaTensor.h.
|
private |
Strides between tensor dimensions (always assume dense, non overlapping tensor)
Definition at line 115 of file CudaTensor.h.
|
private |
Definition at line 121 of file CudaTensor.h.