ygm::io::multi_output

template<typename Partitioner = ygm::container::detail::old_hash_partitioner<std::string>>
class multi_output

Class for writing output to multiple named files in distributed memory.

Template Parameters:

Partitioner – Type used to assign filenames to ranks for writing

Public Types

using self_type = multi_output<Partitioner>

Public Functions

inline multi_output(ygm::comm &comm, std::string filename_prefix, size_t buffer_length = 1024 * 1024, bool append = false)

Construct a multi_output object.

filename_prefix is assumed to be a directory name and has a “/” appended if not already present to force it to be a directory

Parameters:
  • comm – Communicator to use for communication

  • filename_prefix – Prefix used when creating filenames

  • buffer_length – Length of buffers to use before writing

  • append – If false, existing files are overwritten. Otherwise, output is appended to existing files.

inline ~multi_output()
template<typename ...Args>
inline void async_write_line(const std::string &subpath, Args&&... args)

Write a line of output.

Template Parameters:

Args... – Variadic types of output

Parameters:
  • subpath – Filename to append to filename_prefix mutli_output is created with when creating full output path

  • args... – Variadic arguments to write to output file

inline ygm::comm &comm()
inline ygm::ygm_ptr<self_type> get_ygm_ptr()

Access to own ygm_ptr.

Returns:

ygm_ptr used by the container when identifying itself in async calls on the ygm::comm

inline const ygm::ygm_ptr<self_type> get_ygm_ptr() const

Const access to own ygm ptr.

Returns:

ygm_ptr to const version of container