gem5  v20.1.0.0
Public Member Functions | Protected Attributes | Friends | List of all members
DistIface::Sync Class Referenceabstract
Inheritance diagram for DistIface::Sync:
Serializable DistIface::SyncNode DistIface::SyncSwitch

Public Member Functions

void init (Tick start, Tick repeat)
 Initialize periodic sync params. More...
 
virtual bool run (bool same_tick)=0
 Core method to perform a full dist sync. More...
 
virtual bool progress (Tick send_tick, Tick next_repeat, ReqType do_ckpt, ReqType do_exit, ReqType do_stop_sync)=0
 Callback when the receiver thread gets a sync ack message. More...
 
void abort ()
 Abort processing an on-going sync event (in case of an error, e.g. More...
 
virtual void requestCkpt (ReqType req)=0
 
virtual void requestExit (ReqType req)=0
 
virtual void requestStopSync (ReqType req)=0
 
void drainComplete ()
 
virtual void serialize (CheckpointOut &cp) const override=0
 Serialize an object. More...
 
virtual void unserialize (CheckpointIn &cp) override=0
 Unserialize an object. More...
 
- Public Member Functions inherited from Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Protected Attributes

std::mutex lock
 The lock to protect access to the Sync object. More...
 
std::condition_variable cv
 Condition variable for the simulation thread to wait on until all receiver threads completes the current global synchronisation. More...
 
unsigned waitNum
 Number of receiver threads that not yet completed the current global synchronisation. More...
 
bool doExit
 Flag is set if exit is permitted upon sync completion. More...
 
bool doCkpt
 Flag is set if taking a ckpt is permitted upon sync completion. More...
 
bool doStopSync
 Flag is set if sync is to stop upon sync completion. More...
 
Tick nextRepeat
 The repeat value for the next periodic sync. More...
 
Tick nextAt
 Tick for the next periodic sync (if the event is not scheduled yet) More...
 
bool isAbort
 Flag is set if the sync is aborted (e.g. More...
 

Friends

class SyncEvent
 

Additional Inherited Members

- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 Serializes all the SimObjects. More...
 
static void unserializeGlobals (CheckpointIn &cp)
 

Detailed Description

This class implements global sync operations among gem5 peer processes.

Note
This class is used as a singleton object (shared by all DistIface objects).

Definition at line 116 of file dist_iface.hh.

Member Function Documentation

◆ abort()

void DistIface::Sync::abort ( )

Abort processing an on-going sync event (in case of an error, e.g.

lost connection to a peer gem5)

Definition at line 85 of file dist_iface.cc.

References X86ISA::lock.

Referenced by DistIface::recvThreadFunc().

◆ drainComplete()

void DistIface::Sync::drainComplete ( )

Definition at line 290 of file dist_iface.cc.

Referenced by DistIface::serialize().

◆ init()

void DistIface::Sync::init ( Tick  start,
Tick  repeat 
)

Initialize periodic sync params.

Parameters
startStart tick for dist synchronisation
repeatFrequency of dist synchronisation

Definition at line 67 of file dist_iface.cc.

References inform, and panic.

Referenced by DistIface::init().

◆ progress()

virtual bool DistIface::Sync::progress ( Tick  send_tick,
Tick  next_repeat,
ReqType  do_ckpt,
ReqType  do_exit,
ReqType  do_stop_sync 
)
pure virtual

Callback when the receiver thread gets a sync ack message.

Returns
false if the receiver thread needs to stop (e.g. simulation is to exit)

Implemented in DistIface::SyncSwitch, and DistIface::SyncNode.

Referenced by DistIface::recvThreadFunc().

◆ requestCkpt()

virtual void DistIface::Sync::requestCkpt ( ReqType  req)
pure virtual

◆ requestExit()

virtual void DistIface::Sync::requestExit ( ReqType  req)
pure virtual

◆ requestStopSync()

virtual void DistIface::Sync::requestStopSync ( ReqType  req)
pure virtual

◆ run()

virtual bool DistIface::Sync::run ( bool  same_tick)
pure virtual

Core method to perform a full dist sync.

Returns
true if the sync completes, false if it gets aborted

Implemented in DistIface::SyncSwitch, and DistIface::SyncNode.

◆ serialize()

virtual void DistIface::Sync::serialize ( CheckpointOut cp) const
overridepure virtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Implemented in DistIface::SyncSwitch, and DistIface::SyncNode.

◆ unserialize()

virtual void DistIface::Sync::unserialize ( CheckpointIn cp)
overridepure virtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Implemented in DistIface::SyncSwitch, and DistIface::SyncNode.

Friends And Related Function Documentation

◆ SyncEvent

friend class SyncEvent
friend

Definition at line 159 of file dist_iface.hh.

Member Data Documentation

◆ cv

std::condition_variable DistIface::Sync::cv
protected

Condition variable for the simulation thread to wait on until all receiver threads completes the current global synchronisation.

Definition at line 128 of file dist_iface.hh.

◆ doCkpt

bool DistIface::Sync::doCkpt
protected

Flag is set if taking a ckpt is permitted upon sync completion.

Definition at line 141 of file dist_iface.hh.

◆ doExit

bool DistIface::Sync::doExit
protected

Flag is set if exit is permitted upon sync completion.

Definition at line 137 of file dist_iface.hh.

◆ doStopSync

bool DistIface::Sync::doStopSync
protected

Flag is set if sync is to stop upon sync completion.

Definition at line 145 of file dist_iface.hh.

Referenced by DistIface::SyncEvent::process().

◆ isAbort

bool DistIface::Sync::isAbort
protected

Flag is set if the sync is aborted (e.g.

due to connection lost)

Definition at line 157 of file dist_iface.hh.

◆ lock

std::mutex DistIface::Sync::lock
protected

The lock to protect access to the Sync object.

Definition at line 122 of file dist_iface.hh.

Referenced by DistIface::SyncNode::requestStopSync().

◆ nextAt

Tick DistIface::Sync::nextAt
protected

Tick for the next periodic sync (if the event is not scheduled yet)

Definition at line 153 of file dist_iface.hh.

◆ nextRepeat

Tick DistIface::Sync::nextRepeat
protected

The repeat value for the next periodic sync.

Definition at line 149 of file dist_iface.hh.

Referenced by DistIface::SyncEvent::process(), and DistIface::SyncEvent::start().

◆ waitNum

unsigned DistIface::Sync::waitNum
protected

Number of receiver threads that not yet completed the current global synchronisation.

Definition at line 133 of file dist_iface.hh.


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

Generated on Wed Sep 30 2020 14:02:23 for gem5 by doxygen 1.8.17