Loading...
Searching...
No Matches
TeamFactor.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3#pragma once
4
5#include <Eigen/Core>
6#include <cstdint>
7
8namespace gpr::linalg {
9
14[[nodiscard]] std::int64_t teamPanelWidth();
15
19[[nodiscard]] bool teamPanelBitsIndependent();
20
23[[nodiscard]] double teamSolveWallSeconds();
25void teamAddSolveWall(double seconds);
26
31public:
32 enum class Kind { Factor, Solve };
33 explicit KernelWall(Kind kind) noexcept;
35 KernelWall(const KernelWall&) = delete;
36 KernelWall& operator=(const KernelWall&) = delete;
37
38private:
39 Kind kind_;
40 bool outermost_;
41 std::int64_t start_ns_;
42};
43
47
50void teamSymmetricGram(const double* b, std::int64_t ldb, double* c,
51 std::int64_t ldc, std::int64_t n);
52
55[[nodiscard]] double teamFactorWallSeconds();
57
61[[nodiscard]] bool teamParallelPays(double flops);
62
67bool teamCholeskyLower(double* lower, std::int64_t lda, std::int64_t n);
68
72void teamSolveLower(const double* lower, std::int64_t lda, bool lower_factor,
73 double* rhs, std::int64_t ldb, std::int64_t n,
74 std::int64_t cols);
75
80void teamSolveLowerVector(const double* lower, std::int64_t lda,
81 bool lower_factor, double* rhs, std::int64_t n);
82
83inline bool teamCholeskyLower(Eigen::Ref<Eigen::MatrixXd> lower)
84{
85 if (lower.rows() != lower.cols()) return false;
86 return teamCholeskyLower(lower.data(), lower.outerStride(), lower.rows());
87}
88
89inline void teamSolveLower(const Eigen::Ref<const Eigen::MatrixXd>& lower,
90 bool lower_factor, Eigen::Ref<Eigen::MatrixXd> rhs)
91{
92 teamSolveLower(lower.data(), lower.outerStride(), lower_factor, rhs.data(),
93 rhs.outerStride(), lower.rows(), rhs.cols());
94}
95
96inline void teamSolveLowerVector(const Eigen::Ref<const Eigen::MatrixXd>& lower,
97 bool lower_factor,
98 Eigen::Ref<Eigen::VectorXd> rhs)
99{
100 teamSolveLowerVector(lower.data(), lower.outerStride(), lower_factor,
101 rhs.data(), lower.rows());
102}
103
104} // namespace gpr::linalg
KernelWall & operator=(const KernelWall &)=delete
KernelWall(Kind kind) noexcept
KernelWall(const KernelWall &)=delete
Dense and structured linear algebra behind the GP: Cholesky and eigen solvers, linear operators,...
void teamFactorWallReset()
void teamSolveLowerVector(const double *lower, std::int64_t lda, bool lower_factor, double *rhs, std::int64_t n)
void teamSolveLower(const double *lower, std::int64_t lda, bool lower_factor, double *rhs, std::int64_t ldb, std::int64_t n, std::int64_t cols)
double teamFactorWallSeconds()
void teamSymmetricGram(const double *b, std::int64_t ldb, double *c, std::int64_t ldc, std::int64_t n)
double teamSolveWallSeconds()
bool teamParallelPays(double flops)
bool teamPanelBitsIndependent()
void teamSolveWallReset()
bool teamCholeskyLower(double *lower, std::int64_t lda, std::int64_t n)
void teamAddSolveWall(double seconds)
std::int64_t teamPanelWidth()