133 if (data_.symbolic_ != NULL) {
134 ::KLU2::klu_free_symbolic<klu2_dtype, local_ordinal_type>
135 (&(data_.symbolic_), &(data_.common_)) ;
139 host_ordinal_type_array host_row_ptr_view;
140 host_ordinal_type_array host_cols_view;
141 this->
matrixA_->returnRowPtr_kokkos_view(host_row_ptr_view);
142 this->
matrixA_->returnColInd_kokkos_view(host_cols_view);
143 data_.symbolic_ = ::KLU2::klu_analyze<klu2_dtype, local_ordinal_type>
144 ((local_ordinal_type)this->
globalNumCols_, host_row_ptr_view.data(),
145 host_cols_view.data(), &(data_.common_)) ;
149 data_.symbolic_ = ::KLU2::klu_analyze<klu2_dtype, local_ordinal_type>
173#ifdef HAVE_AMESOS2_TIMERS
174 Teuchos::TimeMonitor numFactTimer(this->
timers_.numFactTime_);
177 if (data_.numeric_ != NULL) {
178 ::KLU2::klu_free_numeric<klu2_dtype, local_ordinal_type>
179 (&(data_.numeric_), &(data_.common_));
183 host_ordinal_type_array host_row_ptr_view;
184 host_ordinal_type_array host_cols_view;
185 this->
matrixA_->returnRowPtr_kokkos_view(host_row_ptr_view);
186 this->
matrixA_->returnColInd_kokkos_view(host_cols_view);
189 data_.numeric_ = ::KLU2::klu_factor<klu2_dtype, local_ordinal_type>
190 (host_row_ptr_view.data(), host_cols_view.data(), pValues,
191 data_.symbolic_, &(data_.common_));
195 data_.numeric_ = ::KLU2::klu_factor<klu2_dtype, local_ordinal_type>
197 data_.symbolic_, &(data_.common_));
205 if(data_.numeric_ ==
nullptr) {
212 this->
setNnzLU( as<size_t>((data_.numeric_)->lnz) + as<size_t>((data_.numeric_)->unz) );
219 Teuchos::broadcast(*(this->
matrixA_->getComm()), 0, &info);
221 TEUCHOS_TEST_FOR_EXCEPTION(info > 0, std::runtime_error,
222 "KLU2 numeric factorization failed");
236 const global_size_type ld_rhs = this->
root_ ? X->getGlobalLength() : 0;
237 const size_t nrhs = X->getGlobalNumVectors();
242#ifdef HAVE_AMESOS2_TIMERS
243 Teuchos::TimeMonitor mvConvTimer(this->
timers_.vecConvTime_);
244 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
246 const bool initialize_data =
true;
247 const bool do_not_initialize_data =
false;
250 bDidAssignB = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
251 host_solve_array_t>::do_get(initialize_data, B,
bValues_, as<size_t>(ld_rhs));
253 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
254 host_solve_array_t>::do_get(do_not_initialize_data, X,
xValues_, as<size_t>(ld_rhs));
257 if ( is_contiguous_ ==
true ) {
258 bDidAssignB = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
259 host_solve_array_t>::do_get(initialize_data, B,
bValues_,
264 bDidAssignB = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
265 host_solve_array_t>::do_get(initialize_data, B,
bValues_,
271 if ( is_contiguous_ ==
true ) {
272 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
273 host_solve_array_t>::do_get(do_not_initialize_data, X,
xValues_,
278 bDidAssignX = Util::get_1d_copy_helper_kokkos_view<MultiVecAdapter<Vector>,
279 host_solve_array_t>::do_get(do_not_initialize_data, X,
xValues_,
299 klu2_dtype * pxValues = function_map::convert_scalar(
xValues_.data());
300 klu2_dtype * pbValues = function_map::convert_scalar(
bValues_.data());
304 TEUCHOS_TEST_FOR_EXCEPTION(pbValues ==
nullptr,
305 std::runtime_error,
"Amesos2 Runtime Error: b_vector returned null ");
307 TEUCHOS_TEST_FOR_EXCEPTION(pxValues ==
nullptr,
308 std::runtime_error,
"Amesos2 Runtime Error: x_vector returned null ");
312#ifdef HAVE_AMESOS2_TIMERS
313 Teuchos::TimeMonitor solveTimer(this->
timers_.solveTime_);
321 ::KLU2::klu_tsolve2<klu2_dtype, local_ordinal_type>
322 (data_.symbolic_, data_.numeric_,
323 (local_ordinal_type)this->globalNumCols_,
324 (local_ordinal_type)nrhs,
325 pbValues, pxValues, &(data_.common_)) ;
328 ::KLU2::klu_solve2<klu2_dtype, local_ordinal_type>
329 (data_.symbolic_, data_.numeric_,
330 (local_ordinal_type)this->globalNumCols_,
331 (local_ordinal_type)nrhs,
332 pbValues, pxValues, &(data_.common_)) ;
343#ifdef HAVE_AMESOS2_TIMERS
344 Teuchos::TimeMonitor solveTimer(this->
timers_.solveTime_);
352 ::KLU2::klu_tsolve<klu2_dtype, local_ordinal_type>
353 (data_.symbolic_, data_.numeric_,
354 (local_ordinal_type)this->globalNumCols_,
355 (local_ordinal_type)nrhs,
356 pxValues, &(data_.common_)) ;
359 ::KLU2::klu_solve<klu2_dtype, local_ordinal_type>
360 (data_.symbolic_, data_.numeric_,
361 (local_ordinal_type)this->globalNumCols_,
362 (local_ordinal_type)nrhs,
363 pxValues, &(data_.common_)) ;
372 ::KLU2::klu_solve<klu2_dtype, local_ordinal_type>
373 (data_.symbolic_, data_.numeric_,
374 (local_ordinal_type)this->globalNumCols_,
375 (local_ordinal_type)nrhs,
376 pxValues, &(data_.common_)) ;
379 ::KLU2::klu_tsolve<klu2_dtype, local_ordinal_type>
380 (data_.symbolic_, data_.numeric_,
381 (local_ordinal_type)this->globalNumCols_,
382 (local_ordinal_type)nrhs,
383 pxValues, &(data_.common_)) ;
392#ifdef HAVE_AMESOS2_TIMERS
393 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
396 if ( is_contiguous_ ==
true ) {
397 Util::put_1d_data_helper_kokkos_view<
403 Util::put_1d_data_helper_kokkos_view<