Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP (Do Not Merge!!): Belos Small Dense Matrix Abstraction #11837

Draft
wants to merge 111 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
83b8a09
Added DenseMatrix template param to Belos::MultiVecTraits.
jennloe Dec 30, 2022
50b62e0
Add Dense template paramter to solver manager base class and solver f…
jennloe Dec 30, 2022
38ee352
Remove Serial Dense from ICGSOrthoMgr
jennloe Mar 1, 2023
98c05e1
Removed Serial Dense from MatOrthoMgr.
jennloe Mar 1, 2023
85e91af
Removed SerialDense from OrthoMgr.
jennloe Mar 1, 2023
ed65bd3
Added Dense param to blockGMRESIter.
jennloe Mar 1, 2023
e418323
Added template param to Gmres iterations.
jennloe Mar 1, 2023
b53c6ac
Add dense param to GMRES sol mgr and base class.
jennloe Mar 1, 2023
cad90fc
Added template param to FGmres iter and OrthoMgrFactory.
jennloe Mar 1, 2023
bceeb9c
First attempt at outlining a few Dense Matrix Traits.
jennloe Mar 2, 2023
637264e
Add header file to Belos src needed for Thyra to compile.
jennloe Mar 8, 2023
05c5b1e
Updated DenseMatrixAdapter functions. Wrote a partial Teuchos Serial …
jennloe Mar 8, 2023
409aecb
Expanded MultiVec Traits and corresponding Teuchos adapter, which pas…
jennloe Mar 14, 2023
f8b93a9
BlockGmres solver partially running through dense mat traits
jennloe Mar 16, 2023
bc2c0b2
Add default constructor to dense mat taits.
jennloe Mar 18, 2023
b4698b6
Update reshape traits fct to have init to zero option.
jennloe Mar 18, 2023
fbb537e
Added more functions for GMRES transition.
jennloe Mar 20, 2023
4abf100
Converted BlockGmresIter outer layer to use abstract dense.
jennloe Mar 20, 2023
52c7a73
Added Frobenius norm to dense traits.
jennloe Mar 21, 2023
d8cc88c
Converted ICGS to dense abstract interface.
jennloe Mar 21, 2023
5cffd78
First attempt at Kokkos adapter.
jennloe Mar 27, 2023
24e08e9
Minor adjustment of comments.
jennloe Mar 28, 2023
29fe76f
Kokkos Dense adapter now passes dense unit test.
jennloe Mar 28, 2023
bc46501
Reorganized Tpetra MV traits to allow future specialization for Kokko…
jennloe Apr 25, 2023
dc88f3f
We now have a working Kokkos::View Dense adapter that is passing basic
jennloe May 2, 2023
0834ef6
Converted IMGS OrthoMgr to new Dense interface.
jennloe May 3, 2023
04c57ac
Fixed build error in ICGS.
jennloe May 3, 2023
c54ab12
Incorporated Dense Abstract interface into status tests.
jennloe May 4, 2023
7bdd035
GMRES spaces experiment.
jennloe May 8, 2023
51a5190
Converted BelosLSQR and added ValueConst function explicitly in the n…
jennloe Jun 26, 2023
f373363
Finally got the Kokkos Dense + Tpetra Block GMRES test building and p…
jennloe Jul 7, 2023
18c0f79
Got DenseMat template param added to all needed solvers at the top le…
jennloe Jul 24, 2023
e7bf8c9
Test many dense scalar types with SerialDenseMat Teuchos traits, via …
jennloe Jul 31, 2023
f95a2dd
Remove requirement to mark rawptr data modified. Fix two instances of…
jennloe Jul 31, 2023
9712831
Added SyncHostToDevice function for DenseMatTraits.
jennloe Jul 31, 2023
52c9ada
Added syncs around TRSM. No change in failing test.
jennloe Jul 31, 2023
b971e52
Added syncs to LS problem solve. No change in failing test.
jennloe Jul 31, 2023
db93610
Added extra syncs. Encountering deep copy error. Added debug statemen…
jennloe Aug 14, 2023
8d170a2
Converted Minres to abstract layer; works with Teuchos dense backend.
jennloe Jul 26, 2023
9c66fba
Minres solver converted and runs with KK dense on CPU.
jennloe Jul 31, 2023
cfd5e47
Fixed a deep copy issue for strided matrices. Also added some couts f…
jennloe Sep 18, 2023
97b4647
Fix Kokkos stride method for dense matrix traits and small code cleanup
hkthorn Oct 10, 2023
260865d
Improve integration of dense matrix traits into LSQR
hkthorn Oct 17, 2023
637cc49
Converts BiCGStab and TFQMR solver to use dense matrix template
hkthorn Oct 17, 2023
5f6e2cb
Removes unused implicit residual norm status test
hkthorn Oct 17, 2023
253a2a8
Remove unused Teuchos_SerialDenseMatrix.hpp header file
hkthorn Oct 17, 2023
b1b3f2a
Removes default argument for dense matrix template argument
hkthorn Oct 17, 2023
85d1d6c
Minor change to binary name for Kokkos::DualView MINRES test
hkthorn Oct 17, 2023
6eebe1d
Converts PCPG solver to use dense matrix traits
hkthorn Oct 17, 2023
f839c44
Removes unused typedef
hkthorn Oct 19, 2023
66262aa
Fixes GCRODR template to include dense matrix argument
hkthorn Oct 19, 2023
62919e5
Removes duplicate definition of MINRES directory
hkthorn Oct 19, 2023
11b4164
Fixes MINRES test so it will compile.
hkthorn Oct 19, 2023
a0ffa8d
Fixes MVOPTester code for Kokkos. Now this test passes on ascicgpu030.
hkthorn Oct 23, 2023
af3695e
Fixes MINRES solver for Kokkos. Now the MINRES test passes on ascicg…
hkthorn Oct 23, 2023
2b8da46
Finishes integration of dense matrix traits into PCPG
hkthorn Oct 24, 2023
f0cef1a
Fixes all orthogonalization classes and testers to work with dense ma…
hkthorn Oct 25, 2023
2d207b5
Removes debugging statements
hkthorn Oct 26, 2023
8d51a01
Changes diagonal updating to use Subview/PutScalar methods
hkthorn Oct 26, 2023
78dd668
Adds Teuchos::SerialDenseMatrix test for DenseMatrixTester
hkthorn Oct 26, 2023
de1ab1d
Converts over TSQR classes in Belos to use dense matrix template argu…
hkthorn Oct 26, 2023
fcb4a94
Converts flexible GMRES to use dense matrix traits and adds test
hkthorn Oct 26, 2023
aae532d
Converts fixed-point solver to use dense matrix template
hkthorn Oct 26, 2023
50e3d4f
Adds missing override to address build warning
hkthorn Nov 2, 2023
1cf88e3
Removed unnecessary Teuchos SDM header
hkthorn Nov 2, 2023
0e92e6c
Moves pseudo-block GMRES data structures to iteration header
hkthorn Nov 3, 2023
7bf1a9b
Adds override statment to address compiler warning
hkthorn Nov 10, 2023
bff91a5
Converts single-vector CG, pseudo-block CG, and stochastic CG to DMT
hkthorn Nov 10, 2023
c588890
Removes unused serial dense matrix objects
hkthorn Nov 15, 2023
6a02aa3
Adds DenseSolver interface for block CG solver
hkthorn Dec 13, 2023
97d89d1
Fixes dense solver for Kokkos interface, clean up CG solvers
hkthorn Dec 13, 2023
dd980b3
Finished converting GMRES-variants to dense matrix traits
hkthorn Dec 15, 2023
acbaf86
Adds GMRES resolve test for Kokkos DualView, fixes templates in other…
hkthorn Dec 18, 2023
a14e7de
Fixes compile error for CommandLineProcessor
hkthorn Jun 13, 2024
0d1bcca
Fixes OrthoFactory to use dense matrix traits in template argument
hkthorn Jun 14, 2024
ff2c754
Inserts missing device to host synchronization
hkthorn Jun 14, 2024
628a854
Fixing const correctness in arguments
hkthorn Jul 31, 2024
a2875fe
Fixes CreateCopy and GetRawHostPtr, updates test
hkthorn Jul 31, 2024
f964172
Update GCRODR solver to use dense matrix traits
hkthorn Jul 31, 2024
2428820
Adds tests for GCRODR and CG solver using Kokkos::DualView dense matrix
hkthorn Aug 2, 2024
be9d1f5
Fix headers to be consistent with recent changes
hkthorn Aug 5, 2024
bab5679
Add complex-valued tests for minres, bicgstab, and gcrodr
hkthorn Aug 7, 2024
fcbfe1c
Consolidates Teuchos::ScalarTraits typedefs
hkthorn Aug 23, 2024
36c2996
Corrects use of DMT::Value to DMT::ValueConst.
hkthorn Aug 23, 2024
727a0e0
Comments out failing BiCGStab test
hkthorn Aug 23, 2024
457178f
Adding new tests to exercise orthogonalization options with GCRODR
hkthorn Aug 26, 2024
7ee85c9
Adding method to debugging output to enable better understanding of p…
hkthorn Aug 26, 2024
7cec4c2
Completes integration of DenseMatrixTraits
hkthorn Aug 26, 2024
e942779
Changes scalar values from SerialDenseMatrix to std::vector<>
hkthorn Aug 27, 2024
5986334
Moves several dense matrix objects to std::vector objects
hkthorn Aug 28, 2024
ec888a3
Remove unnecessary header
hkthorn Aug 29, 2024
e099f8b
Code cleanup to remove unnecessary dense matrix views
hkthorn Aug 30, 2024
32191b5
Final clean up before dense matrix traits transformation of RCG
hkthorn Aug 30, 2024
067bbac
Convert SerialDenseMatrix objects to dense matrix traits.
hkthorn Sep 4, 2024
8b92316
Cleans up use of MvAddMv to use Assign when more appropriate
hkthorn Sep 9, 2024
a63cbb5
Finishes migration of GEMM calls to use Teuchos::BLAS class
hkthorn Sep 9, 2024
86dd9cc
Removes unused one/zero definitions after MvAddMv -> Assign changes
hkthorn Sep 17, 2024
73e614a
Fixes RCG solver to be correct with Kokkos::DualView
hkthorn Sep 18, 2024
6871c82
Removes unused zero and one definitions
hkthorn Sep 18, 2024
8c8189b
Fix deprecated std::random_shuffle call
hkthorn Sep 25, 2024
1cf67b2
Update pseudo-block solvers for dense matrix abstraction
hkthorn Sep 25, 2024
7756006
Fixes block GCRODR to compile with updated dense matrix traits
hkthorn Sep 25, 2024
36d9743
Cleaning up unnecessary examples, per Jennifer's note, before final c…
hkthorn Sep 25, 2024
77110ca
Removes dependence of GmresIteration on Teuchos::SerialDenseMatrix
hkthorn Sep 30, 2024
f9570cb
Adds Teuchos_SerialDenseMatrix and Teuchos_SerialDenseVector headers
hkthorn Sep 30, 2024
cdee1a7
Adds some checks to avoid compiler errors on unused variables.
hkthorn Sep 30, 2024
baef027
Adds Teuchos::SerialDenseMatrix as default dense matrix in template
hkthorn Oct 2, 2024
18e1e95
Adds dense matrix traits to the partial specialization of GenResSubNorm
hkthorn Oct 2, 2024
27500da
Removes template argument with default value since default value is b…
hkthorn Oct 2, 2024
1767853
Remove unused local variables
hkthorn Oct 2, 2024
0a10375
Comment out complex GCRODR test temporarily.
hkthorn Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,21 @@ void registerSolverFactory() {
typedef double ST;
typedef Epetra_MultiVector MV;
typedef Epetra_Operator OP;
typedef Teuchos::SerialDenseMatrix<int,ST> DM;

Impl::registerSolverSubclassForTypes<BiCGStabSolMgr<ST,MV,OP>, ST, MV, OP> ("BICGSTAB");
Impl::registerSolverSubclassForTypes<BlockCGSolMgr<ST,MV,OP>, ST, MV, OP> ("BLOCK CG");
Impl::registerSolverSubclassForTypes<BlockGmresSolMgr<ST,MV,OP>, ST, MV, OP> ("BLOCK GMRES");
Impl::registerSolverSubclassForTypes<BlockCGSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("BLOCK CG");
Impl::registerSolverSubclassForTypes<BlockGmresSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("BLOCK GMRES");
Impl::registerSolverSubclassForTypes<FixedPointSolMgr<ST,MV,OP>, ST, MV, OP> ("FIXED POINT");
Impl::registerSolverSubclassForTypes<GCRODRSolMgr<ST,MV,OP>, ST, MV, OP> ("GCRODR");
Impl::registerSolverSubclassForTypes<GmresPolySolMgr<ST,MV,OP>, ST, MV, OP> ("HYBRID BLOCK GMRES");
Impl::registerSolverSubclassForTypes<LSQRSolMgr<ST,MV,OP>, ST, MV, OP> ("LSQR");
Impl::registerSolverSubclassForTypes<MinresSolMgr<ST,MV,OP>, ST, MV, OP> ("MINRES");
Impl::registerSolverSubclassForTypes<PCPGSolMgr<ST,MV,OP>, ST, MV, OP> ("PCPG");
Impl::registerSolverSubclassForTypes<PseudoBlockCGSolMgr<ST,MV,OP>, ST, MV, OP> ("PSEUDOBLOCK CG");
Impl::registerSolverSubclassForTypes<PseudoBlockGmresSolMgr<ST,MV,OP>, ST, MV, OP> ("PSEUDOBLOCK GMRES");
Impl::registerSolverSubclassForTypes<GCRODRSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("GCRODR");
Impl::registerSolverSubclassForTypes<GmresPolySolMgr<ST,MV,OP,DM>, ST, MV, OP> ("HYBRID BLOCK GMRES");
Impl::registerSolverSubclassForTypes<LSQRSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("LSQR");
Impl::registerSolverSubclassForTypes<MinresSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("MINRES");
Impl::registerSolverSubclassForTypes<PCPGSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("PCPG");
Impl::registerSolverSubclassForTypes<PseudoBlockCGSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("PSEUDOBLOCK CG");
Impl::registerSolverSubclassForTypes<PseudoBlockGmresSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("PSEUDOBLOCK GMRES");
Impl::registerSolverSubclassForTypes<PseudoBlockTFQMRSolMgr<ST,MV,OP>, ST, MV, OP> ("PSEUDOBLOCK TFQMR");
Impl::registerSolverSubclassForTypes<RCGSolMgr<ST,MV,OP>, ST, MV, OP> ("RCG");
Impl::registerSolverSubclassForTypes<RCGSolMgr<ST,MV,OP,DM>, ST, MV, OP> ("RCG");
Impl::registerSolverSubclassForTypes<TFQMRSolMgr<ST,MV,OP>, ST, MV, OP> ("TFQMR");
}

