Amesos2 - Direct Sparse Solver Interfaces Version of the Day
Amesos2_Superlumt_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Amesos2: Templated Direct Sparse Solver Package
4//
5// Copyright 2011 NTESS and the Amesos2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
18#ifndef AMESOS2_SUPERLUMT_DEF_HPP
19#define AMESOS2_SUPERLUMT_DEF_HPP
20
21#include <Teuchos_Tuple.hpp>
22#include <Teuchos_ParameterList.hpp>
23#include <Teuchos_StandardParameterEntryValidators.hpp>
24
26#include "Amesos2_Util.hpp"
27
28
29namespace SLUMT {
30 /*
31 * We have to declare this extern function because of a bug in the
32 * SuperLU_MT header files. In each header is declared a function
33 * "extern int xsp_colorder(...)" where x is in {'s','d','c','z'},
34 * but this function is never defined anywhere, so if you use the
35 * function as defined, it will compile fine, but will choke during
36 * linking. No other code in SuperLU_MT actually calls these
37 * functions. Instead, all other SuperLU_MT function just call
38 * "sp_colorder", which is defined within the SuperLU_MT library,
39 * but not declared.
40 */
41 extern "C" {
42 int sp_colorder(SuperMatrix*,int*,superlumt_options_t*,SuperMatrix*);
43 }
44} // end namespace SLUMT
45
46
47namespace Amesos2 {
48
49 /*
50 * Note: Although many of the type definitions for SuperLU_MT are
51 * identical to those of SuperLU, we do not mix the definitions so
52 * that we do not introduce messy coupling between the two
53 * interfaces. Also, there exist enough differences between the two
54 * packages to merit dedicated utility functions.
55 *
56 * We have also taken a different approach to interfacing with
57 * SuperLU_MT than with SuperLU which I believe leads to a better
58 * seperation of the 4 solution steps. We may in the future adopt a
59 * similar strategy for SuperLU.
60 */
61
62 template <class Matrix, class Vector>
63 Superlumt<Matrix,Vector>::Superlumt(Teuchos::RCP<const Matrix> A,
64 Teuchos::RCP<Vector> X,
65 Teuchos::RCP<const Vector> B )
66 : SolverCore<Amesos2::Superlumt,Matrix,Vector>(A, X, B)
67 , nzvals_() // initialize to empty arrays
68 , rowind_()
69 , colptr_()
70 , is_contiguous_(true)
71 {
72 Teuchos::RCP<Teuchos::ParameterList> default_params
73 = Teuchos::parameterList( *(this->getValidParameters()) );
74 this->setParameters(default_params);
75
76 data_.options.lwork = 0; // Use system memory for factorization
77
78 data_.perm_r.resize(this->globalNumRows_);
79 data_.perm_c.resize(this->globalNumCols_);
80 data_.options.perm_r = data_.perm_r.getRawPtr();
81 data_.options.perm_c = data_.perm_c.getRawPtr();
82
83 data_.R.resize(this->globalNumRows_);
84 data_.C.resize(this->globalNumCols_);
85
86 data_.options.refact = SLUMT::NO; // initially we are not refactoring
87 data_.equed = SLUMT::NOEQUIL; // No equilibration has yet been performed
88 data_.rowequ = false;
89 data_.colequ = false;
90
91 data_.A.Store = NULL;
92 data_.AC.Store = NULL;
93 data_.BX.Store = NULL;
94 data_.L.Store = NULL;
95 data_.U.Store = NULL;
96
97 data_.stat.ops = NULL;
98 }
99
100
101 template <class Matrix, class Vector>
103 {
104 /* Free SuperLU_MT data_types
105 * - Matrices
106 * - Vectors
107 * - Stat object
108 */
109
110 // Storage is initialized in numericFactorization_impl()
111 if ( data_.A.Store != NULL ){
112 // Our Teuchos::Array's will destroy rowind, colptr, and nzval for us
113 SLUMT::D::Destroy_SuperMatrix_Store( &(data_.A) );
114 }
115
116 // Cleanup memory allocated during last call to sp_colorder if needed
117 if( data_.AC.Store != NULL ){
118 SLUMT::D::Destroy_CompCol_Permuted( &(data_.AC) ); // free's colbeg, colend, and Store
119 }
120
121 if ( data_.L.Store != NULL ){ // will only ever be true for this->root_
122 SLUMT::D::Destroy_SuperNode_SCP( &(data_.L) );
123 SLUMT::D::Destroy_CompCol_NCP( &(data_.U) );
124
125 // memory alloc'd in sp_colorder
126 free( data_.options.etree );
127 free( data_.options.colcnt_h );
128 free( data_.options.part_super_h );
129 }
130
131
132 // Storage is initialized in solve_impl()
133 if ( data_.BX.Store != NULL ){
134 /* Cannot use SLU::Destroy_Dense_Matrix routine here, since it attempts to
135 * free the array of non-zero values, but that array has already been
136 * deallocated by the MultiVector object. So we release just the Store
137 * instead.
138 */
139 SLUMT::D::Destroy_SuperMatrix_Store( &(data_.BX) );
140 }
141
142 if ( data_.stat.ops != NULL )
143 SLUMT::D::StatFree( &(data_.stat) );
144 }
145
146 template<class Matrix, class Vector>
147 int
149 {
150 // Use either the column-ordering found in the users perm_c or the requested computed ordering
151 int perm_spec = data_.options.ColPerm;
152 if( perm_spec != SLUMT::MY_PERMC && this->root_ ){
153#ifdef HAVE_AMESOS2_TIMERS
154 Teuchos::TimeMonitor preOrderTimer(this->timers_.preOrderTime_);
155#endif
156
157 SLUMT::S::get_perm_c(perm_spec, &(data_.A), data_.perm_c.getRawPtr());
158 }
159 // Ordering will be applied directly before numeric factorization
160
161 return(0);
162 }
163
164
165
166 template <class Matrix, class Vector>
167 int
169 {
170 // We assume that a call to symbolicFactorization is indicating that
171 // the structure of the matrix has changed. SuperLU doesn't allow
172 // us to do a symbolic factorization directly, but we can leave a
173 // flag that tells it it needs to symbolically factor later.
174 data_.options.refact = SLUMT::NO;
175
176 if( this->status_.numericFactorizationDone() && this->root_ ){
177 // If we've done a numeric factorization already, then we need to
178 // cleanup the old L and U. Stores and other data will be
179 // allocated during numeric factorization. Only rank 0 has valid
180 // pointers
181 SLUMT::D::Destroy_SuperNode_Matrix( &(data_.L) );
182 SLUMT::D::Destroy_CompCol_NCP( &(data_.U) );
183 data_.L.Store = NULL;
184 data_.U.Store = NULL;
185 }
186
187 return(0);
188 }
189
190
191 template <class Matrix, class Vector>
192 int
194 {
195 using Teuchos::as;
196
197#ifdef HAVE_AMESOS2_DEBUG
198 const int nprocs = data_.options.nprocs;
199 TEUCHOS_TEST_FOR_EXCEPTION( nprocs <= 0,
200 std::invalid_argument,
201 "The number of threads to spawn should be greater than 0." );
202#endif
203
204 int info = 0;
205
206 if ( this->root_ ) {
207
208 if( data_.options.fact == SLUMT::EQUILIBRATE ){
209 magnitude_type rowcnd, colcnd, amax;
210 int info;
211
212 function_map::gsequ(&(data_.A), data_.R.getRawPtr(),
213 data_.C.getRawPtr(), &rowcnd, &colcnd,
214 &amax, &info);
215 TEUCHOS_TEST_FOR_EXCEPTION( info != 0,
216 std::runtime_error,
217 "SuperLU_MT gsequ returned with status " << info );
218
219 function_map::laqgs(&(data_.A), data_.R.getRawPtr(),
220 data_.C.getRawPtr(), rowcnd, colcnd,
221 amax, &(data_.equed));
222
223 data_.rowequ = (data_.equed == SLUMT::ROW) || (data_.equed == SLUMT::BOTH);
224 data_.colequ = (data_.equed == SLUMT::COL) || (data_.equed == SLUMT::BOTH);
225
226 data_.options.fact = SLUMT::DOFACT;
227 }
228
229 // Cleanup memory allocated during last call to sp_colorder if needed
230 if( data_.AC.Store != NULL ){
231 SLUMT::D::Destroy_CompCol_Permuted( &(data_.AC) ); // free's colbeg, colend, and Store
232 if( data_.options.refact == SLUMT::NO ){ // then we recompute etree; free the old one
233 free( data_.options.etree );
234 free( data_.options.colcnt_h );
235 free( data_.options.part_super_h );
236 }
237 data_.AC.Store = NULL;
238 }
239
240 // Apply the column ordering, so that AC is the column-permuted A, and compute etree
241 SLUMT::sp_colorder(&(data_.A), data_.perm_c.getRawPtr(),
242 &(data_.options), &(data_.AC));
243
244
245 // Allocate and initialize status variable
246 const int n = as<int>(this->globalNumCols_); // n is the number of columns in A
247 if( data_.stat.ops != NULL ){ SLUMT::D::StatFree( &(data_.stat) ); data_.stat.ops = NULL; }
248 SLUMT::D::StatAlloc(n, data_.options.nprocs, data_.options.panel_size,
249 data_.options.relax, &(data_.stat));
250 SLUMT::D::StatInit(n, data_.options.nprocs, &(data_.stat));
251
252
253 { // Do factorization
254#ifdef HAVE_AMESOS2_TIMERS
255 Teuchos::TimeMonitor numFactTimer( this->timers_.numFactTime_ );
256#endif
257
258#ifdef HAVE_AMESOS2_VERBOSE_DEBUG
259 std::cout << "SuperLU_MT:: Before numeric factorization" << std::endl;
260 std::cout << "nzvals_ : " << nzvals_.toString() << std::endl;
261 std::cout << "rowind_ : " << rowind_.toString() << std::endl;
262 std::cout << "colptr_ : " << colptr_.toString() << std::endl;
263#endif
264
265 function_map::gstrf(&(data_.options), &(data_.AC),
266 data_.perm_r.getRawPtr(), &(data_.L), &(data_.U),
267 &(data_.stat), &info);
268 }
269
270 // Set the number of non-zero values in the L and U factors
271 this->setNnzLU( as<size_t>(((SLUMT::SCformat*)data_.L.Store)->nnz +
272 ((SLUMT::NCformat*)data_.U.Store)->nnz) );
273 }
274
275 // Check output
276 const global_size_type info_st = as<global_size_type>(info);
277 TEUCHOS_TEST_FOR_EXCEPTION( (info_st > 0) && (info_st <= this->globalNumCols_),
278 std::runtime_error,
279 "Factorization complete, but matrix is singular. Division by zero eminent");
280 TEUCHOS_TEST_FOR_EXCEPTION( (info_st > 0) && (info_st > this->globalNumCols_),
281 std::runtime_error,
282 "Memory allocation failure in SuperLU_MT factorization");
283 // The other option, that info_st < 0 denotes invalid parameters to
284 // the function, but we'll assume for now that that won't happen.
285
286 data_.options.fact = SLUMT::FACTORED;
287 data_.options.refact = SLUMT::YES;
288
289 /* All processes should return the same error code */
290 Teuchos::broadcast(*(this->getComm()),0,&info);
291 return(info);
292 }
293
294
295 template <class Matrix, class Vector>
296 int
298 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const
299 {
300 using Teuchos::as;
301
302 const global_size_type ld_rhs = this->root_ ? X->getGlobalLength() : 0;
303 const size_t nrhs = X->getGlobalNumVectors();
304
305 Teuchos::Array<slu_type> bxvals_(ld_rhs * nrhs);
306 size_t ldbx_ = as<size_t>(ld_rhs);
307
308 { // Get values from B
309#ifdef HAVE_AMESOS2_TIMERS
310 Teuchos::TimeMonitor convTimer( this->timers_.vecConvTime_ );
311 Teuchos::TimeMonitor redistTimer( this->timers_.vecRedistTime_ );
312#endif
313
314 if ( is_contiguous_ == true ) {
316 slu_type>::do_get(B, bxvals_(),
317 ldbx_,
318 ROOTED, this->rowIndexBase_);
319 }
320 else {
321 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
322 "NON_CONTIGUOUS_AND_ROOTED not supported.");
323 }
324 }
325
326 int info = 0; // returned error code (0 = success)
327 if ( this->root_ ) {
328 // Clean up old B stores if it has already been created
329 if( data_.BX.Store != NULL ){
330 SLUMT::D::Destroy_SuperMatrix_Store( &(data_.BX) );
331 data_.BX.Store = NULL;
332 }
333
334 {
335#ifdef HAVE_AMESOS2_TIMERS
336 Teuchos::TimeMonitor convTimer( this->timers_.vecConvTime_ );
337#endif
338 SLUMT::Dtype_t dtype = type_map::dtype;
339 function_map::create_Dense_Matrix(&(data_.BX), as<int>(ld_rhs), as<int>(nrhs),
340 bxvals_.getRawPtr(), as<int>(ldbx_),
341 SLUMT::SLU_DN, dtype, SLUMT::SLU_GE);
342 }
343
344 if( data_.options.trans == SLUMT::NOTRANS ){
345 if( data_.rowequ ){ // row equilibration has been done on AC
346 // scale bxvals_ by diag(R)
347 Util::scale(bxvals_(), as<size_t>(ld_rhs), ldbx_, data_.R(),
348 SLUMT::slu_mt_mult<slu_type,magnitude_type>());
349 }
350 } else if( data_.colequ ){ // column equilibration has been done on AC
351 // scale bxvals_ by diag(C)
352 Util::scale(bxvals_(), as<size_t>(ld_rhs), ldbx_, data_.C(),
353 SLUMT::slu_mt_mult<slu_type,magnitude_type>());
354 }
355
356
357 {
358#ifdef HAVE_AMESOS2_TIMERS
359 Teuchos::TimeMonitor solveTimer( this->timers_.solveTime_ );
360#endif
361
362 function_map::gstrs(data_.options.trans, &(data_.L),
363 &(data_.U), data_.perm_r.getRawPtr(),
364 data_.perm_c.getRawPtr(), &(data_.BX),
365 &(data_.stat), &info);
366 }
367 } // end block for solve time
368
369 /* All processes should have the same error code */
370 Teuchos::broadcast(*(this->getComm()),0,&info);
371
372 TEUCHOS_TEST_FOR_EXCEPTION( info < 0,
373 std::runtime_error,
374 "Argument " << -info << " to gstrs had an illegal value" );
375
376 // "Un-scale" the solution so that it is a solution of the original system
377 if( data_.options.trans == SLUMT::NOTRANS ){
378 if( data_.colequ ){ // column equilibration has been done on AC
379 // scale bxvals_ by diag(C)
380 Util::scale(bxvals_(), as<size_t>(ld_rhs), ldbx_, data_.C(),
381 SLUMT::slu_mt_mult<slu_type,magnitude_type>());
382 }
383 } else if( data_.rowequ ){ // row equilibration has been done on AC
384 // scale bxvals_ by diag(R)
385 Util::scale(bxvals_(), as<size_t>(ld_rhs), ldbx_, data_.R(),
386 SLUMT::slu_mt_mult<slu_type,magnitude_type>());
387 }
388
389 /* Update X's global values */
390 {
391#ifdef HAVE_AMESOS2_TIMERS
392 Teuchos::TimeMonitor redistTimer( this->timers_.vecRedistTime_ );
393#endif
394
395 if ( is_contiguous_ == true ) {
397 MultiVecAdapter<Vector>, slu_type>::do_put(X, bxvals_(), ldbx_, ROOTED);
398 }
399 else {
400 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
401 "NON_CONTIGUOUS_AND_ROOTED not supported.");
402 }
403 }
404
405 return(info);
406 }
407
408
409 template <class Matrix, class Vector>
410 bool
412 {
413 // The SuperLU_MT factorization routines can handle square as well as
414 // rectangular matrices, but SuperLU_MT can only apply the solve routines to
415 // square matrices, so we check the matrix for squareness.
416 return( this->matrixA_->getGlobalNumRows() == this->matrixA_->getGlobalNumCols() );
417 }
418
419
420 template <class Matrix, class Vector>
421 void
422 Superlumt<Matrix,Vector>::setParameters_impl(const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
423 {
424 using Teuchos::as;
425 using Teuchos::RCP;
426 using Teuchos::getIntegralValue;
427 using Teuchos::ParameterEntryValidator;
428
429 RCP<const Teuchos::ParameterList> valid_params = getValidParameters_impl();
430
431 int default_nprocs = Kokkos::DefaultHostExecutionSpace().concurrency();
432 data_.options.nprocs = parameterList->get<int>("nprocs", default_nprocs);
433
434 data_.options.trans = this->control_.useTranspose_ ? SLUMT::TRANS : SLUMT::NOTRANS;
435 // SuperLU_MT "trans" option can override the Amesos2 option
436 if( parameterList->isParameter("trans") ){
437 RCP<const ParameterEntryValidator> trans_validator = valid_params->getEntry("trans").validator();
438 parameterList->getEntry("trans").setValidator(trans_validator);
439
440 data_.options.trans = getIntegralValue<SLUMT::trans_t>(*parameterList, "trans");
441 }
442
443 data_.options.panel_size = parameterList->get<int>("panel_size", SLUMT::D::sp_ienv(1));
444
445 data_.options.relax = parameterList->get<int>("relax", SLUMT::D::sp_ienv(2));
446
447 const bool equil = parameterList->get<bool>("Equil", true);
448 data_.options.fact = equil ? SLUMT::EQUILIBRATE : SLUMT::DOFACT;
449
450 const bool symmetric_mode = parameterList->get<bool>("SymmetricMode", false);
451 data_.options.SymmetricMode = symmetric_mode ? SLUMT::YES : SLUMT::NO;
452
453 const bool print_stat = parameterList->get<bool>("PrintStat", false);
454 data_.options.PrintStat = print_stat ? SLUMT::YES : SLUMT::NO;
455
456 data_.options.diag_pivot_thresh = parameterList->get<double>("diag_pivot_thresh", 1.0);
457
458 if( parameterList->isParameter("ColPerm") ){
459 RCP<const ParameterEntryValidator> colperm_validator = valid_params->getEntry("ColPerm").validator();
460 parameterList->getEntry("ColPerm").setValidator(colperm_validator);
461
462 data_.options.ColPerm = getIntegralValue<SLUMT::colperm_t>(*parameterList, "ColPerm");
463 }
464
465 // TODO: until we support retrieving col/row permutations from the user
466 data_.options.usepr = SLUMT::NO;
467
468 if( parameterList->isParameter("IsContiguous") ){
469 is_contiguous_ = parameterList->get<bool>("IsContiguous");
470 }
471 }
472
473
474 template <class Matrix, class Vector>
475 Teuchos::RCP<const Teuchos::ParameterList>
477 {
478 using std::string;
479 using Teuchos::tuple;
480 using Teuchos::ParameterList;
481 using Teuchos::EnhancedNumberValidator;
482 using Teuchos::setStringToIntegralParameter;
483 using Teuchos::stringToIntegralParameterEntryValidator;
484
485 static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
486
487 if( is_null(valid_params) ){
488 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
489
490 int default_nprocs = Kokkos::DefaultHostExecutionSpace().concurrency();
491 Teuchos::RCP<EnhancedNumberValidator<int> > nprocs_validator
492 = Teuchos::rcp( new EnhancedNumberValidator<int>() );
493 nprocs_validator->setMin(default_nprocs);
494 pl->set("nprocs", default_nprocs, "The number of processors to factorize with", nprocs_validator);
495
496 setStringToIntegralParameter<SLUMT::trans_t>("trans", "NOTRANS",
497 "Solve for the transpose system or not",
498 tuple<string>("TRANS","NOTRANS","CONJ"),
499 tuple<string>("Solve with transpose",
500 "Do not solve with transpose",
501 "Solve with the conjugate transpose"),
502 tuple<SLUMT::trans_t>(SLUMT::TRANS,
503 SLUMT::NOTRANS,
504 SLUMT::CONJ),
505 pl.getRawPtr());
506
507 Teuchos::RCP<EnhancedNumberValidator<int> > panel_size_validator
508 = Teuchos::rcp( new EnhancedNumberValidator<int>() );
509 panel_size_validator->setMin(1);
510 pl->set("panel_size", SLUMT::D::sp_ienv(1),
511 "Specifies the number of consecutive columns to be treated as a unit of task.",
512 panel_size_validator);
513
514 Teuchos::RCP<EnhancedNumberValidator<int> > relax_validator
515 = Teuchos::rcp( new EnhancedNumberValidator<int>() );
516 relax_validator->setMin(1);
517 pl->set("relax", SLUMT::D::sp_ienv(2),
518 "Specifies the number of columns to be grouped as a relaxed supernode",
519 relax_validator);
520
521 pl->set("Equil", true, "Whether to equilibrate the system before solve");
522
523 Teuchos::RCP<EnhancedNumberValidator<double> > diag_pivot_thresh_validator
524 = Teuchos::rcp( new EnhancedNumberValidator<double>(0.0, 1.0) );
525 pl->set("diag_pivot_thresh", 1.0,
526 "Specifies the threshold used for a diagonal entry to be an acceptable pivot",
527 diag_pivot_thresh_validator); // partial pivoting
528
529 // Note: MY_PERMC not yet supported
530 setStringToIntegralParameter<SLUMT::colperm_t>("ColPerm", "COLAMD",
531 "Specifies how to permute the columns of the "
532 "matrix for sparsity preservation",
533 tuple<string>("NATURAL",
534 "MMD_AT_PLUS_A",
535 "MMD_ATA",
536 "COLAMD"),
537 tuple<string>("Natural ordering",
538 "Minimum degree ordering on A^T + A",
539 "Minimum degree ordering on A^T A",
540 "Approximate minimum degree column ordering"),
541 tuple<SLUMT::colperm_t>(SLUMT::NATURAL,
542 SLUMT::MMD_AT_PLUS_A,
543 SLUMT::MMD_ATA,
544 SLUMT::COLAMD),
545 pl.getRawPtr());
546
547 pl->set("SymmetricMode", false, "Specifies whether to use the symmetric mode");
548
549 // TODO: until we support getting row/col permutations from user
550 // pl->set("usepr", false);
551
552 pl->set("PrintStat", false, "Specifies whether to print the solver's statistics");
553
554 pl->set("IsContiguous", true, "Whether GIDs contiguous");
555
556 valid_params = pl;
557 }
558
559 return valid_params;
560 }
561
562
563 template <class Matrix, class Vector>
564 bool
566 {
567 using Teuchos::as;
568
569#ifdef HAVE_AMESOS2_TIMERS
570 Teuchos::TimeMonitor convTimer( this->timers_.mtxConvTime_ );
571#endif
572
573 if( current_phase == SYMBFACT ) return false;
574
575 // Store is allocated on create_CompCol_Matrix
576 if( data_.A.Store != NULL ){
577 SLUMT::D::Destroy_SuperMatrix_Store( &(data_.A) );
578 data_.A.Store = NULL;
579 }
580
581 if( this->root_ ){
582 nzvals_.resize(this->globalNumNonZeros_);
583 rowind_.resize(this->globalNumNonZeros_);
584 colptr_.resize(this->globalNumCols_ + 1);
585 }
586
587 int nnz_ret = 0;
588 {
589#ifdef HAVE_AMESOS2_TIMERS
590 Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
591#endif
592
593 // Use compressed-column store for SuperLU_MT
594 if ( is_contiguous_ == true ) {
595 Util::get_ccs_helper<
596 MatrixAdapter<Matrix>,slu_type,int,int>::do_get(this->matrixA_.ptr(),
597 nzvals_, rowind_, colptr_,
598 nnz_ret, ROOTED, ARBITRARY, this->rowIndexBase_);
599 }
600 else {
601 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
602 "NON_CONTIGUOUS_AND_ROOTED not supported.");
603 }
604 }
605
606 if( this->root_ ){
607 TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != as<int>(this->globalNumNonZeros_),
608 std::runtime_error,
609 "rank=0 failed to get all nonzero values in getCcs()");
610
611 SLUMT::Dtype_t dtype = type_map::dtype;
612 function_map::create_CompCol_Matrix(&(data_.A),
613 as<int>(this->globalNumRows_),
614 as<int>(this->globalNumCols_),
615 nnz_ret,
616 nzvals_.getRawPtr(),
617 rowind_.getRawPtr(),
618 colptr_.getRawPtr(),
619 SLUMT::SLU_NC,
620 dtype, SLUMT::SLU_GE);
621
622 TEUCHOS_TEST_FOR_EXCEPTION( data_.A.Store == NULL,
623 std::runtime_error,
624 "Failed to allocate matrix store" );
625 }
626
627 return true;
628 }
629
630
631 template<class Matrix, class Vector>
632 const char* Superlumt<Matrix,Vector>::name = "SuperLU_MT";
633
634
635} // end namespace Amesos2
636
637#endif // AMESOS2_SUPERLUMT_DEF_HPP
@ ROOTED
Definition Amesos2_TypeDecl.hpp:93
@ ARBITRARY
Definition Amesos2_TypeDecl.hpp:109
Utility functions for Amesos2.
A Matrix adapter interface for Amesos2.
Definition Amesos2_MatrixAdapter_decl.hpp:42
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers.
Definition Amesos2_SolverCore_decl.hpp:72
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Return a const parameter list of all of the valid parameters that this->setParameterList(....
Definition Amesos2_SolverCore_def.hpp:545
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > &parameterList) override
Set/update internal variables and solver options.
Definition Amesos2_SolverCore_def.hpp:513
global_size_type globalNumCols_
Number of global columns in matrixA_.
Definition Amesos2_SolverCore_decl.hpp:445
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition Amesos2_SolverCore_decl.hpp:442
Amesos2 interface to the Multi-threaded version of SuperLU.
Definition Amesos2_Superlumt_decl.hpp:44
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
SuperLU_MT specific solve.
Definition Amesos2_Superlumt_def.hpp:297
Superlumt(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize from Teuchos::RCP.
Definition Amesos2_Superlumt_def.hpp:63
~Superlumt()
Destructor.
Definition Amesos2_Superlumt_def.hpp:102
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition Amesos2_Superlumt_def.hpp:411
int numericFactorization_impl()
SuperLU_MT specific numeric factorization.
Definition Amesos2_Superlumt_def.hpp:193
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using SuperLU_MT.
Definition Amesos2_Superlumt_def.hpp:168
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition Amesos2_Superlumt_def.hpp:148
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition Amesos2_Superlumt_def.hpp:476
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition Amesos2_Superlumt_def.hpp:565
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Definition Amesos2_Superlumt_def.hpp:422
EPhase
Used to indicate a phase in the direct solution.
Definition Amesos2_TypeDecl.hpp:31
void scale(ArrayView< Scalar1 > vals, size_t l, size_t ld, ArrayView< Scalar2 > s)
Scales a 1-D representation of a multivector.
A templated MultiVector class adapter for Amesos2.
Definition Amesos2_MultiVecAdapter_decl.hpp:142
Helper class for getting 1-D copies of multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:233
Helper class for putting 1-D data arrays into multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:339