Turi Create
4.0
|
#include <core/data/sframe/gl_sarray.hpp>
Public Member Functions | |
gl_sarray_writer (flex_type_enum type, size_t num_segments=(size_t)(-1)) | |
void | write (const flexible_type &f, size_t segmentid) |
template<typename T > | |
void | write (T begin, T end, size_t segmentid) |
gl_sarray | close () |
size_t | num_segments () const |
Provides the ability to write gl_sarrays. The gl_sarray is internally cut into a collection of segments. Each segment can be written to independently, and the resultant SArray is the effective concatenation of all the segments.
Different segments can be written safely in parallel. It is not safe to write to the same segment simultanously.
Definition at line 2009 of file gl_sarray.hpp.
turi::gl_sarray_writer::gl_sarray_writer | ( | flex_type_enum | type, |
size_t | num_segments = (size_t)(-1) |
||
) |
Constructs a writer to write an gl_sarray of a particular type.
type | The content type of the SArray. Everything written to the writer (via write) must be of that type, is implicitly castable to that type, or is a missing value denoted with a FLEX_UNDEFINED value. |
num_segments | Optional. The number of segments of the SArray. Adjusting this parameter has little performance impact on the resultant gl_sarray. Modifying this value is only helpful for providing writer parallelism. Defaults to the number of cores on the machine. |
gl_sarray turi::gl_sarray_writer::close | ( | ) |
Stops all writes and returns the resultant SArray.
size_t turi::gl_sarray_writer::num_segments | ( | ) | const |
Returns the number of segments of the SArray; this is the same value provided on construction of the writer.
void turi::gl_sarray_writer::write | ( | const flexible_type & | f, |
size_t | segmentid | ||
) |
Writes a single value to a given segment.
For instance,
Strings are the most general type and everything can cast to it. hence:
Different segments can be written safely in parallel. It is not safe to write to the same segment simultanously.
f | The value to write. This value should be of the requested type (as set in the constructor), or is castable to the requested type, or is FLEX_UNDEFINED. |
segmentid | The segment to write to. |
|
inline |
Writes a range of values to a given segment.
Essentially equivalent to:
Different segments can be written safely in parallel. It is not safe to write to the same segment simultanously.
start | The start iterator of the range to write. |
end | The end iterator of the range to write. |
segmentid | The segment to write to. |
Definition at line 2072 of file gl_sarray.hpp.