Skip to content

Commit

Permalink
linewiseop padded span test (#964)
Browse files Browse the repository at this point in the history
This should fix the failures @Nyrio found in [#911](#911 (comment)). This is a test issue within a new testcase that was introduced by [#725](#725).

@cjnolet , FYI.

Authors:
  - Malte Förster (https://github.com/mfoerste4)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #964
  • Loading branch information
mfoerste4 authored Oct 28, 2022
1 parent 37c1b3d commit 0df8493
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cpp/test/matrix/linewise_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
const T* vec)
{
auto f = [] __device__(T a, T b) -> T { return a + b; };
auto vec_view = raft::make_device_vector_view<const T, I>(vec, lineLen);
auto vec_view = raft::make_device_vector_view<const T, I>(vec, alongLines ? lineLen : nLines);
matrix::linewise_op(handle, in, out, alongLines, f, vec_view);
}

Expand Down Expand Up @@ -234,8 +234,8 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
common::nvtx::range dims_scope("Dims-%zu-%zu", std::size_t(n), std::size_t(m));
common::nvtx::range dir_scope(alongRows ? "alongRows" : "acrossRows");

auto lineLen = m;
auto nLines = n;
auto lineLen = alongRows ? m : n;
auto nLines = alongRows ? n : m;

// create a padded span based on testdata (just for functional testing)
size_t matrix_size_padded;
Expand All @@ -244,7 +244,7 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
typename raft::layout_right_padded<T>::mapping<matrix_extent<I>> layout{extents};
matrix_size_padded = layout.required_span_size();
} else {
auto extents = matrix_extent<I>{m, n};
auto extents = matrix_extent<I>{n, m};
typename raft::layout_left_padded<T>::mapping<matrix_extent<I>> layout{extents};
matrix_size_padded = layout.required_span_size();
}
Expand All @@ -259,9 +259,9 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
common::nvtx::range vecs_scope("one vec");
if (alongRows) {
auto inSpan = make_device_aligned_matrix_view<T, I, raft::layout_right_padded<T>>(
blob_in.data(), nLines, lineLen);
blob_in.data(), n, m);
auto outSpan = make_device_aligned_matrix_view<T, I, raft::layout_right_padded<T>>(
blob_out.data(), nLines, lineLen);
blob_out.data(), n, m);
// prep padded input data
thrust::for_each_n(rmm::exec_policy(stream),
thrust::make_counting_iterator(0ul),
Expand All @@ -271,7 +271,7 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
});
auto inSpanConst =
make_device_aligned_matrix_view<const T, I, raft::layout_right_padded<T>>(
blob_in.data(), nLines, lineLen);
blob_in.data(), n, m);
runLinewiseSumPadded<raft::layout_right_padded<T>>(
outSpan, inSpanConst, lineLen, nLines, alongRows, vec1);

Expand All @@ -292,9 +292,9 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par

} else {
auto inSpan = make_device_aligned_matrix_view<T, I, raft::layout_left_padded<T>>(
blob_in.data(), lineLen, nLines);
blob_in.data(), n, m);
auto outSpan = make_device_aligned_matrix_view<T, I, raft::layout_left_padded<T>>(
blob_out.data(), lineLen, nLines);
blob_out.data(), n, m);
// prep padded input data
thrust::for_each_n(rmm::exec_policy(stream),
thrust::make_counting_iterator(0ul),
Expand All @@ -304,7 +304,7 @@ struct LinewiseTest : public ::testing::TestWithParam<typename ParamsReader::Par
});
auto inSpanConst =
make_device_aligned_matrix_view<const T, I, raft::layout_left_padded<T>>(
blob_in.data(), lineLen, nLines);
blob_in.data(), n, m);
runLinewiseSumPadded<raft::layout_left_padded<T>>(
outSpan, inSpanConst, lineLen, nLines, alongRows, vec1);

Expand Down

0 comments on commit 0df8493

Please sign in to comment.