SST/macro
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
sstmac::event_manager Class Referenceabstract

Base type for implementations of an engine that is able to schedule events and advance simulation time in the right order. More...

#include <event_manager.h>

Inheritance diagram for sstmac::event_manager:
Inheritance graph
Collaboration diagram for sstmac::event_manager:
Collaboration graph

Classes

struct  stats_entry
 

Public Member Functions

virtual std::string to_string () const
 
bool is_complete ()
 
virtual void init_factory_params (sprockit::sim_parameters *params)
 
virtual ~event_manager ()
 Goodbye. More...
 
virtual void clear (timestamp zero_time=timestamp(0))=0
 Clear all events and set time back to a zero of your choice. More...
 
virtual void run ()=0
 Run the eventmanager. More...
 
virtual bool empty () const =0
 
timestamp now () const
 
void register_stat (stat_collector *stat, bool reduce_all=true, bool dump_all=false, bool dump_main=true)
 
stat_collectorregister_thread_unique_stat (stat_collector *stat, bool reduce_all=true, bool dump_all=false, bool dump_main=true)
 
virtual void cancel_all_messages (event_loc_id canceled_loc)=0
 
partitiontopology_partition () const
 
parallel_runtimeruntime () const
 
void finish_stats ()
 
virtual void finish_stats (stat_collector *main, const std::string &name, timestamp end)
 
void stop ()
 
int me () const
 
int worker_id () const
 
int nproc () const
 
int nworker () const
 
virtual void ipc_schedule (timestamp t, event_loc_id dst, event_loc_id src, uint32_t seqnum, event *ev)
 
virtual void multithread_schedule (int srcthread, int dstthread, uint32_t seqnum, event_queue_entry *ev)
 
virtual int lpid () const
 
int thread_id () const
 
int nthread () const
 
virtual event_managerev_man_for_thread (int thread_id) const
 
virtual void set_interconnect (hw::interconnect *interconn)
 
virtual void schedule_stop (timestamp until)
 
- Public Member Functions inherited from sprockit::factory_type
virtual void init_factory_params (sim_parameters *params)
 
virtual void finalize_init ()
 

Static Public Member Functions

static int current_thread_id ()
 

Static Public Attributes

static event_managerglobal
 

Protected Member Functions

 event_manager (parallel_runtime *rt)
 
void set_now (const timestamp &ts)
 

Protected Attributes

bool complete_
 
bool stopped_
 
bool finish_on_stop_
 
parallel_runtimert_
 
int thread_id_
 
int me_
 
int nproc_
 
int nthread_
 

Static Protected Attributes

static std::vector< pthread_tpthreads_
 
static std::vector< pthread_attr_tpthread_attrs_
 

Private Member Functions

virtual void schedule (timestamp start_time, uint32_t seqnum, event_queue_entry *event_queue_entry)=0
 

Private Attributes

std::map< std::string, stats_entrystats_
 
timestamp now_
 

Friends

class event_scheduler
 
class native::manager
 
class native::macro_manager
 

Detailed Description

Base type for implementations of an engine that is able to schedule events and advance simulation time in the right order.

Definition at line 47 of file event_manager.h.

Constructor & Destructor Documentation

virtual sstmac::event_manager::~event_manager ( )
virtual

Goodbye.

sstmac::event_manager::event_manager ( parallel_runtime rt)
inlineprotected

Definition at line 197 of file event_manager.h.

References set_now().

Here is the call graph for this function:

Member Function Documentation

virtual void sstmac::event_manager::cancel_all_messages ( event_loc_id  canceled_loc)
pure virtual
virtual void sstmac::event_manager::clear ( timestamp  zero_time = timestamp(0))
pure virtual

Clear all events and set time back to a zero of your choice.

This call shall not be permitted while the event manager is running.

Implemented in sstmac::native::event_heap, sstmac::native::event_map, and sstmac::native::event_calendar.

static int sstmac::event_manager::current_thread_id ( )
static

Referenced by nthread().

virtual bool sstmac::event_manager::empty ( ) const
pure virtual
virtual event_manager* sstmac::event_manager::ev_man_for_thread ( int  thread_id) const
virtual

Reimplemented in sstmac::native::multithreaded_event_container.

Referenced by nthread().

void sstmac::event_manager::finish_stats ( )

Referenced by now().

virtual void sstmac::event_manager::finish_stats ( stat_collector main,
const std::string &  name,
timestamp  end 
)
virtual
virtual void sstmac::event_manager::init_factory_params ( sprockit::sim_parameters *  params)
virtual
virtual void sstmac::event_manager::ipc_schedule ( timestamp  t,
event_loc_id  dst,
event_loc_id  src,
uint32_t  seqnum,
event ev 
)
virtual

Reimplemented in sstmac::native::clock_cycle_event_map.

Referenced by nworker().

bool sstmac::event_manager::is_complete ( )
inline

Definition at line 61 of file event_manager.h.

References complete_, and init_factory_params().

Here is the call graph for this function:

virtual int sstmac::event_manager::lpid ( ) const
inlinevirtual

Definition at line 170 of file event_manager.h.

