22 #include <rmm/cuda_stream_view.hpp>
51 static std::unique_ptr<data_sink>
create(std::string
const& filepath);
59 static std::unique_ptr<data_sink>
create(std::vector<char>* buffer);
69 static std::unique_ptr<data_sink>
create();
91 static std::vector<std::unique_ptr<data_sink>>
create(std::vector<T>
const& args)
93 std::vector<std::unique_ptr<data_sink>> sinks;
94 sinks.reserve(args.size());
95 std::transform(args.cbegin(), args.cend(), std::back_inserter(sinks), [](
auto const& arg) {
96 return data_sink::create(arg);
163 virtual void device_write(
void const* gpu_data,
size_t size, rmm::cuda_stream_view stream)
165 CUDF_FAIL(
"data_sink classes that support device_write must override it.");
192 rmm::cuda_stream_view stream)
194 CUDF_FAIL(
"data_sink classes that support device_write_async must override it.");
Interface class for storing the output data from the writers.
virtual void flush()=0
Flush the data written into the sink.
static std::vector< std::unique_ptr< data_sink > > create(std::vector< T > const &args)
Creates a vector of data sinks, one per element in the input vector.
virtual void device_write(void const *gpu_data, size_t size, rmm::cuda_stream_view stream)
Append the buffer content to the sink from a gpu address.
virtual bool supports_device_write() const
Whether or not this sink supports writing from gpu memory addresses.
static std::unique_ptr< data_sink > create(cudf::io::data_sink *const user_sink)
Create a wrapped custom user data sink.
virtual bool is_device_write_preferred(size_t size) const
Estimates whether a direct device write would be more optimal for the given size.
static std::unique_ptr< data_sink > create()
Create a void sink (one that does no actual io)
static std::unique_ptr< data_sink > create(std::string const &filepath)
Create a sink from a file path.
virtual ~data_sink()
Base class destructor.
virtual size_t bytes_written()=0
Returns the total number of bytes written into this sink.
virtual void host_write(void const *data, size_t size)=0
Append the buffer content to the sink.
virtual std::future< void > device_write_async(void const *gpu_data, size_t size, rmm::cuda_stream_view stream)
Asynchronously append the buffer content to the sink from a gpu address.
static std::unique_ptr< data_sink > create(std::vector< char > *buffer)
Create a sink from a std::vector.
#define CUDF_FAIL(...)
Indicates that an erroneous code path has been taken.
Type declarations for libcudf.