DASH  0.3.0
dash::io::hdf5::InputStream Class Reference

Public Types

typedef IOStreamMode< IOStreamModeios_mode_type
 

Public Member Functions

 InputStream (dash::launch lpolicy, std::string filename)
 Creates an HDF5 input stream using a launch policy. More...
 
 InputStream (std::string filename)
 Creates an HDF5 input stream using blocking IO. More...
 
 InputStream (const self_t &other)=delete
 
 InputStream (self_t &&other)=default
 
self_toperator= (const self_t &other)=delete
 
self_toperator= (self_t &&other)=default
 
InputStreamflush ()
 Synchronizes with the data source. More...
 

Friends

InputStreamoperator>> (InputStream &is, const dataset tbl)
 set name of dataset More...
 
InputStreamoperator>> (InputStream &is, setpattern_key pk)
 set metadata key at which the pattern will be stored More...
 
InputStreamoperator>> (InputStream &is, restore_pattern rs)
 set whether pattern layout should be restored from metadata More...
 
InputStreamoperator>> (InputStream &is, const type_converter conv)
 custom type converter function to convert native type to HDF5 type More...
 
template<typename Container_t >
InputStreamoperator>> (InputStream &is, Container_t &matrix)
 kicker which loads an container using the specified stream properties. More...
 

Detailed Description

Definition at line 25 of file InputStream.h.

Constructor & Destructor Documentation

◆ InputStream() [1/2]

dash::io::hdf5::InputStream::InputStream ( dash::launch  lpolicy,
std::string  filename 
)
inline

Creates an HDF5 input stream using a launch policy.

Support of dash::launch::async is still highly experimental and requires thread support in MPI. If multi-threaded access is not supported, blocking I/O is used as fallback. To wait for outstanding IO operations use flush(). Until the stream is not flushed, no write accesses to the container, as well as no barriers are allowed. Otherwise the behavior is undefined.

Definition at line 50 of file InputStream.h.

References dash::async, dash::is_multithreaded(), and dash::sync.

51  : _filename(filename), _dataset("data"), _launch_policy(lpolicy) {
52  if (_launch_policy == dash::launch::async && !dash::is_multithreaded()) {
53  _launch_policy = dash::launch::sync;
54  DASH_LOG_WARN(
55  "Requested ASIO but DART does not support "
56  "multi-threaded access. Blocking IO is used"
57  "as fallback");
58  }
59  }
bool is_multithreaded()
Check whether DASH has been initialized with support for multi-threaded access.
async launch policy
synchronous launch policy

◆ InputStream() [2/2]

dash::io::hdf5::InputStream::InputStream ( std::string  filename)
inlineexplicit

Creates an HDF5 input stream using blocking IO.

The stream takes an arbitrary number of modifiers and objects, where the objects are stored in the order of passing it to the stream.

The interface follows roughly the STL stream concept.

Example:

InputStream is("file.hdf5");
is >> dataset("dataset") >> array_a
>> dataset("seconddata") >> array_b;

Definition at line 79 of file InputStream.h.

References dash::sync.

80  : InputStream(dash::launch::sync, filename) {}
InputStream(dash::launch lpolicy, std::string filename)
Creates an HDF5 input stream using a launch policy.
Definition: InputStream.h:50
synchronous launch policy

Member Function Documentation

◆ flush()

InputStream& dash::io::hdf5::InputStream::flush ( )
inline

Synchronizes with the data source.

If dash::launch::async is used, waits until all data is read

Definition at line 99 of file InputStream.h.

99  {
100  DASH_LOG_DEBUG("flush input stream", _async_ops.size());
101  if (!_async_ops.empty()) {
102  _async_ops.back().wait();
103  }
104  DASH_LOG_DEBUG("input stream flushed");
105  return *this;
106  }

Friends And Related Function Documentation

◆ operator>> [1/5]

InputStream& operator>> ( InputStream is,
const dataset  tbl 
)
friend

set name of dataset

Definition at line 111 of file InputStream.h.

111  {
112  is._dataset = tbl._dataset;
113  return is;
114  }

◆ operator>> [2/5]

InputStream& operator>> ( InputStream is,
setpattern_key  pk 
)
friend

set metadata key at which the pattern will be stored

Definition at line 117 of file InputStream.h.

117  {
118  is._foptions.pattern_metadata_key = pk._key;
119  return is;
120  }

◆ operator>> [3/5]

InputStream& operator>> ( InputStream is,
restore_pattern  rs 
)
friend

set whether pattern layout should be restored from metadata

Definition at line 123 of file InputStream.h.

123  {
124  is._foptions.restore_pattern = rs._restore;
125  return is;
126  }

◆ operator>> [4/5]

InputStream& operator>> ( InputStream is,
const type_converter  conv 
)
friend

custom type converter function to convert native type to HDF5 type

Definition at line 129 of file InputStream.h.

129  {
130  is._converter = conv;
131  is._use_cust_conv = true;
132  return is;
133  }

◆ operator>> [5/5]

template<typename Container_t >
InputStream& operator>> ( InputStream is,
Container_t &  matrix 
)
friend

kicker which loads an container using the specified stream properties.


The documentation for this class was generated from the following file: