121 #ifdef HAVE_AMESOS2_TIMERS
122 Teuchos::TimeMonitor numFactTimer(this->timers_.numFactTime_);
125 #ifdef HAVE_AMESOS2_VERBOSE_DEBUG
126 std::cout <<
"Basker:: Before numeric factorization" << std::endl;
127 std::cout <<
"nzvals_ : " << nzvals_.toString() << std::endl;
128 std::cout <<
"rowind_ : " << rowind_.toString() << std::endl;
129 std::cout <<
"colptr_ : " << colptr_.toString() << std::endl;
132 basker_dtype * pBaskerValues = function_map::convert_scalar(host_nzvals_view_.data());
133 info = basker.factor(this->globalNumRows_, this->globalNumCols_, this->globalNumNonZeros_, host_col_ptr_view_.data(), host_rows_view_.data(), pBaskerValues);
137 this->setNnzLU( as<size_t>(basker.get_NnzLU() ) ) ;
143 Teuchos::broadcast(*(this->matrixA_->getComm()), 0, &info);
147 TEUCHOS_TEST_FOR_EXCEPTION( (info == -1) ,
149 "Basker: Could not alloc space for L and U");
150 TEUCHOS_TEST_FOR_EXCEPTION( (info == -2),
152 "Basker: Could not alloc needed work space");
153 TEUCHOS_TEST_FOR_EXCEPTION( (info == -3) ,
155 "Basker: Could not alloc additional memory needed for L and U");
156 TEUCHOS_TEST_FOR_EXCEPTION( (info > 0) ,
158 "Basker: Zero pivot found at: " << info );
167 const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
168 const Teuchos::Ptr<
const MultiVecAdapter<Vector> > B)
const
174 const global_size_type ld_rhs = this->root_ ? X->getGlobalLength() : 0;
175 const size_t nrhs = X->getGlobalNumVectors();
179#ifdef HAVE_AMESOS2_TIMERS
180 Teuchos::TimeMonitor mvConvTimer(this->timers_.vecConvTime_);
181 Teuchos::TimeMonitor redistTimer( this->timers_.vecRedistTime_ );
184 const bool initialize_data =
true;
185 const bool do_not_initialize_data =
false;
186 if ( single_proc_optimization() && nrhs == 1 ) {
188 Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
189 host_solve_array_t>::do_get(initialize_data, B, bValues_, as<size_t>(ld_rhs));
191 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
192 host_solve_array_t>::do_get(do_not_initialize_data, X, xValues_, as<size_t>(ld_rhs));
195 if ( is_contiguous_ ==
true ) {
196 Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
197 host_solve_array_t>::do_get(initialize_data, B, bValues_, as<size_t>(ld_rhs),
ROOTED, this->rowIndexBase_);
200 Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
201 host_solve_array_t>::do_get(initialize_data, B, bValues_, as<size_t>(ld_rhs),
CONTIGUOUS_AND_ROOTED, this->rowIndexBase_);
205 if ( is_contiguous_ ==
true ) {
206 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
207 host_solve_array_t>::do_get(do_not_initialize_data, X, xValues_, as<size_t>(ld_rhs),
ROOTED, this->rowIndexBase_);
210 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
211 host_solve_array_t>::do_get(do_not_initialize_data, X, xValues_, as<size_t>(ld_rhs),
CONTIGUOUS_AND_ROOTED, this->rowIndexBase_);
217#ifdef HAVE_AMESOS2_TIMERS
218 Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
221 basker_dtype * pxBaskerValues = function_map::convert_scalar(xValues_.data());
222 basker_dtype * pbBaskerValues = function_map::convert_scalar(bValues_.data());
223 ierr = basker.solveMultiple(nrhs, pbBaskerValues, pxBaskerValues);
227 Teuchos::broadcast(*(this->getComm()), 0, &ierr);
229 TEUCHOS_TEST_FOR_EXCEPTION( ierr > 0,
231 "Encountered zero diag element at: " << ierr);
232 TEUCHOS_TEST_FOR_EXCEPTION( ierr == -1,
234 "Could not alloc needed working memory for solve" );
239#ifdef HAVE_AMESOS2_TIMERS
240 Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
242 if ( is_contiguous_ ==
true ) {
243 Util::put_1d_data_helper_kokkos_view<
244 MultiVecAdapter<Vector>,host_solve_array_t>::do_put(X, xValues_,
249 Util::put_1d_data_helper_kokkos_view<
250 MultiVecAdapter<Vector>,host_solve_array_t>::do_put(X, xValues_,
311 if(current_phase == SOLVE)
return (
false);
313 #ifdef HAVE_AMESOS2_TIMERS
314 Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
319 host_nzvals_view_ = host_value_type_array(
320 Kokkos::ViewAllocateWithoutInitializing(
"host_nzvals_view_"), this->globalNumNonZeros_);
321 host_rows_view_ = host_ordinal_type_array(
322 Kokkos::ViewAllocateWithoutInitializing(
"host_rows_view_"), this->globalNumNonZeros_);
323 host_col_ptr_view_ = host_ordinal_type_array(
324 Kokkos::ViewAllocateWithoutInitializing(
"host_col_ptr_view_"), this->globalNumRows_ + 1);
327 local_ordinal_type nnz_ret = 0;
329 #ifdef HAVE_AMESOS2_TIMERS
330 Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
333 if ( is_contiguous_ ==
true ) {
335 MatrixAdapter<Matrix>,host_value_type_array,host_ordinal_type_array,host_ordinal_type_array>
336 ::do_get(this->matrixA_.ptr(), host_nzvals_view_, host_rows_view_, host_col_ptr_view_,
341 MatrixAdapter<Matrix>,host_value_type_array,host_ordinal_type_array,host_ordinal_type_array>
342 ::do_get(this->matrixA_.ptr(), host_nzvals_view_, host_rows_view_, host_col_ptr_view_,
348 TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != as<local_ordinal_type>(this->globalNumNonZeros_),
350 "Amesos2_Basker loadA_impl: Did not get the expected number of non-zero vals");