44 #include <Epetra_Operator.h> 45 #include <Epetra_CrsMatrix.h> 46 #include <Epetra_LinearProblem.h> 47 #include <Amesos_BaseSolver.h> 48 #include <Ifpack_Preconditioner.h> 49 #include <Epetra_MultiVector.h> 51 #include "shylu_probing_operator.h" 55 ShyLU_Probing_Operator::ShyLU_Probing_Operator(
72 localDRowMap_ = localDRowMap;
73 ResetTempVectors(nvectors);
81 matvec_time_ = RCP<Time>(
new Time(
"First 2 Matvec time in prober: "));
82 localize_time_ = RCP<Time>(
new Time(
"Localize time in prober: "));
83 trisolve_time_ = RCP<Time>(
new Time(
"Triangular solve time in prober: "));
84 dist_time_ = RCP<Time>(
new Time(
"Distribute time in prober: "));
85 matvec2_time_ = RCP<Time>(
new Time(
"Second 1 matvec time in prober: "));
86 apply_time_ = RCP<Time>(
new Time(
"Apply time in prober: "));
87 update_time_ = RCP<Time>(
new Time(
"Update time in prober: "));
91 int ShyLU_Probing_Operator::SetUseTranspose(
bool useTranspose)
100 apply_time_->start();
109 matvec_time_->start();
112 err = G_->
Multiply(
false, X, *temp2);
115 err = C_->
Multiply(
false, X, *temp);
127 err = C_->
Multiply(
false, Xl, *temp);
132 matvec_time_->stop();
138 cout <<
"DEBUG MODE" << endl;
141 int gids[nrows], gids1[nrows];
145 for (
int i = 0; i < nrows; i++)
147 assert(gids[i] == gids1[i]);
152 localize_time_->start();
164 assert(lda == nrows);
167 for (
int v = 0; v < nvectors; v++)
169 for (
int i = 0; i < nrows; i++)
178 localize_time_->stop();
179 trisolve_time_->start();
193 if (config_->amesosForDiagonal)
197 ssym_->ReIdx_LP->fwd();
201 ifSolver_->ApplyInverse(*temp, *localX);
204 trisolve_time_->stop();
215 for (
int v = 0; v < nvectors; v++)
217 for (
int i = 0; i < nrows; i++)
227 matvec2_time_->start();
250 matvec2_time_->stop();
251 update_time_->start();
254 err = Y.
Update(1.0, *temp2, -1.0);
259 update_time_->stop();
266 void ShyLU_Probing_Operator::PrintTimingInfo()
269 cout << matvec_time_->name()<< matvec_time_->totalElapsedTime() << endl;
270 cout << localize_time_->name()<< localize_time_->totalElapsedTime() << endl;
271 cout << trisolve_time_->name()<< trisolve_time_->totalElapsedTime() << endl;
272 cout << dist_time_->name() <<dist_time_->totalElapsedTime() << endl;
273 cout << matvec2_time_->name() <<matvec2_time_->totalElapsedTime() << endl;
274 cout << update_time_->name() <<update_time_->totalElapsedTime() << endl;
275 cout << apply_time_->name() <<apply_time_->totalElapsedTime() << endl;
279 void ShyLU_Probing_Operator::ResetTempVectors(
int nvectors)
282 nvectors_ = nvectors;
283 if (nvectors_ == 0)
return;
285 if (nvectors <= ssym_->Drhs->NumVectors())
308 ssym_->ReIdx_LP->fwd();
317 double ShyLU_Probing_Operator::NormInf()
const 322 const char* ShyLU_Probing_Operator::Label()
const 324 return "Shylu probing";
327 bool ShyLU_Probing_Operator::UseTranspose()
const 332 bool ShyLU_Probing_Operator::HasNormInf()
const 337 const Epetra_Comm& ShyLU_Probing_Operator::Comm()
const 342 const Epetra_Map& ShyLU_Probing_Operator::OperatorDomainMap()
const 348 const Epetra_Map& ShyLU_Probing_Operator::OperatorRangeMap()
const const Epetra_Map & RowMap() const
const Epetra_BlockMap & Map() const
int MyGlobalElements(int *MyGlobalElementList) const
int ReplaceMyValue(int MyRow, int VectorIndex, double ScalarValue)
void SetLHS(Epetra_MultiVector *X)
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
const Epetra_Comm & Comm() const
const Epetra_Map & RangeMap() const
int NumMyElements() const
void SetRHS(Epetra_MultiVector *B)
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
virtual int NumProc() const=0
int NumGlobalElements() const
int ExtractView(double **A, int *MyLDA) const
const Epetra_Map & DomainMap() const