class gpr::linalg::CusolverEighLib

Overview

#include <gpr/linalg/CusolverEigh.h>
 
class CusolverEighLib {
public:
    // structs
 
    struct Impl;
 
    // methods
 
    static CusolverEighLib& instance();
    static void setVerbose(bool verbose);
    bool available() const;
    bool allEigenpairs(const Eigen::MatrixXd& sym, Eigen::VectorXd& evals, Eigen::MatrixXd& evecs) const;
    bool gemmNN(const Eigen::MatrixXd& A, const Eigen::MatrixXd& B, Eigen::MatrixXd& C) const;
    bool trsmLowerResident(std::uint64_t epoch, const Eigen::MatrixXd& L, Eigen::MatrixXd& B) const;
 
private:
    // construction
 
    ~CusolverEighLib();
};

Detailed Documentation

Methods

static void setVerbose(bool verbose)

Loader/step chatter on stderr. Wired from the GP report_level (>= 3); failures print regardless of this flag. Set before the first available() /allEigenpairs() call to cover dlopen loading.

bool available() const

True if the cuSOLVER + cudart symbols loaded and a CUDA device is usable. When false, allEigenpairs() always returns false.

bool allEigenpairs(const Eigen::MatrixXd& sym, Eigen::VectorXd& evals, Eigen::MatrixXd& evecs) const

Full symmetric eigendecomposition via cusolverDnDsyevd.

On success evals holds all eigenvalues in ASCENDING order and evecs the corresponding orthonormal eigenvectors as columns (matching Eigen::SelfAdjointEigenSolver and LAPACK dsyevr range ‘A’). sym must be square; only its lower triangle is read. Returns false on any device/solver error (the caller falls back to the CPU path).

bool gemmNN(const Eigen::MatrixXd& A, const Eigen::MatrixXd& B, Eigen::MatrixXd& C) const

C = A * B via cublasDgemm. Column-major end to end, no transposes. Returns false below the dispatch floor or on any device error (the caller falls back to the Eigen product).

bool trsmLowerResident(std::uint64_t epoch, const Eigen::MatrixXd& L, Eigen::MatrixXd& B) const

Solve L X = B in place for a lower-triangular L that stays on the device between calls: the factor is uploaded when epoch or its order changes and reused otherwise, so a run of posterior variance queries against one training factor pays the upload once. Returns false below the dispatch floor or on any device error (the caller falls back to the Eigen triangular solve; B is then untouched).