int sstmac::event_manager::me ( ) const
inline
Returns
The MPI rank of this event manager

Definition at line 129 of file event_manager.h.

References me_.

virtual void sstmac::event_manager::multithread_schedule ( int  srcthread,
int  dstthread,
uint32_t  seqnum,
event_queue_entry ev 
)
virtual
timestamp sstmac::event_manager::now ( ) const
inline

Definition at line 87 of file event_manager.h.

References cancel_all_messages(), finish_stats(), main, now_, register_stat(), register_thread_unique_stat(), runtime(), and topology_partition().

Referenced by sstmac::event_scheduler::now().

Here is the call graph for this function:

int sstmac::event_manager::nproc ( ) const
inline

Definition at line 142 of file event_manager.h.

References nproc_.

int sstmac::event_manager::nthread ( ) const
inline

Definition at line 180 of file event_manager.h.

References current_thread_id(), ev_man_for_thread(), nthread_, schedule_stop(), set_interconnect(), and thread_id().

Referenced by sstmac::event_scheduler::nthread().

Here is the call graph for this function:

int sstmac::event_manager::nworker ( ) const
inline

Definition at line 147 of file event_manager.h.

References ipc_schedule(), multithread_schedule(), nproc_, and nthread_.

Here is the call graph for this function:

void sstmac::event_manager::register_stat ( stat_collector stat,
bool  reduce_all = true,
bool  dump_all = false,
bool  dump_main = true 
)

Referenced by now().

stat_collector* sstmac::event_manager::register_thread_unique_stat ( stat_collector stat,
bool  reduce_all = true,
bool  dump_all = false,
bool  dump_main = true 
)

Referenced by now().

virtual void sstmac::event_manager::run ( )
pure virtual

Run the eventmanager.

The eventmanager shall return control when no more messages remain.

Implemented in sstmac::native::multithreaded_event_container, sstmac::native::event_container, sstmac::native::clock_cycle_event_map, and sstmac::native::multithreaded_subcontainer.

parallel_runtime* sstmac::event_manager::runtime ( ) const

Referenced by now().

virtual void sstmac::event_manager::schedule ( timestamp  start_time,
uint32_t  seqnum,
event_queue_entry event_queue_entry 
)
privatepure virtual
virtual void sstmac::event_manager::schedule_stop ( timestamp  until)
virtual

Reimplemented in sstmac::native::multithreaded_event_container.

Referenced by nthread().

virtual void sstmac::event_manager::set_interconnect ( hw::interconnect *  interconn)
virtual
void sstmac::event_manager::set_now ( const timestamp ts)
protected

Referenced by event_manager().

void sstmac::event_manager::stop ( )
inline

Definition at line 121 of file event_manager.h.

References stopped_.

int sstmac::event_manager::thread_id ( ) const
inline
virtual std::string sstmac::event_manager::to_string ( ) const
inlinevirtual

Definition at line 56 of file event_manager.h.

partition* sstmac::event_manager::topology_partition ( ) const

Referenced by now().

int sstmac::event_manager::worker_id ( ) const
inline
Returns
The unique worker id amongst all threads on all ranks

Definition at line 137 of file event_manager.h.

References me_, nthread_, and thread_id_.

Friends And Related Function Documentation

friend class event_scheduler
friend

Definition at line 50 of file event_manager.h.

friend class native::macro_manager
friend

Definition at line 52 of file event_manager.h.

friend class native::manager
friend

Definition at line 51 of file event_manager.h.

Member Data Documentation

bool sstmac::event_manager::complete_
protected

Definition at line 212 of file event_manager.h.

Referenced by is_complete().

bool sstmac::event_manager::finish_on_stop_
protected

Definition at line 214 of file event_manager.h.

event_manager* sstmac::event_manager::global
static

Definition at line 68 of file event_manager.h.

int sstmac::event_manager::me_
protected

Definition at line 218 of file event_manager.h.

Referenced by me(), and worker_id().

timestamp sstmac::event_manager::now_
private

Definition at line 238 of file event_manager.h.

Referenced by now().

int sstmac::event_manager::nproc_
protected

Definition at line 220 of file event_manager.h.

Referenced by nproc(), and nworker().

int sstmac::event_manager::nthread_
protected

Definition at line 222 of file event_manager.h.

Referenced by nthread(), nworker(), and worker_id().

std::vector<pthread_attr_t> sstmac::event_manager::pthread_attrs_
staticprotected

Definition at line 225 of file event_manager.h.

std::vector<pthread_t> sstmac::event_manager::pthreads_
staticprotected

Definition at line 224 of file event_manager.h.

parallel_runtime* sstmac::event_manager::rt_
protected

Definition at line 215 of file event_manager.h.

std::map<std::string, stats_entry> sstmac::event_manager::stats_
private

Definition at line 236 of file event_manager.h.

bool sstmac::event_manager::stopped_
protected

Definition at line 213 of file event_manager.h.

Referenced by stop().

int sstmac::event_manager::thread_id_
protected

Definition at line 216 of file event_manager.h.

Referenced by thread_id(), and worker_id().


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