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

The app derived class adds to the thread base class by providing facilities to allow applications to simulate computation. More...

#include <app.h>

Inheritance diagram for sstmac::sw::app:
Inheritance graph
Collaboration diagram for sstmac::sw::app:
Collaboration graph

Public Types

typedef void(* destructor_fxn) (void *)
 
typedef int(* main_fxn) (int argc, char **argv)
 
typedef int(* empty_main_fxn) ()
 
- Public Types inherited from sstmac::sw::thread
enum  state {
  PENDING =0, INITIALIZED =1, ACTIVE =2, SUSPENDED =3,
  BLOCKED =4, CANCELED =5, DONE =6
}
 Help resolve deadlock situations. More...
 
typedef spkt_unordered_map< long, thread * > pthread_map_t
 

Public Member Functions

int allocate_tls_key (destructor_fxn fnx)
 
software_id sid () const
 
int appnum () const
 
int tasknum () const
 
appparent_app () const
 
void sleep (timestamp time)
 
void compute (timestamp time)
 
void compute_inst (compute_event *cmsg)
 
void compute_loop (uint64_t, int nflops_per_loop, int nintops_per_loop, int bytes_per_loop)
 
void compute_detailed (long flops, long intops, long bytes)
 
void compute_block_read (long bytes)
 
void compute_block_write (long bytes)
 
void compute_block_memcpy (long bytes)
 
lib_compute_loopscompute_loops_lib ()
 
virtual ~app ()
 Goodbye. More...
 
virtual void consume_params (sprockit::sim_parameters *params)=0
 
virtual appclone_type () const =0
 
appclone (software_id newid)
 
virtual void kill ()
 
virtual void skeleton_main ()=0
 
virtual void run ()
 Derived types need to override this method. More...
 
virtual void init_factory_params (sprockit::sim_parameters *params)
 
sprockit::sim_parameters * params () const
 
void add_subthread (thread *thr)
 Let a parent application know about the existence of a subthread If thread does not have an initialized ID, a unique ID is allocated for the thread Can be called from a constructor. More...
 
void set_subthread_done (thread *thr)
 Indicate to parent application that subthread is done running. More...
 
void remove_subthread (thread *thr)
 Let a parent application know a subthread has finished. More...
 
void remove_subthread (long thr_id)
 
threadget_subthread (long id)
 get_subthread More...
 
int allocate_mutex ()
 Allocate a unique ID for a mutex variable. More...
 
int allocate_condition ()
 Allocate a unique ID for a condition variable. More...
 
mutex_tget_mutex (int id)
 Fetch a mutex object corresponding to their ID. More...
 
condition_tget_condition (int id)
 Fetch a condition object corresponding to the ID. More...
 
bool erase_condition (int id)
 
bool erase_mutex (int id)
 
virtual void clear_subthread_from_parent_app ()
 
- Public Member Functions inherited from sstmac::sw::thread
virtual std::string to_string () const
 
void set_api (thread *thr)
 
template<class T >
T * get_api ()
 
virtual ~thread ()
 
state get_state () const
 Get current thread state. More...
 
virtual void init_perf_model_params (sprockit::sim_parameters *params)
 
app_id aid () const
 
task_id tid () const
 
void set_sid (software_id sid)
 
void spawn (thread *thr)
 
long init_id ()
 
long thread_id () const
 
void cancel ()
 This thread is not currently active - blocked on something However, some kill event happened and I never want to see this thread again. More...
 
bool is_canceled () const
 
operating_systemos () const
 
app_launchenv () const
 
void * stack () const
 
size_t stacksize () const
 
void ** backtrace () const
 
int last_backtrace_nfxn () const
 
int backtrace_nfxn () const
 
void append_backtrace (void *fxn)
 
void pop_backtrace ()
 
void set_backtrace (void **bt)
 
void collect_backtrace (int nfxn)
 
void init_thread (int phyiscal_thread_id, threading_interface *tocopy, void *stack, int stacksize, operating_system *os, threading_interface *yield_to)
 
void start_thread (thread *thr)
 A convenience request to start a new thread. More...
 
void join ()
 
process_context get_process_context () const
 
keyschedule_key ()
 key used More...
 
bool is_initialized () const
 Test whether the current task has been initialized (activated) by a scheduler. More...
 
void register_lib (library *lib)
 
void set_affinity (int core)
 
void add_affinity (int core)
 
void zero_affinity ()
 
