提供给读取器输入数据的接口类。 更多...
#include <datasource.hpp>
|
virtual | ~datasource ()=default |
| 基类析构函数。
|
|
virtual std::unique_ptr< datasource::buffer > | host_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::buffer > | device_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 |
| 返回源是否包含任何数据。 更多...
|
|
提供给读取器输入数据的接口类。
定义在文件 datasource.hpp 的第 42 行。
◆ create() [1/6]
从设备内存缓冲区创建源。
- 参数
-
- 返回值
- 构建的 datasource 对象
◆ create() [2/6]
从主机内存缓冲区创建源。
- 参数
-
- 返回值
- 构建的 datasource 对象
◆ create() [3/6]
从用户实现的 datasource 对象创建源。
- 参数
-
[in] | source | 指向 datasource 对象的非拥有指针 |
- 返回值
- 构建的 datasource 对象
◆ create() [4/6]
从主机内存缓冲区创建源。
@deprecated 自 23.04
- 参数
-
- 返回值
- 构建的 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 |
从文件路径创建源。
参数 offset
和 max_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 向量,输入向量中的每个元素对应一个。
- 参数
-
- 返回值
- 构建的 datasource 对象向量
定义在文件 datasource.hpp 的第 146 行。
◆ device_read() [1/2]
返回包含源数据子集的设备缓冲区。
为了获得最佳性能,仅当 is_device_read_preferred
返回 true
时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。
- 异常
-
- 参数
-
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
时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。
- 异常
-
- 参数
-
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
时才应调用此函数。不支持直接设备读取的数据源实现不需要重写此函数。
- 异常
-
- 参数
-
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 |
◆ host_read() [2/2]
virtual size_t cudf::io::datasource::host_read |
( |
size_t |
offset, |
|
|
size_t |
size, |
|
|
uint8_t * |
dst |
|
) |
| |
|
pure virtual |
◆ 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 |
◆ is_empty()
virtual bool cudf::io::datasource::is_empty |
( |
| ) |
const |
|
inlinevirtual |
◆ size()
virtual size_t cudf::io::datasource::size |
( |
| ) |
const |
|
pure virtual |
◆ supports_device_read()
virtual bool cudf::io::datasource::supports_device_read |
( |
| ) |
const |
|
inlinevirtual |
此类的文档生成自以下文件