Factor the SPD matrix in place. Returns true on success, false on non-PD diagonal tile (caller can retry with extra jitter).
103 {
104 for (int j = 0; j < n_tiles_; ++j) {
105
109 if (diag_owner == rank_) {
111 Eigen::LLT<EigenMatrix> llt(A_jj);
112 if (llt.info() == Eigen::NumericalIssue) return false;
113 A_jj = llt.matrixL();
114 L_jj = A_jj;
115 }
116#ifdef GPR_HAVE_MPI
117 if (nprocs_ > 1) {
118 MPI_Bcast(L_jj.data(), bj * bj, MPI_DOUBLE, diag_owner,
119 MPI_COMM_WORLD);
120 }
121#endif
122
123
124
125 for (int i = j + 1; i < n_tiles_; ++i) {
126 const int panel_owner =
owner_of(i);
127 if (panel_owner != rank_) continue;
130
131 A_ij = L_jj.template triangularView<Eigen::Lower>()
132 .transpose()
133 .template solve<Eigen::OnTheRight>(A_ij);
134 (void)bi;
135 }
136
137
138
139
140
141
142 std::vector<EigenMatrix> panel_col(n_tiles_);
143 for (int i = j + 1; i < n_tiles_; ++i) {
144 const int panel_owner =
owner_of(i);
146 panel_col[i].resize(bi, bj);
147 if (panel_owner == rank_) {
148 panel_col[i] = tiles_[
index(i, j)];
149 }
150#ifdef GPR_HAVE_MPI
151 if (nprocs_ > 1) {
152 MPI_Bcast(panel_col[i].data(), bi * bj, MPI_DOUBLE,
153 panel_owner, MPI_COMM_WORLD);
154 }
155#endif
156 }
157
158 for (int i = j + 1; i < n_tiles_; ++i) {
160 if (row_owner != rank_) continue;
161 for (int k = j + 1; k <= i; ++k) {
163 A_ik.noalias() -= panel_col[i] * panel_col[k].transpose();
164 }
165 }
166 }
167 return true;
168 }
int owner_of(int i_tile) const noexcept
Tile owner is a deterministic function of (i, nprocs).
size_t index(int i, int j) const noexcept
Linear index into the tiles_ vector.
int rows_of(int i_tile) const noexcept
Tile size at (i, j) accounting for the trailing remainder.