| 公共成员函数 | 静态公共成员函数 | 所有成员列表
cudf::io::datasource Class Reference抽象

提供给读取器输入数据的接口类。 更多...

#include <datasource.hpp>

cudf::io::datasource 的继承图
cudf::io::external::kafka::kafka_consumer

class  buffer
 datasource 返回给调用者的缓冲区的接口类。 更多...
 
class  non_owning_buffer
 非拥有缓冲区的实现,datasource 在销毁之前持有该缓冲区。 更多...
 
class  owning_buffer
 buffer 的派生实现,拥有数据。 更多...
 

公共成员函数

virtual ~datasource ()=default
 基类析构函数。
 
virtual std::unique_ptr< datasource::bufferhost_read (size_t offset, size_t size)=0
 返回包含源数据子集的缓冲区。 更多...
 
virtual std::future< std::unique_ptr< datasource::buffer > > host_read_async (size_t offset, size_t size)
 从数据源异步读取指定部分数据。 更多...
 
virtual size_t host_read (size_t offset, size_t size, uint8_t *dst)=0
 将选定范围读入预分配的缓冲区。 更多...
 
virtual std::future< size_t > host_read_async (size_t offset, size_t size, uint8_t *dst)
 从源异步读取数据到提供的主机内存缓冲区中。 更多...
 
virtual bool supports_device_read () const
 此源是否支持直接读取到设备内存中。 更多...
 
virtual bool is_device_read_preferred (size_t size) const
 估计直接设备读取对于给定大小是否更优。 更多...
 
virtual std::unique_ptr< datasource::bufferdevice_read (size_t offset, size_t size, rmm::cuda_stream_view stream)
 返回包含源数据子集的设备缓冲区。 更多...
 
virtual size_t device_read (size_t offset, size_t size, uint8_t *dst, rmm::cuda_stream_view stream)
 将选定范围读入预分配的设备缓冲区。 更多...
 
virtual std::future< size_t > device_read_async (size_t offset, size_t size, uint8_t *dst, rmm::cuda_stream_view stream)
 将选定范围异步读入预分配的设备缓冲区。 更多...
 
virtual size_t size () const =0
 返回源数据的大小。 更多...
 
virtual bool is_empty () const
 返回源是否包含任何数据。 更多...
 

静态公共成员函数

static std::unique_ptr< datasourcecreate (std::string const &filepath, size_t offset=0, size_t max_size_estimate=0)
 从文件路径创建源。 更多...
 
static std::unique_ptr< datasourcecreate (host_buffer const &buffer)
 从主机内存缓冲区创建源。 更多...
 
static std::unique_ptr< datasourcecreate (cudf::host_span< std::byte const > buffer)
 从主机内存缓冲区创建源。 更多...
 
static std::unique_ptr< datasourcecreate (cudf::device_span< std::byte const > buffer)
 从设备内存缓冲区创建源。 更多...
 
static std::unique_ptr< datasourcecreate (datasource *source)
 从用户实现的 datasource 对象创建源。 更多...
 
template<typename T >
static std::vector< std::unique_ptr< datasource > > create (std::vector< T > const &args)
 创建 datasource 向量,输入向量中的每个元素对应一个。 更多...
 

详细描述

提供给读取器输入数据的接口类。

定义在文件 datasource.hpp 的第 42 行。

成员函数文档

◆ create() [1/6]

static std::unique_ptr<datasource> cudf::io::datasource::create ( cudf::device_span< std::byte const >  buffer)
static

从设备内存缓冲区创建源。

参数
buffer设备缓冲区对象
返回值
构建的 datasource 对象

◆ create() [2/6]

static std::unique_ptr<datasource> cudf::io::datasource::create ( cudf::host_span< std::byte const >  buffer)
static

从主机内存缓冲区创建源。

参数
[in]buffer主机缓冲区对象
返回值
构建的 datasource 对象

◆ create() [3/6]

static std::unique_ptr<datasource> cudf::io::datasource::create ( datasource source)
static

从用户实现的 datasource 对象创建源。

参数
[in]source指向 datasource 对象的非拥有指针
返回值
构建的 datasource 对象

◆ create() [4/6]

static std::unique_ptr<datasource> cudf::io::datasource::create ( host_buffer const &  buffer)
static

从主机内存缓冲区创建源。

@deprecated 自 23.04

参数
[in]buffer主机缓冲区对象
返回值
构建的 datasource 对象

◆ create() [5/6]

static std::unique_ptr<datasource> cudf::io::datasource::create ( std::string const &  filepath,
size_t  offset = 0,
size_t  max_size_estimate = 0 
)
static

从文件路径创建源。

参数 offsetmax_size_estimate 是给 datasource 实现关于预期读取数据范围的提示。实现可以使用这些提示来优化读取操作。这些参数通常基于字节范围选项。在这种情况下,max_size_estimate 可以包含字节范围之后的填充,以包括处理可能需要的额外数据。

参数
[in]filepath要使用的文件路径
[in]offset开始读取数据的字节偏移量(默认为零)
[in]max_size_estimate将要读取的数据范围的上限估计值(默认为零,表示 offset 之后的所有文件)
返回值
构建的 datasource 对象

◆ create() [6/6]

template<typename T >
static std::vector<std::unique_ptr<datasource> > cudf::io::datasource::create ( std::vector< T > const &  args)
inlinestatic

创建 datasource 向量,输入向量中的每个元素对应一个。

参数
[in]args参数向量
返回值
构建的 datasource 对象向量

定义在文件 datasource.hpp 的第 146 行。

◆ device_read() [1/2]