Expand Down
5 changes: 3 additions & 2 deletions packages/belos/epetra/test/MVOPTester/cxx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "BelosMVOPTester.hpp"
#include "BelosEpetraAdapter.hpp"
#include "BelosOutputManager.hpp"
#include "BelosTeuchosDenseAdapter.hpp"

#include "Teuchos_StandardCatchMacros.hpp"

Expand Down Expand Up @@ -121,7 +122,7 @@ int main(int argc, char *argv[])

// Issue several useful typedefs;
typedef Belos::MultiVec<double> EMV;
//typedef Belos::Operator<double> EOP; // unused
typedef Teuchos::SerialDenseMatrix<int, double> TDM;

// Create an Epetra_MultiVector for an initial std::vector to start the solver.
// Note that this needs to have the same number of columns as the blocksize.
Expand All @@ -135,7 +136,7 @@ int main(int argc, char *argv[])
}

// test the Epetra adapter multivector
ierr = Belos::TestMultiVecTraits<double,EMV>(MyOM,ivec);
ierr = Belos::TestMultiVecTraits<double,EMV,TDM>(MyOM,ivec);
gerr &= ierr;
if (ierr) {
MyOM->print(Belos::Warnings,"*** EpetraAdapter PASSED TestMultiVecTraits()\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ main (int argc, char *argv[])
// subclass, given a name for the subclass. The name is not the
// same as the class' syntactic name: e.g., "DKGS" is the name of
// DkgsOrthoManager.
Belos::OrthoManagerFactory< scalar_type, MV, OP > factory;
Belos::OrthoManagerFactory< scalar_type, MV, OP, serial_matrix_type > factory;
// The name of the (Mat)OrthoManager subclass to instantiate.
std::string ortho (factory.defaultName());

Expand Down Expand Up @@ -528,7 +528,7 @@ main (int argc, char *argv[])
// should return zero).
int numFailed = 0;
{
typedef Belos::Test::OrthoManagerTester<scalar_type, MV> tester_type;
typedef Belos::Test::OrthoManagerTester<scalar_type, MV, serial_matrix_type> tester_type;
debugOut << "Running OrthoManager tests..." << endl;
numFailed = tester_type::runTests (OM, isRankRevealing, S,
sizeX1, sizeX2, outMan);
Expand Down
14 changes: 8 additions & 6 deletions packages/belos/kokkos/example/GCRODRComplexKokkosExFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "BelosGCRODRSolMgr.hpp"
#include "BelosOutputManager.hpp"

#include "Teuchos_SerialDenseMatrix.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"
Expand All @@ -41,11 +42,12 @@ bool success = true;
typedef Kokkos::complex<double> ST;
typedef int OT;
typedef Kokkos::DefaultExecutionSpace EXSP;
typedef Teuchos::ScalarTraits<ST> SCT;
typedef Teuchos::ScalarTraits<ST> SCT;
typedef Teuchos::SerialDenseMatrix<int,ST>DM;
typedef SCT::magnitudeType MT;
typedef Belos::KokkosMultiVec<ST, EXSP> MV;
typedef Belos::MultiVec<ST> KMV;
typedef Belos::Operator<ST> KOP;
typedef Belos::KokkosMultiVec<ST, EXSP> MV;
typedef Belos::MultiVec<ST> KMV;
typedef Belos::Operator<ST> KOP;
typedef Belos::MultiVecTraits<ST,KMV> MVT;
typedef Belos::OperatorTraits<ST,KMV,KOP> OPT;

Expand Down Expand Up @@ -136,8 +138,8 @@ try {
// *******************************************************************
//
// Create an iterative solver manager.
RCP< Belos::SolverManager<ST,KMV,KOP> > newSolver
= rcp( new Belos::GCRODRSolMgr<ST,KMV,KOP,true>(rcpFromRef(problem), rcpFromRef(belosList)) );
RCP< Belos::SolverManager<ST,KMV,KOP,DM> > newSolver
= rcp( new Belos::GCRODRSolMgr<ST,KMV,KOP,DM,true>(rcpFromRef(problem), rcpFromRef(belosList)) );

//
// **********Print out information about problem*******************
Expand Down
2 changes: 1 addition & 1 deletion packages/belos/kokkos/example/GCRODRKokkosExFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ try {
//
// Create an iterative solver manager.
RCP< Belos::SolverManager<ST,KMV,KOP> > newSolver
= rcp( new Belos::GCRODRSolMgr<ST,KMV,KOP,true>(rcpFromRef(problem), rcpFromRef(belosList)) );
= rcp( new Belos::GCRODRSolMgr<ST,KMV,KOP>(rcpFromRef(problem), rcpFromRef(belosList)) );

//
// **********Print out information about problem*******************
Expand Down
30 changes: 14 additions & 16 deletions packages/belos/src/BelosBiCGStabIter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "BelosOperatorTraits.hpp"
#include "BelosMultiVecTraits.hpp"

#include "Teuchos_SerialDenseMatrix.hpp"
#include "Teuchos_SerialDenseVector.hpp"
#include "Teuchos_ScalarTraits.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_TimeMonitor.hpp"
Expand Down Expand Up @@ -77,15 +75,15 @@ namespace Belos {
}
};

template<class ScalarType, class MV, class OP>
class BiCGStabIter : virtual public Iteration<ScalarType,MV,OP> {
template<class ScalarType, class MV, class OP, class DM>
class BiCGStabIter : virtual public Iteration<ScalarType,MV,OP,DM> {

public:

//
// Convenience typedefs
//
typedef MultiVecTraits<ScalarType,MV> MVT;
typedef MultiVecTraits<ScalarType,MV,DM> MVT;
typedef OperatorTraits<ScalarType,MV,OP> OPT;
typedef Teuchos::ScalarTraits<ScalarType> SCT;
typedef typename SCT::magnitudeType MagnitudeType;
Expand All @@ -101,7 +99,7 @@ namespace Belos {
*/
BiCGStabIter( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
const Teuchos::RCP<OutputManager<ScalarType> > &printer,
const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > &tester,
Teuchos::ParameterList &params );

//! Destructor.
Expand Down Expand Up @@ -235,7 +233,7 @@ namespace Belos {
//
const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > lp_;
const Teuchos::RCP<OutputManager<ScalarType> > om_;
const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > stest_;
const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > stest_;

//
// Algorithmic parameters
Expand Down Expand Up @@ -277,10 +275,10 @@ namespace Belos {

//////////////////////////////////////////////////////////////////////////////////////////////////
// Constructor.
template<class ScalarType, class MV, class OP>
BiCGStabIter<ScalarType,MV,OP>::BiCGStabIter(const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
template<class ScalarType, class MV, class OP, class DM>
BiCGStabIter<ScalarType,MV,OP,DM>::BiCGStabIter(const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
const Teuchos::RCP<OutputManager<ScalarType> > &printer,
const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > &tester,
Teuchos::ParameterList &/* params */ ):
lp_(problem),
om_(printer),
Expand All @@ -295,8 +293,8 @@ namespace Belos {

//////////////////////////////////////////////////////////////////////////////////////////////////
// Initialize this iteration object
template <class ScalarType, class MV, class OP>
void BiCGStabIter<ScalarType,MV,OP>::initializeBiCGStab(BiCGStabIterationState<ScalarType,MV>& newstate)
template<class ScalarType, class MV, class OP, class DM>
void BiCGStabIter<ScalarType,MV,OP,DM>::initializeBiCGStab(BiCGStabIterationState<ScalarType,MV>& newstate)
{
// Check if there is any multivector to clone from.
Teuchos::RCP<const MV> lhsMV = lp_->getCurrLHSVec();
Expand Down Expand Up @@ -425,8 +423,8 @@ namespace Belos {

//////////////////////////////////////////////////////////////////////////////////////////////////
// Iterate until the status test informs us we should stop.
template <class ScalarType, class MV, class OP>
void BiCGStabIter<ScalarType,MV,OP>::iterate()
template<class ScalarType, class MV, class OP, class DM>
void BiCGStabIter<ScalarType,MV,OP,DM>::iterate()
{
using Teuchos::RCP;

Expand Down Expand Up @@ -588,8 +586,8 @@ namespace Belos {

//////////////////////////////////////////////////////////////////////////////////////////////////
// Iterate until the status test informs us we should stop.
template <class ScalarType, class MV, class OP>
void BiCGStabIter<ScalarType,MV,OP>::axpy(const ScalarType alpha, const MV & A,
template<class ScalarType, class MV, class OP, class DM>
void BiCGStabIter<ScalarType,MV,OP,DM>::axpy(const ScalarType alpha, const MV & A,
const std::vector<ScalarType> beta, const MV& B, MV& mv, bool minus)
{
Teuchos::RCP<const MV> A1, B1;
Expand Down
58 changes: 30 additions & 28 deletions packages/belos/src/BelosBiCGStabSolMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "BelosStatusTestCombo.hpp"
#include "BelosStatusTestOutputFactory.hpp"
#include "BelosOutputManager.hpp"

#include "BelosTeuchosDenseAdapter.hpp"
#ifdef BELOS_TEUCHOS_TIME_MONITOR
#include "Teuchos_TimeMonitor.hpp"
#endif
Expand Down Expand Up @@ -61,11 +63,11 @@ namespace Belos {
BiCGStabSolMgrLinearProblemFailure(const std::string& what_arg) : BelosError(what_arg)
{}};

template<class ScalarType, class MV, class OP>
class BiCGStabSolMgr : public SolverManager<ScalarType,MV,OP> {
template<class ScalarType, class MV, class OP, class DM = Teuchos::SerialDenseMatrix<int, ScalarType>>
class BiCGStabSolMgr : public SolverManager<ScalarType,MV,OP,DM> {

private:
typedef MultiVecTraits<ScalarType,MV> MVT;
typedef MultiVecTraits<ScalarType,MV,DM> MVT;
typedef OperatorTraits<ScalarType,MV,OP> OPT;
typedef Teuchos::ScalarTraits<ScalarType> SCT;
typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
Expand Down Expand Up @@ -99,8 +101,8 @@ namespace Belos {
virtual ~BiCGStabSolMgr() {};

//! clone for Inverted Injection (DII)
Teuchos::RCP<SolverManager<ScalarType, MV, OP> > clone () const override {
return Teuchos::rcp(new BiCGStabSolMgr<ScalarType,MV,OP>);
Teuchos::RCP<SolverManager<ScalarType, MV, OP, DM> > clone () const override {
return Teuchos::rcp(new BiCGStabSolMgr<ScalarType,MV,OP,DM>);
}
//@}

Expand Down Expand Up @@ -216,10 +218,10 @@ namespace Belos {
Teuchos::RCP<std::ostream> outputStream_;

// Status test.
Teuchos::RCP<StatusTest<ScalarType,MV,OP> > sTest_;
Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP> > maxIterTest_;
Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP> > convTest_;
Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > outputTest_;
Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > sTest_;
Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP,DM> > maxIterTest_;
Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP,DM> > convTest_;
Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP,DM> > outputTest_;

// Current parameter list.
Teuchos::RCP<Teuchos::ParameterList> params_;
Expand Down Expand Up @@ -257,8 +259,8 @@ namespace Belos {
};

// Empty Constructor
template<class ScalarType, class MV, class OP>
BiCGStabSolMgr<ScalarType,MV,OP>::BiCGStabSolMgr() :
template<class ScalarType, class MV, class OP, class DM>
BiCGStabSolMgr<ScalarType,MV,OP,DM>::BiCGStabSolMgr() :
outputStream_(Teuchos::rcpFromRef(std::cout)),
convtol_(DefaultSolverParameters::convTol),
maxIters_(maxIters_default_),
Expand All @@ -274,8 +276,8 @@ BiCGStabSolMgr<ScalarType,MV,OP>::BiCGStabSolMgr() :
{}

// Basic Constructor
template<class ScalarType, class MV, class OP>
BiCGStabSolMgr<ScalarType,MV,OP>::
template<class ScalarType, class MV, class OP, class DM>
BiCGStabSolMgr<ScalarType,MV,OP,DM>::
BiCGStabSolMgr (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
const Teuchos::RCP<Teuchos::ParameterList> &pl ) :
problem_(problem),
Expand Down Expand Up @@ -304,8 +306,8 @@ BiCGStabSolMgr (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
}
}

template<class ScalarType, class MV, class OP>
void BiCGStabSolMgr<ScalarType,MV,OP>::setParameters( const Teuchos::RCP<Teuchos::ParameterList> &params )
template<class ScalarType, class MV, class OP, class DM>
void BiCGStabSolMgr<ScalarType,MV,OP,DM>::setParameters( const Teuchos::RCP<Teuchos::ParameterList> &params )
{
using Teuchos::ParameterList;
using Teuchos::parameterList;
Expand Down Expand Up @@ -400,8 +402,8 @@ void BiCGStabSolMgr<ScalarType,MV,OP>::setParameters( const Teuchos::RCP<Teuchos
}

// Convergence
typedef Belos::StatusTestCombo<ScalarType,MV,OP> StatusTestCombo_t;
typedef Belos::StatusTestGenResNorm<ScalarType,MV,OP> StatusTestResNorm_t;
typedef Belos::StatusTestCombo<ScalarType,MV,OP,DM> StatusTestCombo_t;
typedef Belos::StatusTestGenResNorm<ScalarType,MV,OP,DM> StatusTestResNorm_t;

// Check for convergence tolerance
if (params->isParameter("Convergence Tolerance")) {
Expand Down Expand Up @@ -482,7 +484,7 @@ void BiCGStabSolMgr<ScalarType,MV,OP>::setParameters( const Teuchos::RCP<Teuchos

// Basic test checks maximum iterations and native residual.
if (maxIterTest_ == Teuchos::null)
maxIterTest_ = Teuchos::rcp( new StatusTestMaxIters<ScalarType,MV,OP>( maxIters_ ) );
maxIterTest_ = Teuchos::rcp( new StatusTestMaxIters<ScalarType,MV,OP,DM>( maxIters_ ) );

// Implicit residual test, using the native residual to determine if convergence was achieved.
if (convTest_ == Teuchos::null || newResTest) {
Expand All @@ -497,7 +499,7 @@ void BiCGStabSolMgr<ScalarType,MV,OP>::setParameters( const Teuchos::RCP<Teuchos

// Create the status test output class.
// This class manages and formats the output from the status test.
StatusTestOutputFactory<ScalarType,MV,OP> stoFactory( outputStyle_ );
StatusTestOutputFactory<ScalarType,MV,OP,DM> stoFactory( outputStyle_ );
outputTest_ = stoFactory.create( printer_, sTest_, outputFreq_, Passed+Failed+Undefined );

// Set the solver string for the output test
Expand All @@ -519,9 +521,9 @@ void BiCGStabSolMgr<ScalarType,MV,OP>::setParameters( const Teuchos::RCP<Teuchos
}


template<class ScalarType, class MV, class OP>
template<class ScalarType, class MV, class OP, class DM>
Teuchos::RCP<const Teuchos::ParameterList>
BiCGStabSolMgr<ScalarType,MV,OP>::getValidParameters() const
BiCGStabSolMgr<ScalarType,MV,OP,DM>::getValidParameters() const
{
using Teuchos::ParameterList;
using Teuchos::parameterList;
Expand Down Expand Up @@ -575,8 +577,8 @@ BiCGStabSolMgr<ScalarType,MV,OP>::getValidParameters() const
}


template<class ScalarType, class MV, class OP>
ReturnType BiCGStabSolMgr<ScalarType,MV,OP>::solve ()
template<class ScalarType, class MV, class OP, class DM>
ReturnType BiCGStabSolMgr<ScalarType,MV,OP,DM>::solve ()
{
// Set the current parameters if they were not set before.
// NOTE: This may occur if the user generated the solver manager with the default constructor and
Expand Down Expand Up @@ -624,8 +626,8 @@ ReturnType BiCGStabSolMgr<ScalarType,MV,OP>::solve ()
//////////////////////////////////////////////////////////////////////////////////////
// Pseudo-Block BiCGStab solver

Teuchos::RCP<BiCGStabIter<ScalarType,MV,OP> > bicgstab_iter
= Teuchos::rcp( new BiCGStabIter<ScalarType,MV,OP>(problem_,printer_,outputTest_,plist) );
Teuchos::RCP<BiCGStabIter<ScalarType,MV,OP,DM> > bicgstab_iter
= Teuchos::rcp( new BiCGStabIter<ScalarType,MV,OP,DM>(problem_,printer_,outputTest_,plist) );

// Enter solve() iterations
{
Expand Down Expand Up @@ -669,7 +671,7 @@ ReturnType BiCGStabSolMgr<ScalarType,MV,OP>::solve ()
if ( convTest_->getStatus() == Passed ) {

// Figure out which linear systems converged.
std::vector<int> convIdx = Teuchos::rcp_dynamic_cast<StatusTestGenResNorm<ScalarType,MV,OP> >(convTest_)->convIndices();
std::vector<int> convIdx = Teuchos::rcp_dynamic_cast<StatusTestGenResNorm<ScalarType,MV,OP,DM> >(convTest_)->convIndices();

// If the number of converged linear systems is equal to the
// number of current linear systems, then we are done with this block.
Expand Down Expand Up @@ -823,8 +825,8 @@ ReturnType BiCGStabSolMgr<ScalarType,MV,OP>::solve ()
}

// This method requires the solver manager to return a std::string that describes itself.
template<class ScalarType, class MV, class OP>
std::string BiCGStabSolMgr<ScalarType,MV,OP>::description() const
template<class ScalarType, class MV, class OP, class DM>
std::string BiCGStabSolMgr<ScalarType,MV,OP,DM>::description() const
{
std::ostringstream oss;
oss << "Belos::BiCGStabSolMgr<...,"<<Teuchos::ScalarTraits<ScalarType>::name()<<">";
Expand Down
Loading
Loading