class gpr::linalg::KokkosWorkspace¶
Overview¶
Device copy of one physical host factor plus reusable device buffers. More…
#include <gpr/linalg/KokkosWorkspace.h>
class KokkosWorkspace {
public:
// structs
struct Impl;
// construction
KokkosWorkspace();
KokkosWorkspace(const KokkosWorkspace&);
~KokkosWorkspace();
// methods
KokkosWorkspace& operator=(const KokkosWorkspace&);
EigenMatrix forward(const EigenMatrix& factor, const EigenMatrix& rhs);
EigenMatrix backward(const EigenMatrix& factor, const EigenMatrix& rhs);
EigenMatrix solve(const EigenMatrix& factor, const EigenMatrix& rhs);
Eigen::VectorXd squaredNorms(const EigenMatrix& factor, const EigenMatrix& rhs);
EigenMatrix inverse(const EigenMatrix& factor);
KokkosTransferStats transferStats() const;
void resetTransferStats();
void clear();
};
Detailed Documentation¶
Device copy of one physical host factor plus reusable device buffers. Every call takes the factor explicitly. The resident copy is reused only when the supplied factor has the same shape and identical stored entries as the host witness of the last upload; any other factor, including the same storage after in-place mutation, is uploaded again. Inputs and results remain host matrices. Calls on one workspace are serialized. Device storage is released at the start of Kokkos::finalize, after which device operations throw std::logic_error.
The execution-space state is created on the first call. A default-constructed workspace is empty, so a non-Kokkos build can embed one without linking the Kokkos runtime.
Methods¶
EigenMatrix forward(const EigenMatrix& factor, const EigenMatrix& rhs)
L X = B.
EigenMatrix backward(const EigenMatrix& factor, const EigenMatrix& rhs)
L^T X = B.
EigenMatrix solve(const EigenMatrix& factor, const EigenMatrix& rhs)
L L^T X = B with one right-hand-side upload and one result download.
Eigen::VectorXd squaredNorms(const EigenMatrix& factor, const EigenMatrix& rhs)
Squared column norms of L^{-1} B; only the norms are downloaded.
EigenMatrix inverse(const EigenMatrix& factor)
(L L^T)^{-1}, formed on the device from the resident factor.
void resetTransferStats()
Zeroes the counters; the resident factor is kept.
void clear()
Releases the resident factor and all device buffers; counters are kept.