Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] linewiseop padded span test #964

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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