53 #ifndef AMESOS2_BASKER_DEF_HPP 54 #define AMESOS2_BASKER_DEF_HPP 56 #include <Teuchos_Tuple.hpp> 57 #include <Teuchos_ParameterList.hpp> 58 #include <Teuchos_StandardParameterEntryValidators.hpp> 66 template <
class Matrix,
class Vector>
67 Basker<Matrix,Vector>::Basker(
68 Teuchos::RCP<const Matrix> A,
69 Teuchos::RCP<Vector> X,
70 Teuchos::RCP<const Vector> B )
84 template <
class Matrix,
class Vector>
85 Basker<Matrix,Vector>::~Basker( )
90 template<
class Matrix,
class Vector>
96 #ifdef HAVE_AMESOS2_TIMERS 97 Teuchos::TimeMonitor preOrderTimer(this->
timers_.preOrderTime_);
104 template <
class Matrix,
class Vector>
114 template <
class Matrix,
class Vector>
123 #ifdef HAVE_AMESOS2_TIMERS 124 Teuchos::TimeMonitor numFactTimer(this->
timers_.numFactTime_);
127 #ifdef HAVE_AMESOS2_VERBOSE_DEBUG 128 std::cout <<
"Basker:: Before numeric factorization" << std::endl;
129 std::cout <<
"nzvals_ : " <<
nzvals_.toString() << std::endl;
130 std::cout <<
"rowind_ : " <<
rowind_.toString() << std::endl;
131 std::cout <<
"colptr_ : " <<
colptr_.toString() << std::endl;
141 Teuchos::broadcast(*(this->
matrixA_->getComm()), 0, &info);
145 TEUCHOS_TEST_FOR_EXCEPTION( (info == -1) ,
147 "Basker: Could not alloc space for L and U");
148 TEUCHOS_TEST_FOR_EXCEPTION( (info == -2),
150 "Basker: Could not alloc needed work space");
151 TEUCHOS_TEST_FOR_EXCEPTION( (info == -3) ,
153 "Basker: Could not alloc additional memory needed for L and U");
154 TEUCHOS_TEST_FOR_EXCEPTION( (info > 0) ,
156 "Basker: Zero pivot found at: " << info );
162 template <
class Matrix,
class Vector>
170 const global_size_type ld_rhs = this->
root_ ? X->getGlobalLength() : 0;
171 const size_t nrhs = X->getGlobalNumVectors();
173 const size_t val_store_size = as<size_t>(ld_rhs * nrhs);
175 xvals_.resize(val_store_size);
176 bvals_.resize(val_store_size);
179 #ifdef HAVE_AMESOS2_TIMERS 180 Teuchos::TimeMonitor mvConvTimer(this->
timers_.vecConvTime_);
181 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
184 slu_type>::do_get(B,
bvals_(),as<size_t>(ld_rhs),
192 #ifdef HAVE_AMESOS2_TIMERS 193 Teuchos::TimeMonitor solveTimer(this->
timers_.solveTime_);
196 ierr = basker.solveMultiple(nrhs,
bvals_.getRawPtr(),
xvals_.getRawPtr());
202 Teuchos::broadcast(*(this->
getComm()), 0, &ierr);
204 TEUCHOS_TEST_FOR_EXCEPTION( ierr > 0,
206 "Encountered zero diag element at: " << ierr);
207 TEUCHOS_TEST_FOR_EXCEPTION( ierr == -1,
209 "Could not alloc needed working memory for solve" );
212 #ifdef HAVE_AMESOS2_TIMERS 213 Teuchos::TimeMonitor redistTimer(this->
timers_.vecRedistTime_);
226 template <
class Matrix,
class Vector>
235 template <
class Matrix,
class Vector>
240 using Teuchos::getIntegralValue;
241 using Teuchos::ParameterEntryValidator;
245 if(parameterList->isParameter(
"Trans"))
249 template <
class Matrix,
class Vector>
250 Teuchos::RCP<const Teuchos::ParameterList>
253 using Teuchos::ParameterList;
255 static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
257 if( is_null(valid_params) ){
258 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
260 pl->set(
"alnnz", 2,
"Approx number of nonzeros in L, default is 2*nnz(A)");
261 pl->set(
"aunnx", 2,
"Approx number of nonzeros in I, default is 2*nnz(U)");
269 template <
class Matrix,
class Vector>
275 if(current_phase == SOLVE)
return (
false);
277 #ifdef HAVE_AMESOS2_TIMERS 278 Teuchos::TimeMonitor convTimer(this->
timers_.mtxConvTime_);
290 local_ordinal_type nnz_ret = 0;
292 #ifdef HAVE_AMESOS2_TIMERS 293 Teuchos::TimeMonitor mtxRedistTimer( this->
timers_.mtxRedistTime_ );
304 TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != as<local_ordinal_type>(this->
globalNumNonZeros_),
306 "Did not get the expected number of non-zero vals");
313 template<
class Matrix,
class Vector>
319 #endif // AMESOS2_Basker_DEF_HPP Definition: basker.cpp:35
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
global_size_type globalNumCols_
Number of global columns in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:479
bool root_
If true, then this is the root processor.
Definition: Amesos2_SolverCore_decl.hpp:507
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:476
Teuchos::Array< slu_type > bvals_
Persisting 1D store for B.
Definition: Amesos2_Basker_decl.hpp:187
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Basker_def.hpp:271
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:243
Definition: Amesos2_TypeDecl.hpp:142
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Basker_def.hpp:251
Teuchos::Array< local_ordinal_type > colptr_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Basker_decl.hpp:182
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
A generic helper class for getting a CCS representation of a Matrix.
Definition: Amesos2_Util.hpp:575
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:363
Amesos2 interface to the Baker package.
Definition: Amesos2_Basker_decl.hpp:72
Amesos2 Basker declarations.
Teuchos::Array< local_ordinal_type > rowind_
Stores the location in Ai_ and Aval_ that starts row j.
Definition: Amesos2_Basker_decl.hpp:180
Teuchos::Array< slu_type > xvals_
Persisting 1D store for X.
Definition: Amesos2_Basker_decl.hpp:185
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
Teuchos::Array< slu_type > nzvals_
Stores the values of the nonzero entries for Basker.
Definition: Amesos2_Basker_decl.hpp:178
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Basker_def.hpp:228
global_size_type globalNumNonZeros_
Number of global non-zero values in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:482
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Basker_def.hpp:92
Definition: Amesos2_TypeDecl.hpp:127
Timers timers_
Various timing statistics.
Definition: Amesos2_SolverCore_decl.hpp:498
int numericFactorization_impl()
Basker specific numeric factorization.
Definition: Amesos2_Basker_def.hpp:116
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:296
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:175
Teuchos::RCP< const MatrixAdapter< Matrix > > matrixA_
The LHS operator.
Definition: Amesos2_SolverCore_decl.hpp:455
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Basker specific solve.
Definition: Amesos2_Basker_def.hpp:164