Skip to content

ContextBase

nphtan edited this page May 18, 2021 · 11 revisions

KokkosResilience::ContextBase

Base object that all Contexts inherit.

Header File: Context.hpp

Synopsis

class ContextBase {

  explicit ContextBase( Config cfg );

  virtual ~ContextBase() = default;

  virtual void register_hashes(const std::vector< std::unique_ptr< Kokkos::ViewHolderBase > > &views,
                               const std::vector< Detail::CrefImpl > &crefs) = 0;
  virtual bool restart_available( const std::string &label, int version ) = 0;
  virtual void restart( const std::string &label, int version,
                        const std::vector< std::unique_ptr< Kokkos::ViewHolderBase > > &views ) = 0;
  virtual void checkpoint( const std::string &label, int version,
                           const std::vector< std::unique_ptr< Kokkos::ViewHolderBase > > &views ) = 0;

  virtual int latest_version( const std::string &label ) const noexcept = 0;
  virtual void register_alias( const std::string &original, const std::string &alias ) = 0;

  virtual void reset() = 0;

  const std::function< bool( int ) > &default_filter() const noexcept { return m_default_filter; }

  Config &config() noexcept { return m_config; }
  const Config &config() const noexcept { return m_config; }

#ifdef KR_ENABLE_TRACING
  Util::detail::TraceStack  &trace() { return m_trace; };
#endif

private:

  Config m_config;

  std::function< bool( int ) > m_default_filter;

#ifdef KR_ENABLE_TRACING
  Util::detail::TraceStack  m_trace;
#endif
};

Public Class Members

Constructors

  • explicit ContextBase( Config cfg );
    Constructs the default Context object.