SST/macro
|
The app derived class adds to the thread base class by providing facilities to allow applications to simulate computation. More...
#include <app.h>
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 |
app * | parent_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_loops * | compute_loops_lib () |
virtual | ~app () |
Goodbye. More... | |
virtual void | consume_params (sprockit::sim_parameters *params)=0 |
virtual app * | clone_type () const =0 |
app * | clone (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) |
thread * | get_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_t * | get_mutex (int id) |
Fetch a mutex object corresponding to their ID. More... | |
condition_t * | get_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_system * | os () const |
app_launch * | env () 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 |
key * | schedule_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_model * | perf_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 thread * | current () |
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_system * | os_ |
Each thread can only run under one OS/scheduler. More... | |
std::queue< key * > | joiners_ |
app * | parent_app_ |
process_context | p_txt_ |
Private Attributes | |
lib_compute_inst * | compute_inst_ |
lib_compute_time * | compute_time_ |
lib_compute_memmove * | compute_mem_move_ |
lib_compute_loops * | compute_loops_ |
lib_sleep * | sleep_lib_ |
long | next_tls_key_ |
int | next_condition_ |
int | next_mutex_ |
std::map< long, thread * > | subthreads_ |
std::map< int, mutex_t > | mutexes_ |
std::map< int, condition_t > | conditions_ |
std::map< int, destructor_fxn > | tls_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 |
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
typedef int(* sstmac::sw::app::main_fxn) (int argc, char **argv) |
|
virtual |
Goodbye.
|
protected |
Referenced by sumi::parsedumpi::parsedumpi().
|
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.
thr |
int sstmac::sw::app::allocate_condition | ( | ) |
Allocate a unique ID for a condition variable.
int sstmac::sw::app::allocate_mutex | ( | ) |
Allocate a unique ID for a mutex variable.
int sstmac::sw::app::allocate_tls_key | ( | destructor_fxn | fnx | ) |
|
virtual |
Reimplemented from sstmac::sw::thread.
app* sstmac::sw::app::clone | ( | software_id | newid | ) |
|
pure virtual |
Implemented in sstmac::sw::user_app_cxx_empty_main, sstmac::sw::user_app_cxx_full_main, and sumi::parsedumpi.
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 | ( | ) |
|
pure virtual |
Implemented in sstmac::sw::user_app_cxx_empty_main, sstmac::sw::user_app_cxx_full_main, and sumi::parsedumpi.
|
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.
id |
mutex_t* sstmac::sw::app::get_mutex | ( | int | id | ) |
Fetch a mutex object corresponding to their ID.
id |
|
static |
thread* sstmac::sw::app::get_subthread | ( | long | id | ) |
get_subthread
id |
|
virtual |
|
protectedvirtual |
|
virtual |
Reimplemented from sstmac::sw::thread.
|
inline |
Definition at line 150 of file app.h.
Referenced by sumi::parsedumpi::clone_type().
|
inlinevirtual |
Reimplemented from sstmac::sw::thread.
Definition at line 87 of file app.h.
References sumi::compute(), sstmac::run(), and sumi::sleep().
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.
thr | A thread with initialized ID |
void sstmac::sw::app::remove_subthread | ( | long | thr_id | ) |
|
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
thr |
|
inline |
|
pure virtual |
Implemented in sstmac::sw::user_app_cxx_empty_main, sstmac::sw::user_app_cxx_full_main, and sumi::parsedumpi.
void sstmac::sw::app::sleep | ( | timestamp | time | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |