Go to the documentation of this file.
75 #ifndef __DEV_DIST_IFACE_HH__
76 #define __DEV_DIST_IFACE_HH__
128 std::condition_variable
cv;
175 virtual bool run(
bool same_tick) = 0;
223 bool run(
bool same_tick)
override;
228 ReqType do_stop_sync)
override;
262 bool run(
bool same_tick)
override;
267 ReqType do_stop_sync)
override;
270 panic(
"Switch requested checkpoint");
273 panic(
"Switch requested exit");
276 panic(
"Switch requested stop sync");
401 Tick prev_recv_tick);
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool isAbort
Flag is set if the sync is aborted (e.g.
static unsigned distIfaceNum
Number of DistIface objects (i.e.
virtual void requestExit(ReqType req)=0
static unsigned recvThreadsNum
Number of receiver threads (in this gem5 process)
DistIface(unsigned dist_rank, unsigned dist_size, Tick sync_start, Tick sync_repeat, EventManager *em, bool use_pseudo_op, bool is_switch, int num_nodes)
ctor
The interface class to talk to peer gem5 processes.
bool doCkpt
Flag is set if taking a ckpt is permitted upon sync completion.
SyncEvent()
Only the firstly instantiated DistIface object will call this constructor.
void abort()
Abort processing an on-going sync event (in case of an error, e.g.
bool run(bool same_tick) override
Core method to perform a full dist sync.
void process() override
This is a global event so process() will only be called by exactly one simulation thread.
void recvThreadFunc(Event *recv_done, Tick link_delay)
The function executed by a receiver thread.
static DistIface * primary
The very first DistIface object created becomes the primary interface.
virtual void serialize(CheckpointOut &cp) const override=0
Serialize an object.
Basic support for object serialization.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Desc(EthPacketPtr p, Tick s, Tick d)
std::queue< Desc > descQueue
The queue to store the receive descriptors.
bool progress(Tick max_req_tick, Tick next_repeat, ReqType do_ckpt, ReqType do_exit, ReqType do_stop_sync) override
Callback when the receiver thread gets a sync ack message.
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t Tick
Tick count type.
void resumeRecvTicks()
Adjust receive ticks for pending packets when restoring from a checkpoint.
void requestExit(ReqType) override
void requestCkpt(ReqType) override
static void toggleSync(ThreadContext *tc)
Trigger the primary to start/stop synchronization.
RecvScheduler(EventManager *em)
Scheduler for the incoming data packets.
void serialize(CheckpointOut &cp) const override
Serialize an object.
static System * sys
System pointer used to wakeup sleeping threads when stopping sync.
EthPacketPtr popPacket()
Fetch the next packet that is to be received by the simulated network link.
void serialize(CheckpointOut &cp) const override
Serialize an object.
unsigned numExitReq
Counter for recording exit requests.
bool progress(Tick max_req_tick, Tick next_repeat, ReqType do_ckpt, ReqType do_exit, ReqType do_stop_sync) override
Callback when the receiver thread gets a sync ack message.
A special global event that synchronizes all threads and forces them to process asynchronously enqueu...
bool run(bool same_tick) override
Core method to perform a full dist sync.
Tick nextRepeat
The repeat value for the next periodic sync.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
DrainState
Object drain/handover states.
void init(const Event *e, Tick link_delay)
unsigned size
The number of gem5 processes comprising this dist simulation.
ReqType needStopSync
Sync stop requested.
virtual bool run(bool same_tick)=0
Core method to perform a full dist sync.
The global event to schedule periodic dist sync.
virtual void initTransport()=0
Init hook for the underlaying transport.
Received packet descriptor.
void requestStopSync(ReqType req) override
static uint64_t rankParam()
Getter for the dist rank param.
static const Priority Sim_Exit_Pri
If we want to exit on this cycle, it's the very last thing we do.
unsigned numCkptReq
Counter for recording ckpt requests.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Interface for objects that might require draining before checkpointing.
Tick linkDelay
The link delay in ticks for the simulated Ethernet link.
Class to encapsulate information about data packets received.
Tick nextAt
Tick for the next periodic sync (if the event is not scheduled yet)
DistHeaderPkt::Header Header
void unserialize(CheckpointIn &cp) override
Unserialize an object.
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.
static bool isSwitch
Is this node a switch?
void requestCkpt(ReqType req) override
void requestStopSync(ReqType) override
unsigned rank
The rank of this process among the gem5 peers.
unsigned waitNum
Number of receiver threads that not yet completed the current global synchronisation.
Tick calcReceiveTick(Tick send_tick, Tick send_delay, Tick prev_recv_tick)
Calculate the tick to schedule the next receive done event.
void drainResume() override
Resume execution after a successful drain.
virtual void sendCmd(const Header &header)=0
Send out a control command to the remote end.
Tick prevRecvTick
The tick when the most recent receive event was processed.
unsigned numStopSyncReq
Counter for recording stop sync requests.
static SyncEvent * syncEvent
The singleton SyncEvent object to schedule periodic dist sync.
ReqType needExit
Exit requested.
void init(Event *recv_done, Tick link_delay)
Initialize network link parameters.
std::thread * recvThread
Receiver thread pointer.
virtual void sendPacket(const Header &header, const EthPacketPtr &packet)=0
Send out a data packet to the remote end.
bool doExit
Flag is set if exit is permitted upon sync completion.
void start()
Schedule the first periodic sync event.
virtual void requestStopSync(ReqType req)=0
static bool readyToExit(Tick delay)
Initiate the exit from the simulation.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static Sync * sync
The singleton Sync object to perform dist synchronisation.
bool syncStartOnPseudoOp
Use pseudoOp to start synchronization.
std::shared_ptr< EthPacketData > EthPacketPtr
void requestExit(ReqType req) override
ReqType needCkpt
Ckpt requested.
bool doStopSync
Flag is set if sync is to stop upon sync completion.
bool ckptRestore
Flag to set if receive ticks for pending packets need to be recalculated due to changed link latencie...
DistHeaderPkt::ReqType ReqType
virtual void unserialize(CheckpointIn &cp) override=0
Unserialize an object.
DistHeaderPkt::MsgType MsgType
void init(Tick start, Tick repeat)
Initialize periodic sync params.
void pushPacket(EthPacketPtr new_packet, Tick send_tick, Tick send_delay)
Push a newly arrived packet into the desc queue.
static bool readyToCkpt(Tick delay, Tick period)
Initiate taking a checkpoint.
void spawnRecvThread(const Event *recv_done, Tick link_delay)
spawn the receiver thread.
unsigned distIfaceId
Unique id for the dist link.
std::ostream CheckpointOut
virtual void recvPacket(const Header &header, EthPacketPtr &packet)=0
Receive a packet from the remote end.
bool _draining
Flag to set when the system is draining.
virtual void requestCkpt(ReqType req)=0
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual bool recvHeader(Header &header)=0
Receive a header (i.e.
std::mutex lock
The lock to protect access to the Sync object.
EventManager * eventManager
The event manager associated with the simulated Ethernet link.
Event * recvDone
The receive done event for the simulated Ethernet link.
void packetOut(EthPacketPtr pkt, Tick send_delay)
Send out an Ethernet packet.
EthPacketPtr packetIn()
Fetch the packet scheduled to be received next by the simulated network link.
RecvScheduler recvScheduler
Meta information about data packets received.
SyncSwitch(int num_nodes)
unsigned numNodes
Number of connected simulated nodes.
static uint64_t sizeParam()
Getter for the dist size param.
std::condition_variable cv
Condition variable for the simulation thread to wait on until all receiver threads completes the curr...
Tick syncStart
Tick to schedule the first dist sync event.
#define panic(...)
This implements a cprintf based panic() function.
Tick syncRepeat
Frequency of dist sync events in ticks.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17