Skip to content

StdFileContext

nphtan edited this page May 19, 2021 · 1 revision

KokkosResilience::StdFileContext

Context objection for the StdFile backend.

Header File: StdFileContext.hpp

Synopsis

template <typename Backend>
class StdFileContext : public ContextBase {
public:
explicit StdFileContext(std::string const &filename, Config &cfg)
    : ContextBase(cfg), m_backend(*this, filename), m_filename(filename) {}

StdFileContext(const StdFileContext &) = delete;
StdFileContext(StdFileContext &&)      = default;

StdFileContext &operator=(const StdFileContext &) = delete;
StdFileContext &operator=(StdFileContext &&) = default;

virtual ~StdFileContext() 

std::string const &filename() const noexcept

Backend &backend()

void register_hashes(
    const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views,
    const std::vector<Detail::CrefImpl> &crefs) override 

bool restart_available(const std::string &label, int version) override 

void restart(const std::string &label, int version,
             const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
                 &views) override 

void checkpoint(const std::string &label, int version,
                const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
                    &views) override 

int latest_version(const std::string &label) const noexcept override 

void reset() override 

void register_alias( const std::string &original, const std::string &alias ) override 
};

Public Members

Constructors

  • explicit StdFileContext(std::string const &filename, Config &cfg)
        : ContextBase(cfg), m_backend(*this, filename), m_filename(filename) {}

    Construct a StdFileContext with the supplied filename and Config object.

  • StdFileContext(const StdFileContext &) = delete;

    Copy constructor is deleted.

  • StdFileContext(StdFileContext &&) = default;

    Move constructor.

Operators

  • StdFileContext &operator=(const StdFileContext &) = delete;

    Copy constructor is deleted.

  • StdFileContext &operator=(StdFileContext &&) = default;

    Move constructor.

Functions

  • std::string const &filename() const noexcept

    Access the underlying filename.

  • Backend &backend()

    Access the underlying Backend. Returns a reference.

  • void register_hashes(
        const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views,
        const std::vector<Detail::CrefImpl> &crefs) override

    Register Views. Overrides the ContextBase implementation.

  • bool restart_available(const std::string &label, int version) override

    Check if an existing restart is available. Searches based on the supplied label. version determines the most recent version to search for. For example, setting version to 5 will search for any restart up to version 5. Setting version to 0 will search for the most recent restart.

  • void restart(const std::string &label, int version,
                 const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
                     &views) override

    Restart the specified Views from the checkpoint determined by the label and version.

  • void checkpoint(const std::string &label, int version,
                    const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
                        &views) override

    Create a checkpoint of the specified Views.

  • int latest_version(const std::string &label) const noexcept override

    Get the latest version of the checkpoint with the name label.

  • void register_alias( const std::string &original, const std::string &alias ) override

    Register a new alias.

  • void reset() override

    Reset the context.