Attention
The vector search and clustering algorithms in RAFT are being migrated to a new library dedicated to vector search called cuVS. We will continue to support the vector search algorithms in RAFT during this move, but will no longer update them after the RAPIDS 24.06 (June) release. We plan to complete the migration by RAPIDS 24.08 (August) release.
temporary_device_buffer: Temporary raft::device_mdspan Producing Object#
#include <raft/core/temporary_device_buffer.hpp>
-
template<typename ElementType, typename Extents, typename LayoutPolicy = layout_c_contiguous, template<typename> typename ContainerPolicy = device_uvector_policy>
class temporary_device_buffer# - #include <temporary_device_buffer.hpp>
An object which provides temporary access on-device to memory from either a host or device pointer. This object provides a
view()
method that will provide araft::device_mdspan
that may be read-only depending on const-qualified nature of the input pointer.- Template Parameters:
ElementType – type of the input
Extents – raft::extents
LayoutPolicy – layout of the input
ContainerPolicy – container to be used to own device memory if needed
Public Functions
-
inline temporary_device_buffer(resources const &handle, ElementType *data, Extents extents, bool write_back = false)#
Construct a new temporary device buffer object.
- Parameters:
handle – raft::resources
data – input pointer
extents – dimensions of input array
write_back – if true, any writes to the
view()
of this object will be copid back if the original pointer was in host memory
-
inline auto view() -> view_type#
Returns a
raft::device_mdspan
- Returns:
Factories#
-
template<typename ElementType, typename IndexType = std::uint32_t, typename LayoutPolicy = layout_c_contiguous, template<typename> typename ContainerPolicy = device_uvector_policy, size_t... Extents>
auto make_temporary_device_buffer(raft::resources const &handle, ElementType *data, raft::extents<IndexType, Extents...> extents, bool write_back = false)# Factory to create a
raft::temporary_device_buffer
#include <raft/core/resources.hpp> raft::resources handle; // Initialize raft::device_mdarray and raft::extents // Can be either raft::device_mdarray or raft::host_mdarray auto exts = raft::make_extents<int>(5); auto array = raft::make_device_mdarray<int, int>(handle, exts); auto d_buf = raft::make_temporary_device_buffer(handle, array.data_handle(), exts);
- Template Parameters:
ElementType – type of the input
IndexType – index type of
raft::extents
LayoutPolicy – layout of the input
ContainerPolicy – container to be used to own device memory if needed
Extents – variadic dimensions for
raft::extents
- Parameters:
handle – raft::resources
data – input pointer
extents – dimensions of input array
write_back – if true, any writes to the
view()
of this object will be copid back if the original pointer was in host memory
- Returns:
-
template<typename ElementType, typename IndexType = std::uint32_t, typename LayoutPolicy = layout_c_contiguous, template<typename> typename ContainerPolicy = device_uvector_policy, size_t... Extents>
auto make_readonly_temporary_device_buffer(raft::resources const &handle, ElementType *data, raft::extents<IndexType, Extents...> extents)# Factory to create a
raft::temporary_device_buffer
which produces a read-onlyraft::device_mdspan
fromview()
method withwrite_back=false
#include <raft/core/resources.hpp> raft::resources handle; // Initialize raft::device_mdarray and raft::extents // Can be either raft::device_mdarray or raft::host_mdarray auto exts = raft::make_extents<int>(5); auto array = raft::make_device_mdarray<int, int>(handle, exts); auto d_buf = raft::make_readonly_temporary_device_buffer(handle, array.data_handle(), exts);
- Template Parameters:
ElementType – type of the input
IndexType – index type of
raft::extents
LayoutPolicy – layout of the input
ContainerPolicy – container to be used to own device memory if needed
Extents – variadic dimensions for
raft::extents
- Parameters:
handle – raft::resources
data – input pointer
extents – dimensions of input array
- Returns:
-
template<typename ElementType, typename IndexType = std::uint32_t, typename LayoutPolicy = layout_c_contiguous, template<typename> typename ContainerPolicy = device_uvector_policy, size_t... Extents, typename = std::enable_if_t<not std::is_const_v<ElementType>>>
auto make_writeback_temporary_device_buffer(raft::resources const &handle, ElementType *data, raft::extents<IndexType, Extents...> extents)# Factory to create a
raft::temporary_device_buffer
which produces a writeableraft::device_mdspan
fromview()
method withwrite_back=true
#include <raft/core/resources.hpp> raft::resources handle; // Initialize raft::host_mdarray and raft::extents // Can be either raft::device_mdarray or raft::host_mdarray auto exts = raft::make_extents<int>(5); auto array = raft::make_host_mdarray<int, int>(handle, exts); auto d_buf = raft::make_writeback_temporary_device_buffer(handle, array.data_handle(), exts);
- Template Parameters:
ElementType – type of the input
IndexType – index type of
raft::extents
LayoutPolicy – layout of the input
ContainerPolicy – container to be used to own device memory if needed
Extents – variadic dimensions for
raft::extents
- Parameters:
handle – raft::resources
data – input pointer
extents – dimensions of input array
- Returns: