19#include <Kokkos_Core.hpp>
27 namespace SolverGMRESImplementation
35 template <
int block_size,
bool delayed_reorthogonalization>
38 double dot[block_size];
39 double correct[delayed_reorthogonalization ? block_size : 1];
42 KOKKOS_INLINE_FUNCTION
45 for (
int b = 0; b < block_size; ++b)
47 for (
int b = 0; b < (delayed_reorthogonalization ? block_size : 1); ++b)
55 for (
int b = 0; b < block_size; ++b)
57 if constexpr (delayed_reorthogonalization)
58 for (
int b = 0; b < block_size; ++b)
75 template <
int block_size,
bool delayed_reorthogonalization>
83 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
85 KOKKOS_INLINE_FUNCTION
90 KOKKOS_INLINE_FUNCTION
void
96 KOKKOS_INLINE_FUNCTION
void
114 KOKKOS_INLINE_FUNCTION
bool
126 template <
bool delayed_reorthogonalization,
typename Number>
130 const Number *current_vector,
135 const auto &orthogonal_vectors = temp_data.
vector_ptrs;
137 if (n_vectors <= 128)
140 static constexpr unsigned int n_lanes =
144 for (
unsigned int i = 0; i < n_vectors; ++i)
147 correct[delayed_reorthogonalization ? 129 : 1];
148 if (delayed_reorthogonalization)
149 for (
unsigned int i = 0; i < n_vectors + 1; ++i)
154 constexpr unsigned int inner_batch_size =
155 delayed_reorthogonalization ? 6 : 12;
157 const unsigned int loop_length_c =
221 for (
unsigned int c_block = 0; c_block < (loop_length_c + 63) / 64;
223 for (
unsigned int i_block = 0; i_block < (n_vectors + 7) / 8;
225 for (c = c_block * 64, j = c * n_lanes * inner_batch_size;
226 c <
std::min(loop_length_c, (c_block + 1) * 64);
227 ++c, j += n_lanes * inner_batch_size)
230 for (
unsigned int k = 0; k < inner_batch_size; ++k)
231 vvec[k].load(current_vector + j + k * n_lanes);
233 if (delayed_reorthogonalization || i_block == 0)
234 for (
unsigned int k = 0; k < inner_batch_size; ++k)
235 prev_vector[k].load(orthogonal_vectors[n_vectors - 1] +
241 prev_vector[0] * vvec[0];
243 prev_vector[0] * prev_vector[0];
245 for (
unsigned int k = 1; k < inner_batch_size; ++k)
247 local_sum_0 += prev_vector[k] * vvec[k];
248 if (delayed_reorthogonalization)
250 local_sum_1 += prev_vector[k] * prev_vector[k];
251 local_sum_2 += vvec[k] * vvec[k];
254 hs[n_vectors - 1] += local_sum_0;
255 if (delayed_reorthogonalization)
257 correct[n_vectors - 1] += local_sum_1;
258 correct[n_vectors] += local_sum_2;
262 for (
unsigned int i = i_block * 8;
263 i <
std::min(n_vectors - 1, (i_block + 1) * 8);
270 temp.
load(orthogonal_vectors[i] + j);
273 delayed_reorthogonalization ? temp * prev_vector[0] :
275 for (
unsigned int k = 1; k < inner_batch_size; ++k)
277 temp.
load(orthogonal_vectors[i] + j + k * n_lanes);
278 local_sum_0 += temp * vvec[k];
279 if (delayed_reorthogonalization)
280 local_sum_1 += temp * prev_vector[k];
282 hs[i] += local_sum_0;
283 if (delayed_reorthogonalization)
284 correct[i] += local_sum_1;
288 c *= inner_batch_size;
292 vvec.
load(current_vector + j);
293 prev_vector.
load(orthogonal_vectors[n_vectors - 1] + j);
294 hs[n_vectors - 1] += prev_vector * vvec;
295 if (delayed_reorthogonalization)
297 correct[n_vectors - 1] += prev_vector * prev_vector;
298 correct[n_vectors] += vvec * vvec;
301 for (
unsigned int i = 0; i < n_vectors - 1; ++i)
304 temp.
load(orthogonal_vectors[i] + j);
305 hs[i] += temp * vvec;
306 if (delayed_reorthogonalization)
307 correct[i] += temp * prev_vector;
311 for (
unsigned int i = 0; i < n_vectors; ++i)
314 if (delayed_reorthogonalization)
315 h(i + n_vectors) += correct[i].
sum();
317 if (delayed_reorthogonalization)
318 h(n_vectors + n_vectors) += correct[n_vectors].
sum();
325 const double vvec = current_vector[j];
326 const double prev_vector = orthogonal_vectors[n_vectors - 1][j];
327 h(n_vectors - 1) += prev_vector * vvec;
328 if (delayed_reorthogonalization)
330 h(n_vectors + n_vectors - 1) += prev_vector * prev_vector;
331 h(n_vectors + n_vectors) += vvec * vvec;
333 for (
unsigned int i = 0; i < n_vectors - 1; ++i)
335 const double temp = orthogonal_vectors[i][j];
337 if (delayed_reorthogonalization)
338 h(n_vectors + i) += temp * prev_vector;
345 template <
bool delayed_reorthogonalization,
typename Number>
351 Number *current_vector)
353 const auto &orthogonal_vectors = temp_data.
vector_ptrs;
354 double norm_vv_temp = 0;
356 Number *previous_vector =
357 const_cast<Number *
>(orthogonal_vectors[n_vectors - 1]);
358 const double inverse_norm_previous =
359 delayed_reorthogonalization ? 1. / h(n_vectors + n_vectors - 1) : 0.;
360 const double scaling_factor_vv =
361 delayed_reorthogonalization ?
362 (h(n_vectors + n_vectors) > 0.0 ?
363 inverse_norm_previous / h(n_vectors + n_vectors) :
364 inverse_norm_previous / h(n_vectors + n_vectors - 1)) :
366 const double last_factor = h(n_vectors - 1);
371 constexpr unsigned int inner_batch_size =
372 delayed_reorthogonalization ? 6 : 12;
380 const unsigned int loop_length_c =
382 const unsigned int loop_length_i = (n_vectors + 7) / 8;
383 for (
unsigned int c_block = 0; c_block < (loop_length_c + 63) / 64;
385 for (
unsigned int i_block = 0; i_block < (n_vectors + 7) / 8; ++i_block)
386 for (c = c_block * 64, j = c * n_lanes * inner_batch_size;
387 c <
std::min(loop_length_c, (c_block + 1) * 64);
388 ++c, j += n_lanes * inner_batch_size)
391 for (
unsigned int k = 0; k < inner_batch_size; ++k)
392 temp[k].load(current_vector + j + k * n_lanes);
394 if (delayed_reorthogonalization)
395 for (
unsigned int k = 0; k < inner_batch_size; ++k)
396 prev_vector[k].load(previous_vector + j + k * n_lanes);
398 for (
unsigned int i = i_block * 8;
399 i <
std::min(n_vectors - 1, (i_block + 1) * 8);
402 const double factor = h(i);
403 const double correction_factor =
404 (delayed_reorthogonalization ? h(n_vectors + i) : 0.0);
405 for (
unsigned int k = 0; k < inner_batch_size; ++k)
408 vec.
load(orthogonal_vectors[i] + j + k * n_lanes);
409 temp[k] -= factor * vec;
410 if (delayed_reorthogonalization)
411 prev_vector[k] -= correction_factor * vec;
415 if (delayed_reorthogonalization)
417 if (i_block + 1 == loop_length_i)
418 for (
unsigned int k = 0; k < inner_batch_size; ++k)
420 prev_vector[k] = prev_vector[k] * inverse_norm_previous;
421 prev_vector[k].
store(previous_vector + j + k * n_lanes);
422 temp[k] -= last_factor * prev_vector[k];
423 temp[k] = temp[k] * scaling_factor_vv;
424 temp[k].
store(current_vector + j + k * n_lanes);
427 for (
unsigned int k = 0; k < inner_batch_size; ++k)
429 prev_vector[k].
store(previous_vector + j + k * n_lanes);
430 temp[k].
store(current_vector + j + k * n_lanes);
435 if (i_block + 1 == loop_length_i)
436 for (
unsigned int k = 0; k < inner_batch_size; ++k)
438 prev_vector[k].
load(previous_vector + j + k * n_lanes);
439 temp[k] -= last_factor * prev_vector[k];
440 temp[k].
store(current_vector + j + k * n_lanes);
441 norm_vv_temp_vectorized += temp[k] * temp[k];
444 for (
unsigned int k = 0; k < inner_batch_size; ++k)
445 temp[k].store(current_vector + j + k * n_lanes);
449 c *= inner_batch_size;
453 temp.
load(current_vector + j);
454 prev_vector.
load(previous_vector + j);
455 if (!delayed_reorthogonalization)
456 temp -= h(n_vectors - 1) * prev_vector;
458 for (
unsigned int i = 0; i < n_vectors - 1; ++i)
461 vec.
load(orthogonal_vectors[i] + j);
463 if (delayed_reorthogonalization)
464 prev_vector -= h(n_vectors + i) * vec;
467 if (delayed_reorthogonalization)
469 prev_vector = prev_vector * inverse_norm_previous;
470 prev_vector.
store(previous_vector + j);
471 temp -= h(n_vectors - 1) * prev_vector;
472 temp = temp * scaling_factor_vv;
473 temp.
store(current_vector + j);
477 temp.
store(current_vector + j);
478 norm_vv_temp_vectorized += temp * temp;
482 if (!delayed_reorthogonalization)
483 norm_vv_temp += norm_vv_temp_vectorized.
sum();
487 double temp = current_vector[j];
488 double prev_vector = previous_vector[j];
489 if (delayed_reorthogonalization)
491 for (
unsigned int i = 0; i < n_vectors - 1; ++i)
493 const double vec = orthogonal_vectors[i][j];
495 prev_vector -= h(n_vectors + i) * vec;
497 prev_vector *= inverse_norm_previous;
498 previous_vector[j] = prev_vector;
499 temp -= h(n_vectors - 1) * prev_vector;
500 temp *= scaling_factor_vv;
504 temp -= h(n_vectors - 1) * prev_vector;
505 for (
unsigned int i = 0; i < n_vectors - 1; ++i)
506 temp -= h(i) * orthogonal_vectors[i][j];
507 norm_vv_temp += temp * temp;
509 current_vector[j] = temp;
517 template <
typename Number>
526 const auto &orthogonal_vectors = temp_data.
vector_ptrs;
529 constexpr unsigned int inner_batch_size = 12;
534 ++c, j += n_lanes * inner_batch_size)
541 for (
unsigned int k = 0; k < inner_batch_size; ++k)
542 temp[k].load(output + j + k * n_lanes);
544 for (
unsigned int i = 0; i < n_vectors; ++i)
546 const double h_i = h(i);
547 for (
unsigned int k = 0; k < inner_batch_size; ++k)
550 v_ij.
load(orthogonal_vectors[i] + j + k * n_lanes);
551 temp[k] += v_ij * h_i;
555 for (
unsigned int k = 0; k < inner_batch_size; ++k)
556 temp[k].store(output + j + k * n_lanes);
559 c *= inner_batch_size;
564 temp.
load(output + j);
566 for (
unsigned int i = 0; i < n_vectors; ++i)
569 v_ij.
load(orthogonal_vectors[i] + j);
573 temp.
store(output + j);
578 double temp = zero_out ? 0.0 : output[j];
579 for (
unsigned int i = 0; i < n_vectors; ++i)
580 temp += orthogonal_vectors[i][j] * h(i);
592 template <
typename Number>
607 template <
typename ViewType>
608 Kokkos::View<
typename ViewType::data_type,
609 typename ViewType::memory_space,
610 Kokkos::MemoryTraits<Kokkos::Unmanaged>>
614 return Kokkos::View<
typename ViewType::data_type,
615 typename ViewType::memory_space,
616 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(view.data(),
622 template <
typename Number>
626 MemorySpace::Default::kokkos_space::execution_space;
645 const std::vector<const Number *> &vector_ptrs)
647 const std::size_t n_vectors = vector_ptrs.size();
648 if (
ptrs.extent(0) < n_vectors)
652 Kokkos::view_alloc(Kokkos::WithoutInitializing,
653 "::gmres_vector_pointers"),
659 for (std::size_t i = 0; i < n_vectors; ++i)
660 ptrs_host(i).ptr =
const_cast<Number *
>(vector_ptrs[i]);
661 Kokkos::deep_copy(exec,
668 const std::size_t n_coefficients,
674 Kokkos::view_alloc(Kokkos::WithoutInitializing,
675 "::gmres_coefficients"),
679 for (std::size_t i = 0; i < n_coefficients; ++i)
681 Kokkos::deep_copy(exec,
692 Kokkos::View<double **, Kokkos::LayoutLeft, KokkosSpace>(
693 Kokkos::view_alloc(Kokkos::WithoutInitializing,
694 "::gmres_partial_sums"),
697 if (
results.extent(0) < n_results)
699 results = Kokkos::View<double *, KokkosSpace>(
700 Kokkos::view_alloc(Kokkos::WithoutInitializing,
708 typename Kokkos::View<DevicePointer<Number> *,
712 typename Kokkos::View<double *, KokkosSpace>::host_mirror_type
720 typename Kokkos::View<double *, KokkosSpace>::host_mirror_type
726 template <
typename Number>
731 temp_data.
device_data = std::make_shared<DeviceData<Number>>();
737 template <
bool delayed_reorthogonalization,
typename Number>
741 const Number *current_vector,
746 constexpr int block_size = Data::block_size;
747 constexpr std::size_t rows_per_team = Data::rows_per_team;
758 const unsigned int n_results =
759 delayed_reorthogonalization ? 2 * n_vectors + 1 : n_vectors;
761 const std::size_t n_teams =
767 typename Data::ExecutionSpace exec;
769 data.reserve_results(n_teams, n_results);
771 const auto ptrs =
data.ptrs;
772 const auto partial_sums =
data.partial_sums;
773 const auto results =
data.results;
774 const unsigned int n_blocks = (n_vectors + block_size - 1) / block_size;
777 using TeamPolicy = Kokkos::TeamPolicy<typename Data::ExecutionSpace>;
778 using Member =
typename TeamPolicy::member_type;
786 Kokkos::parallel_for(
788 TeamPolicy(exec, n_teams, Kokkos::AUTO),
789 KOKKOS_LAMBDA(
const Member &team) {
790 const std::size_t team_id = team.league_rank();
791 const std::size_t
begin = team_id * rows_per_team;
795 const std::size_t
end =
797 [[maybe_unused]]
const Number *
prev = ptrs(n_vectors - 1).ptr;
799 for (
unsigned int block = 0; block < n_blocks; ++block)
801 const unsigned int i0 = block * block_size;
802 const unsigned int nb =
803 block_size < (n_vectors - i0) ? block_size : (n_vectors - i0);
807 const Number *v[block_size];
808 for (
int b = 0; b < block_size; ++b)
809 v[b] = ptrs(i0 + (b <
static_cast<int>(nb) ? b : 0)).ptr;
812 Kokkos::parallel_reduce(
813 Kokkos::TeamThreadRange(team,
begin,
end),
814 [&](
const std::size_t j,
816 const double w_j = current_vector[j];
818 if constexpr (delayed_reorthogonalization)
820 for (
int b = 0; b < block_size; ++b)
822 const double v_ij = v[b][j];
823 s.
dot[b] += v_ij * w_j;
824 if constexpr (delayed_reorthogonalization)
827 if (delayed_reorthogonalization && block == 0)
833 Kokkos::single(Kokkos::PerTeam(team), [&]() {
834 for (
unsigned int b = 0; b < nb; ++b)
836 partial_sums(team_id, i0 + b) = sums.
dot[b];
837 if constexpr (delayed_reorthogonalization)
838 partial_sums(team_id, n_vectors + i0 + b) =
841 if (delayed_reorthogonalization && block == 0)
842 partial_sums(team_id, 2 * n_vectors) = sums.
norm_sqr;
847 Kokkos::parallel_for(
848 "::gmres_multi_dot_finalize",
849 TeamPolicy(exec, n_results, Kokkos::AUTO),
850 KOKKOS_LAMBDA(
const Member &team) {
851 const unsigned int i = team.league_rank();
853 Kokkos::parallel_reduce(
854 Kokkos::TeamThreadRange(team, n_teams),
855 [&](
const std::size_t t,
double &s) { s += partial_sums(t, i); },
857 Kokkos::single(Kokkos::PerTeam(team), [&]() { results(i) = sum; });
860 Kokkos::deep_copy(exec,
864 for (
unsigned int i = 0; i < n_results; ++i)
865 h(i) +=
data.results_host(i);
870 template <
bool delayed_reorthogonalization,
typename Number>
876 Number *current_vector)
879 using Policy = Kokkos::RangePolicy<
typename Data::ExecutionSpace,
880 Kokkos::IndexType<std::size_t>>;
885 delayed_reorthogonalization ? 2 * n_vectors + 1 :
891 typename Data::ExecutionSpace exec;
895 const auto ptrs =
data.ptrs;
896 const auto coeffs =
data.coefficients;
898 if constexpr (delayed_reorthogonalization)
903 const double inverse_norm_previous =
904 1. / h(n_vectors + n_vectors - 1);
905 const double scaling_factor_vv =
906 h(n_vectors + n_vectors) > 0.0 ?
907 inverse_norm_previous / h(n_vectors + n_vectors) :
908 inverse_norm_previous / h(n_vectors + n_vectors - 1);
909 const double last_factor = h(n_vectors - 1);
911 Kokkos::parallel_for(
912 "::gmres_subtract_delayed",
914 KOKKOS_LAMBDA(
const std::size_t j) {
915 Number *previous_vector = ptrs(n_vectors - 1).ptr;
916 double temp = current_vector[j];
917 double prev = previous_vector[j];
918 for (
unsigned int i = 0; i + 1 < n_vectors; ++i)
920 const double vec = ptrs(i).ptr[j];
921 temp -= coeffs(i) * vec;
922 prev -= coeffs(n_vectors + i) * vec;
924 prev *= inverse_norm_previous;
925 previous_vector[j] =
prev;
926 temp -= last_factor *
prev;
927 current_vector[j] = temp * scaling_factor_vv;
936 double norm_sqr = 0.;
937 Kokkos::parallel_reduce(
938 "::gmres_subtract_and_norm",
940 KOKKOS_LAMBDA(
const std::size_t j,
double &sum) {
941 double temp = current_vector[j];
942 for (
unsigned int i = 0; i < n_vectors; ++i)
943 temp -= coeffs(i) * ptrs(i).ptr[j];
944 current_vector[j] = temp;
954 template <
typename Number>
971 typename Data::ExecutionSpace exec;
973 data.set_coefficients(exec, n_vectors, h.
data());
975 const auto ptrs =
data.ptrs;
976 const auto coeffs =
data.coefficients;
978 Kokkos::parallel_for(
980 Kokkos::RangePolicy<
typename Data::ExecutionSpace,
981 Kokkos::IndexType<std::size_t>>(exec,
984 KOKKOS_LAMBDA(
const std::size_t j) {
985 double temp = zero_out ? 0. :
static_cast<double>(output[j]);
986 for (
unsigned int i = 0; i < n_vectors; ++i)
987 temp += coeffs(i) * ptrs(i).ptr[j];
994 template <
bool delayed_reorthogonalization,
1000 const Number *current_vector,
1004 if constexpr (std::is_same_v<MemorySpace, ::MemorySpace::Default>)
1005 do_Tvmult_add_device<delayed_reorthogonalization>(
1008 do_Tvmult_add_host<delayed_reorthogonalization>(
1014 template <
bool delayed_reorthogonalization,
1022 Number *current_vector)
1024 if constexpr (std::is_same_v<MemorySpace, ::MemorySpace::Default>)
1025 return do_subtract_and_norm_device<delayed_reorthogonalization>(
1028 return do_subtract_and_norm_host<delayed_reorthogonalization>(
1034 template <
typename MemorySpace,
typename Number>
1040 const bool zero_out,
1043 if constexpr (std::is_same_v<MemorySpace, ::MemorySpace::Default>)
1053#include "lac/solver_gmres.inst"
virtual size_type size() const override
static constexpr std::size_t size()
void store(OtherNumber *ptr) const
void load(const OtherNumber *ptr)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
std::vector< index_type > data
types::global_dof_index locally_owned_size
void do_add(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, const bool zero_out, Number *output)
void do_add_host(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, const bool zero_out, Number *output)
void do_Tvmult_add_device(const unsigned int n_vectors, const std::size_t locally_owned_size, const Number *current_vector, OrthogonalizationData< Number > &temp_data, Vector< double > &h)
void do_Tvmult_add(const unsigned int n_vectors, const std::size_t locally_owned_size, const Number *current_vector, OrthogonalizationData< Number > &temp_data, Vector< double > &h)
double do_subtract_and_norm_device(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, Number *current_vector)
double do_subtract_and_norm(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, Number *current_vector)
Kokkos::View< typename ViewType::data_type, typename ViewType::memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > leading_entries(const ViewType &view, const std::size_t n)
double do_subtract_and_norm_host(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, Number *current_vector)
void do_Tvmult_add_host(const unsigned int n_vectors, const std::size_t locally_owned_size, const Number *current_vector, OrthogonalizationData< Number > &temp_data, Vector< double > &h)
void do_add_device(const unsigned int n_vectors, const std::size_t locally_owned_size, OrthogonalizationData< Number > &temp_data, const Vector< double > &h, const bool zero_out, Number *output)
DeviceData< Number > & get_device_data(OrthogonalizationData< Number > &temp_data)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::Kokkos::DefaultExecutionSpace::memory_space kokkos_space
KOKKOS_INLINE_FUNCTION result_view_type view() const
Kokkos::View< value_type, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > result_view_type
BlockSums< block_size, delayed_reorthogonalization > value_type
KOKKOS_INLINE_FUNCTION void init(value_type &val) const
KOKKOS_INLINE_FUNCTION void join(value_type &dest, const value_type &src) const
KOKKOS_INLINE_FUNCTION bool references_scalar() const
KOKKOS_INLINE_FUNCTION BlockSumsReducer(value_type &result)
KOKKOS_INLINE_FUNCTION value_type & reference() const
KOKKOS_INLINE_FUNCTION BlockSums()
KOKKOS_INLINE_FUNCTION BlockSums & operator+=(const BlockSums &other)
double correct[delayed_reorthogonalization ? block_size :1]
void set_coefficients(const ExecutionSpace &exec, const std::size_t n_coefficients, const double *h)
MemorySpace::Default::kokkos_space::execution_space ExecutionSpace
Kokkos::View< double *, KokkosSpace > coefficients
MemorySpace::Default::kokkos_space KokkosSpace
void reserve_results(const std::size_t n_teams, const std::size_t n_results)
Kokkos::View< double **, Kokkos::LayoutLeft, KokkosSpace > partial_sums
Kokkos::View< DevicePointer< Number > *, KokkosSpace > ptrs
Kokkos::View< double *, KokkosSpace >::host_mirror_type coefficients_host
static constexpr int block_size
static constexpr std::size_t rows_per_team
void set_pointers(const ExecutionSpace &exec, const std::vector< const Number * > &vector_ptrs)
Kokkos::View< double *, KokkosSpace > results
Kokkos::View< double *, KokkosSpace >::host_mirror_type results_host
Kokkos::View< DevicePointer< Number > *, KokkosSpace >::host_mirror_type ptrs_host
std::shared_ptr< DeviceData< Number > > device_data
std::vector< const Number * > vector_ptrs
void prev(std::tuple< I1, I2 > &t)