-
Notifications
You must be signed in to change notification settings - Fork 197
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
Add unittest for linalg::axpy
#942
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this test, @benfred! Not sure if you are finished but I figured it wouldn't hurt to do a quick first-pass review before I take off for the weekend.
cpp/test/linalg/axpy.cu
Outdated
int blocks = raft::ceildiv<int>(params.len, threads); | ||
naiveAxpy<T><<<blocks, threads, 0, stream>>>(params.len, params.scalar, x.data(), refy.data()); | ||
|
||
axpy(handle, params.len, ¶ms.scalar, x.data(), 1.0, y.data(), 1.0, stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to test the new mdspan
APIs (which will test the raw pointer functions as well since they just wrap them. Eventually the raw pointer APIs are going to go away and we'll just be using mdspan across the public APIs (and start using it in the detail APIs as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also test this with different strides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated to use the new mdspan api's - but hit some problems trying to get this going with different strides =( #944
Do you want to go ahead and make the changes for #944 in this PR? I think the amount of changes is still reasonably small to correct the API and get the test supporting the different strides. |
} else if (params.incx > 1) { | ||
axpy(handle, | ||
make_host_scalar_view<const T>(¶ms.alpha), | ||
make_strided_device_vector_view<const T>(x.data(), params.len, params.incx), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also test w/ column-major mdspan inputs directly? I think (e.g. raft::make_device_vector_view<const T, std::uint32_t, raft::col_major>(...)
)? We should be able to capture the layout directly and then use the strides when a strided (and contiguous) layout is provided.
OutType y, | ||
const int incx, | ||
const int incy) | ||
OutType y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look great! Just a follow-up from our offline discussion yesterday. What do you think about just having the host scalar side accept the const typename InType::value_type
directly for now until we have the infrastructure to automatically convert to the host scalar view? We could also merge this and do it in a follow-on PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a Github issue to do this in a follow-on. I think we could scrape through and do it more generally as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds great - I think we should handle auto converting to host_scalar_view in a couple other spots than just the axpy code, so seems out of scope for this PR
@gpucibot merge |
Closes #873
Closes #944