diststream(2rheolef)

πŸ“¦
version 7.2 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

✨ diststream ✨

okay bestie, this is the rheolef-7.2 page for diststream, and it's literally the glow-up your i/o needed πŸ’…


🌸 NAME 🌸

diststream β€” i/o streams in a distributed environment (rheolef-7.2) πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so the idiststream and odiststream classes give you a stream input and output interface for parallel and distributed codes. The main difference? Let's talk about it, because it's giving main character energy ✨

Recall that, with the usual std::istream and std::ostream, any i/o operation is executed on all processes: e.g. the output is printed many times. Not cute. In contrast, idiststream and odiststream manage the distributed environment nicely 🫢

For small data β€” like int, double or string β€” a specific processor is selected for i/o operations. For large data, the i/o operations are delegated to a specific class member function, when available. Periodt. πŸ‘‘

And for convenience? The standard streams cin, cout, clog and cerr are extended as din, dout, dlog and derr, respectively. Obsessed with this fr fr 🌈


πŸŽ€ FILE SUFFIXES πŸŽ€

okay so, finally: an optional suffix extension to the file name is automatically handled πŸ’«

odiststream foo('NAME', 'suffix');

is similar to

ofstream foo('NAME.suffix');

Conversely,

irheostream foo('NAME','suffix');

is similar to

ifstream foo('NAME.suffix');

see how that works? iconic. πŸ’…


Recursive search in a directory list is provided for finding the input file πŸ” However, we look at a search path environment variable RHEOPATH in order to find NAME while the suffix is assumed. And moreover? gzip compressed files, ending with the .gz suffix, are handled β€” and decompression is done automatically on the fly in that case. no cap. 🧚


πŸ’œ COMPRESSION πŸ’œ

File compression/decompresion is handled on the fly, thanks to the gzip library. The data compression is assumed by default for output: it can be deactivated while opening a file by an optional argument:

odiststream foo('NAME', 'suffix', io::nogz);

lowkey the vibes here are immaculate πŸ“


🌟 APPEND MODE 🌟

An existing file, possibly compressed, can be reopen in append mode. New results will be appended at the end of an existing file:

odiststream foo('NAME', 'suffix', io::app);

so you keep the old stuff and stack the new stuff on top, bestie ✨


🫢 FLUSH 🫢

The flush member function is nicely handled in compression mode: this feature allows intermediate results to be available during long computations. Buffers are flushed and data are available in the output file. literally perfect for those long-running jobs 😭πŸ”₯


πŸ‘‘ IMPLEMENTATION πŸ‘‘

This documentation has been generated from file linalg/lib/diststream.h πŸ“„

class idiststream {
public:
  typedef std::size_t size_type;

// allocators/deallocators:

  idiststream();
  idiststream (std::istream& is, const communicator& comm = communicator());
  idiststream (std::string filename, std::string suffix = "",
             const communicator& comm = communicator());
  ~idiststream();

// modifiers:

  void open (std::string filename, std::string suffix = "",
             const communicator& comm = communicator());
  void close();

// accessors:

  const communicator& comm() const { return _comm; }
  bool good() const;
  operator bool() const { return good(); }
  static size_type io_proc();

};
class odiststream {
public:
  typedef std::size_t size_type;

// allocators/deallocators:

  odiststream();
  odiststream (std::string filename, std::string suffix = "",
              io::mode_type mode = io::out, const communicator& comm = communicator());
  odiststream (std::string filename,
              io::mode_type mode, const communicator& comm = communicator());
  odiststream (std::string filename, std::string suffix, const communicator& comm);
  odiststream (std::string filename, const communicator& comm);
  odiststream(std::ostream& os, const communicator& comm = communicator());
  ~odiststream();

// modifiers:

   void open (std::string filename, std::string suffix = "",
             io::mode_type mode = io::out, const communicator& comm = communicator());
   void open (std::string filename,
             io::mode_type mode, const communicator& comm = communicator());
   void open (std::string filename, std::string suffix,
             const communicator& comm);
   void open (std::string filename, const communicator& comm);
   void flush();
   void close();

// accessors:

   const communicator& comm() const { return _comm; }
   bool good() const;
   operator bool() const { return good(); }
   static size_type io_proc();

};

🌈 AUTHOR 🌈

Pierre Saramito <Pierre.Saramito@imag.fr> πŸ’Œ


Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr> GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. πŸ™ˆ


aaaand that's the whole page bestie πŸŽ€ this was rheolef Version 7.2, and the page is diststream(2rheolef). go forth and stream, you got this πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from