template<class T >
T & register_perf_ctr_variable (void *ptr)
 
void remove_perf_ctr_variable (void *ptr)
 
perf_counter_modelperf_ctr_model () const
 
void set_cpumask (uint64_t cpumask)
 
uint64_t cpumask () const
 
int active_core () const
 
void set_active_core (int core)
 
void set_pthread_map (pthread_map_t *threadmap)
 
void * get_tls_value (long thekey) const
 
void set_tls_value (long thekey, void *ptr)
 
timestamp now ()
 
- 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 sprockit::sim_parameters * get_params ()
 
static void delete_statics ()
 
- Static Public Member Functions inherited from sstmac::sw::thread
static threadcurrent ()
 

Protected Member Functions

 app ()
 
api_get_api (const char *name)
 
virtual void init_mem_lib ()
 
- Protected Member Functions inherited from sstmac::sw::thread
 thread ()
 
void unregister_all_libs ()
 

Protected Attributes

sprockit::sim_parameters * params_
 
software_id id_
 
- Protected Attributes inherited from sstmac::sw::thread
spkt_unordered_map< std::string, api * > apis_
 
state state_
 Monitor state for deadlock detection. More...
 
operating_systemos_
 Each thread can only run under one OS/scheduler. More...
 
std::queue< key * > joiners_
 
appparent_app_
 
process_context p_txt_
 

Private Attributes

lib_compute_instcompute_inst_
 
lib_compute_timecompute_time_
 
lib_compute_memmovecompute_mem_move_
 
lib_compute_loopscompute_loops_
 
lib_sleepsleep_lib_
 
long next_tls_key_
 
int next_condition_
 
int next_mutex_
 
std::map< long, thread * > subthreads_
 
std::map< int, mutex_tmutexes_
 
std::map< int, condition_tconditions_
 
std::map< int, destructor_fxntls_key_fxns_
 

Friends

class thread
 

Additional Inherited Members

- Static Public Attributes inherited from sstmac::sw::thread
static const int no_core_affinity = -1
 
static const int no_socket_affinity = -1
 
static const int main_thread = -1
 
static const int nic_thread = -2
 
static const int rdma_thread = -3
 
static const app_id main_thread_aid
 
static const task_id main_thread_tid
 

Detailed Description

The app derived class adds to the thread base class by providing facilities to allow applications to simulate computation.

Messaging models are supported through an api class, which are stored by the app

Definition at line 55 of file app.h.

Member Typedef Documentation

typedef void(* sstmac::sw::app::destructor_fxn) (void *)

Definition at line 60 of file app.h.

typedef int(* sstmac::sw::app::empty_main_fxn) ()

Definition at line 63 of file app.h.

typedef int(* sstmac::sw::app::main_fxn) (int argc, char **argv)

Definition at line 62 of file app.h.

Constructor & Destructor Documentation

virtual sstmac::sw::app::~app ( )
virtual

Goodbye.

sstmac::sw::app::app ( )
protected

Member Function Documentation

api* sstmac::sw::app::_get_api ( const char *  name)
protectedvirtual

Reimplemented from sstmac::sw::thread.

void sstmac::sw::app::add_subthread ( thread thr)

Let a parent application know about the existence of a subthread If thread does not have an initialized ID, a unique ID is allocated for the thread Can be called from a constructor.

This method does NOT throw.

Parameters
thr
int sstmac::sw::app::allocate_condition ( )

Allocate a unique ID for a condition variable.

Returns
The unique ID
int sstmac::sw::app::allocate_mutex ( )

Allocate a unique ID for a mutex variable.

Returns
The unique ID
int sstmac::sw::app::allocate_tls_key ( destructor_fxn  fnx)
int sstmac::sw::app::appnum ( ) const
inline

Definition at line 77 of file app.h.

virtual void sstmac::sw::app::clear_subthread_from_parent_app ( )
virtual

Reimplemented from sstmac::sw::thread.