virtual std::unique_ptr<datasource::buffer> cudf::io::datasource::device_read ( size_t  offset,
size_t  size,
rmm::cuda_stream_view  stream 
)
inlinevirtual

返回包含源数据子集的设备缓冲区。

为了获得最佳性能,仅当 is_device_read_preferred 返回 true 时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。

异常
cudf::logic_error对象不支持直接设备读取,即 supports_device_read 返回 false
参数
offset从开始的字节数
size要读取的字节数
stream要使用的 CUDA 流
返回值
设备内存中的数据缓冲区

定义在文件 datasource.hpp 的第 254 行。

◆ device_read() [2/2]

virtual size_t cudf::io::datasource::device_read ( size_t  offset,
size_t  size,
uint8_t *  dst,
rmm::cuda_stream_view  stream 
)
inlinevirtual

将选定范围读入预分配的设备缓冲区。

为了获得最佳性能,仅当 is_device_read_preferred 返回 true 时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。

异常
cudf::logic_error当对象不支持直接设备读取时,即 supports_device_read 返回 false
参数
offset从开始的字节数
size要读取的字节数
dst现有设备内存的地址
stream要使用的 CUDA 流
返回值
读取的字节数(可能小于 size)

定义在文件 datasource.hpp 的第 278 行。

◆ device_read_async()

virtual std::future<size_t> cudf::io::datasource::device_read_async ( size_t  offset,
size_t  size,
uint8_t *  dst,
rmm::cuda_stream_view  stream 
)
inlinevirtual

将选定范围异步读入预分配的设备缓冲区。

返回一个 future 值,其中包含读取的字节数。调用返回值的 get() 方法会同步此函数。

为了获得最佳性能,仅当 is_device_read_preferred 返回 true 时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。

异常
cudf::logic_error当对象不支持直接设备读取时,即 supports_device_read 返回 false
参数
offset从开始的字节数
size要读取的字节数
dst现有设备内存的地址
stream要使用的 CUDA 流
返回值
作为 future 值的读取字节数(可能小于 size)

定义在文件 datasource.hpp 的第 303 行。

◆ host_read() [1/2]

virtual std::unique_ptr<datasource::buffer> cudf::io::datasource::host_read ( size_t  offset,
size_t  size 
)
pure virtual

返回包含源数据子集的缓冲区。

参数
[in]offset从开始的字节数
[in]size要读取的字节数
返回值
数据缓冲区(可能小于 size)

cudf::io::external::kafka::kafka_consumer 中实现。

◆ host_read() [2/2]

virtual size_t cudf::io::datasource::host_read ( size_t  offset,
size_t  size,
uint8_t *  dst 
)
pure virtual

将选定范围读入预分配的缓冲区。

参数
[in]offset从开始的字节数
[in]size要读取的字节数
[in]dst现有主机内存的地址
返回值
读取的字节数(可能小于 size)

cudf::io::external::kafka::kafka_consumer 中实现。

◆ host_read_async() [1/2]

virtual std::future<std::unique_ptr<datasource::buffer> > cudf::io::datasource::host_read_async ( size_t  offset,
size_t  size 
)
virtual

从数据源异步读取指定部分数据。

此函数发起一个异步读取操作,从数据源中给定的 offset 开始读取 size 字节的数据。根据具体的 datasource 实现,读取操作可能会延迟执行,直到等待返回的 future。

参数
offset数据源中开始读取的位置。
size从数据源读取的字节数。
返回值
一个 std::future,操作完成后将持有指向包含读取数据的 datasource::buffer 的 unique pointer。

◆ host_read_async() [2/2]

virtual std::future<size_t> cudf::io::datasource::host_read_async ( size_t  offset,
size_t  size,
uint8_t *  dst 
)
virtual

将数据从源异步读取到提供的主机内存缓冲区中。

此函数发起一个异步读取操作,从数据源中指定的 offset 开始,将指定字节数读入目标缓冲区。根据具体的 datasource 实现,读取操作可能会延迟执行,并在等待返回的 future 时执行。

参数
offset数据源中开始读取的位置。
size从数据源读取的字节数。
dst指向存储读取数据的目标缓冲区的指针。
返回值
一个 std::future 对象,操作完成后将持有读取的字节数。

◆ is_device_read_preferred()

virtual bool cudf::io::datasource::is_device_read_preferred ( size_t  size) const
inlinevirtual

估计直接设备读取对于给定大小是否更优。

参数
size要读取的字节数
返回值
设备读取对于给定大小是否预期会带来更好的性能

定义在文件 datasource.hpp 的第 233 行。

◆ is_empty()

virtual bool cudf::io::datasource::is_empty ( ) const
inlinevirtual

返回源是否包含任何数据。

返回值
如果包含数据则为 True,否则为 False

定义在文件 datasource.hpp 的第 323 行。

◆ size()

virtual size_t cudf::io::datasource::size ( ) const
pure virtual

返回源数据的大小。

返回值
源数据的大小(字节)

cudf::io::external::kafka::kafka_consumer 中实现。

◆ supports_device_read()

virtual bool cudf::io::datasource::supports_device_read ( ) const
inlinevirtual

此源是否支持直接读取到设备内存中。

如果此函数返回 true,当读取器在设备上处理数据时,datasource 将收到对 device_read() 的调用,而不是对 host_read() 的调用。大多数读取器仍会进行 host_read() 调用,用于处理主机上的输入部分(例如元数据)。

不支持直接设备读取的数据源实现不需要重写此函数。支持的实现应重写它以返回 false。

返回值
bool 此源是否支持调用 device_read()

定义在文件 datasource.hpp 的第 225 行。


此类的文档生成自以下文件