![]() |
Eigen-Contrib
5.0.1
|
#include <contrib/Eigen/src/GPU/DeviceScalar.h>
RAII wrapper for a scalar in GPU device memory.
Public Member Functions | |
| DeviceScalar (const DeviceScalar &o) | |
| DeviceScalar (cudaStream_t stream=nullptr) | |
| Scalar | get () const |
| operator Scalar () const | |
| DeviceScalar & | operator= (const DeviceScalar &o) |
|
inlineexplicit |
Allocate an uninitialized device scalar. Contents are undefined until written, e.g. by cuBLAS dot/nrm2 under POINTER_MODE_DEVICE.
|
inline |
Deep copy: a device-to-device cudaMemcpyAsync on the source's stream, no host round trip. Provided so that generic code returning a DeviceScalar by value from a const reference (numext::real in Eigen's iterative solver templates) compiles; explicit code should move instead.
|
inline |
Download from device, synchronizing the stream.
|
inline |
Implicit conversion, enabling Scalar alpha = deviceScalar and if (deviceScalar < threshold). Triggers a sync.
|
inline |
Copy assignment adopts the source's stream. Copy construction followed by a move releases the previous buffer instead of writing into it: a write on the source's stream could race with reads still queued on this scalar's old stream.