app* sstmac::sw::app::clone ( software_id  newid)
virtual app* sstmac::sw::app::clone_type ( ) const
pure virtual
void sstmac::sw::app::compute ( timestamp  time)
void sstmac::sw::app::compute_block_memcpy ( long  bytes)
void sstmac::sw::app::compute_block_read ( long  bytes)
void sstmac::sw::app::compute_block_write ( long  bytes)
void sstmac::sw::app::compute_detailed ( long  flops,
long  intops,
long  bytes 
)
void sstmac::sw::app::compute_inst ( compute_event cmsg)
void sstmac::sw::app::compute_loop ( uint64_t  ,
int  nflops_per_loop,
int  nintops_per_loop,
int  bytes_per_loop 
)
lib_compute_loops* sstmac::sw::app::compute_loops_lib ( )
virtual void sstmac::sw::app::consume_params ( sprockit::sim_parameters *  params)
pure virtual
static void sstmac::sw::app::delete_statics ( )
static
bool sstmac::sw::app::erase_condition ( int  id)
bool sstmac::sw::app::erase_mutex ( int  id)
condition_t* sstmac::sw::app::get_condition ( int  id)

Fetch a condition object corresponding to the ID.

Parameters
id
Returns
The condition object corresponding to the ID. Return NULL if not condition is found.
mutex_t* sstmac::sw::app::get_mutex ( int  id)

Fetch a mutex object corresponding to their ID.

Parameters
id
Returns
The mutex object corresponding to the ID. Return NULL if no mutex is found.
static sprockit::sim_parameters* sstmac::sw::app::get_params ( )
static
thread* sstmac::sw::app::get_subthread ( long  id)

get_subthread

Parameters
id
Returns
virtual void sstmac::sw::app::init_factory_params ( sprockit::sim_parameters *  params)
virtual
virtual void sstmac::sw::app::init_mem_lib ( )
protectedvirtual
virtual void sstmac::sw::app::kill ( )
virtual

Reimplemented from sstmac::sw::thread.

sprockit::sim_parameters* sstmac::sw::app::params ( ) const
inline

Definition at line 150 of file app.h.

Referenced by sumi::parsedumpi::clone_type().

app* sstmac::sw::app::parent_app ( ) const
inlinevirtual

Reimplemented from sstmac::sw::thread.

Definition at line 87 of file app.h.

References sumi::compute(), sstmac::run(), and sumi::sleep().

Here is the call graph for this function:

void sstmac::sw::app::remove_subthread ( thread thr)

Let a parent application know a subthread has finished.

This completely erases the thread. There will be no record of this thread after calling this function.

Parameters
thrA thread with initialized ID
void sstmac::sw::app::remove_subthread ( long  thr_id)
virtual void sstmac::sw::app::run ( )
virtual

Derived types need to override this method.

Implements sstmac::sw::thread.

void sstmac::sw::app::set_subthread_done ( thread thr)

Indicate to parent application that subthread is done running.

This puts a null marker for the thread rather than deleting it completely

Parameters
thr
software_id sstmac::sw::app::sid ( ) const
inline

Definition at line 72 of file app.h.

virtual void sstmac::sw::app::skeleton_main ( )
pure virtual
void sstmac::sw::app::sleep ( timestamp  time)
int sstmac::sw::app::tasknum ( ) const
inline

Definition at line 82 of file app.h.

Friends And Related Function Documentation

friend class thread
friend

Definition at line 219 of file app.h.

Member Data Documentation

lib_compute_inst* sstmac::sw::app::compute_inst_
private

Definition at line 232 of file app.h.

lib_compute_loops* sstmac::sw::app::compute_loops_
private

Definition at line 235 of file app.h.

lib_compute_memmove* sstmac::sw::app::compute_mem_move_
private

Definition at line 234 of file app.h.

lib_compute_time* sstmac::sw::app::compute_time_
private

Definition at line 233 of file app.h.

std::map<int, condition_t> sstmac::sw::app::conditions_
private

Definition at line 246 of file app.h.

software_id sstmac::sw::app::id_
protected

Definition at line 229 of file app.h.

std::map<int, mutex_t> sstmac::sw::app::mutexes_
private

Definition at line 244 of file app.h.

int sstmac::sw::app::next_condition_
private

Definition at line 239 of file app.h.

int sstmac::sw::app::next_mutex_
private

Definition at line 240 of file app.h.

long sstmac::sw::app::next_tls_key_
private

Definition at line 237 of file app.h.

sprockit::sim_parameters* sstmac::sw::app::params_
protected

Definition at line 228 of file app.h.

lib_sleep* sstmac::sw::app::sleep_lib_
private

Definition at line 236 of file app.h.

std::map<long, thread*> sstmac::sw::app::subthreads_
private

Definition at line 242 of file app.h.

std::map<int, destructor_fxn> sstmac::sw::app::tls_key_fxns_
private

Definition at line 248 of file app.h.


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