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

overload make_device_uvector_async for bool type #14062

Closed
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
28 changes: 28 additions & 0 deletions cpp/include/cudf/detail/utilities/vector_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ rmm::device_uvector<T> make_device_uvector_async(host_span<T const> source_data,
return ret;
}

/**
* @brief Asynchronously construct a `device_uvector` containing a deep copy of data from a host
* container that cannot be implicitly converted to a `host_span`.
*
* @note This function does not synchronize `stream`.
*
* @tparam Container The type of the container to copy from
* @tparam T The type of the data to copy
* @param c The input host container from which to copy
* @param stream The stream on which to allocate memory and perform the copy
* @param mr The memory resource to use for allocating the returned device_uvector
* @return A device_uvector containing the copied data
*/
template <
typename Container,
std::enable_if_t<
!std::is_convertible_v<Container, host_span<typename Container::value_type const>>>* = nullptr>
rmm::device_uvector<typename Container::value_type> make_device_uvector_async(
Container const& c, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr)
{
rmm::device_uvector<typename Container::value_type> ret(c.size(), stream, mr);
for (std::size_t index = 0; index < c.size(); ++index) {
typename Container::value_type element{c[index]};
ret.set_element_async(index, element, stream);
}
return ret;
}

/**
* @brief Asynchronously construct a `device_uvector` containing a deep copy of data from a host
* container
Expand Down