Skip to content

Commit

Permalink
#11: remove unnecessary copies
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Nov 11, 2024
1 parent 7afc92a commit b25d4b5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/ops/ops_kokkos_level2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,18 @@ struct kokkosFixture
template <typename ...ViewProps>
static void set_input(Kokkos::View<ViewProps...> x, const std::vector<double> &values) {
assert(x.extent(0) == values.size());
auto x_h = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), x);
for (size_t i = 0; i < x.extent(0); ++i) {
x_h(i) = values[i];
x(i) = values[i];
}
Kokkos::deep_copy(x, x_h);
}

// populates input matrix with unique integer values
template <typename ...ViewProps>
static void set_matrix(Kokkos::View<ViewProps...> mtx) {
auto mtx_h = mtx;
size_t ex0 = mtx.extent(0), ex1 = mtx.extent(1);
for (size_t i = 0; i < ex0; ++i) {
for (size_t j = 0; j < ex1; ++j) {
mtx_h(i, j) = (double)(i * ex1 + j + 1.0);
mtx(i, j) = (double)(i * ex1 + j + 1.0);
}
}
}
Expand Down

0 comments on commit b25d4b5

Please sign in to comment.