A dense tensor using CUDA for storage and computing if SYTEN_USE_CUDA
is defined.
More...
#include <cuda.h>
Public Types | |
using | Coord = DenseImpl::Coord< rank > |
CudaDenseTensor objects can only be instantiated with standard floating-point scalars. More... | |
Public Member Functions | |
MemoryUsage::MemorySize | allocSize () const |
allocSize()/memory_size.h support. More... | |
CudaPtr< Scalar > | begin () |
Pointer to start of data array. More... | |
CudaPtr< const Scalar > | begin () const |
Pointer to start of const array. More... | |
bool | cached_normSqd_is_valid () const |
Returns true if the cached norm is currently valid, i.e. More... | |
CudaPtr< const Scalar > | cbegin () const |
Pointer to start of const array. More... | |
CudaPtr< const Scalar > | cend () const |
Pointer one past the end of const array. More... | |
CudaDenseTensor () | |
Creates a zero-dimensional tensor. More... | |
CudaDenseTensor (Coord dims_, int device_hint=-1) | |
Creates an uninitialised dense tensor of the specified dimensions on the specified device or the first available if device_hint is -1 . More... | |
CudaDenseTensor (CudaDenseTensor &&o) | |
Move ctor. More... | |
CudaDenseTensor (CudaDenseTensor const &o) | |
Copy ctor. More... | |
CudaDenseTensor (DenseTensor< rank, Scalar > const &dt) | |
Creates a copy of the supplied host-based dense tensor. More... | |
CudaDenseTensor (DenseTensor< rank, Scalar > const &dt, int device_hint) | |
Creates a copy of the supplied host-based dense tensor on the specified device device_hint . More... | |
CudaDenseTensor (std::initializer_list< Index > const dims_, int device_hint=-1) | |
Overload for initializer list. More... | |
Index | dim (Index which) const |
Returns the size of the which -th dimension, 1-indexed. More... | |
CudaPtr< Scalar > | end () |
Pointer one past the end of array. More... | |
CudaPtr< const Scalar > | end () const |
Pointer one past the end of const array. More... | |
CudaDynArray< Scalar > & | get_data () |
Returns a writeable reference to the private data member. More... | |
CudaDynArray< Scalar > const & | get_data () const |
Returns a const reference to the private data member. More... | |
int | get_device () const |
Returns the device hosting data or -1 if either no device is used or data is the nullptr. More... | |
Coord | getDims () const |
Returns an array of dimensions. More... | |
ScalarBase< Scalar >::type | normSqd () const |
Returns the squared norm of this tensor. More... | |
operator DenseTensor< rank, Scalar > () const | |
Conversion operator to a standard-memory DenseTensor. More... | |
CudaDenseTensor & | operator= (CudaDenseTensor &&o) |
Move assignment op. More... | |
CudaDenseTensor & | operator= (CudaDenseTensor const &o) |
Copy assingment op. More... | |
template<typename Archive > | |
void | serialize (Archive &ar, const unsigned int in_version) |
Boost archiving. More... | |
Size | size () const |
Returns the number of entries in this tensor. More... | |
Public Attributes | |
Coord | dims |
The dimensions of the tensor, i.e. More... | |
Static Public Attributes | |
static constexpr unsigned int | version = 1 |
Bump this if any of the above change. More... | |
Private Member Functions | |
void | invalidate_normSqd_cache () |
Invalidates the stored norm. More... | |
Private Attributes | |
CudaDynArray< Scalar > | data |
Backing data for this dense tensor. More... | |
ScalarBase< Scalar >::type | normSqd_cache = NAN |
Caching of the squared norm of this tensor. More... | |
std::mutex | normSqd_cache_mtx |
Mutex protecting norm_cache. More... | |
A dense tensor using CUDA for storage and computing if SYTEN_USE_CUDA
is defined.
The class also compiles if this is not set and then simply uses standard memory (at reduced performance).
This call can only be instantiated with standard scalars, i.e. floats, doubles or std::complex versions thereof.