SST/macro
sstmac.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009-2010 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_SSTMAC_H_INCLUDED
13 #define SSTMAC_SSTMAC_H_INCLUDED
14 
18 #include <string>
19 
20 #define PARSE_OPT_SUCCESS 0
21 #define PARSE_OPT_EXIT_SUCCESS 1
22 #define PARSE_OPT_EXIT_FAIL 2
23 
24 struct opts {
25  int help;
26  std::string debug;
27  std::string configfile;
28  sprockit::sim_parameters* params;
32  std::string cpu_affinity;
33 
34  opts() :
35  help(0),
36  debug(""),
37  params(0),
38  configfile(""),
39  low_res_timer(false),
40  print_walltime(true),
41  print_params(false),
42  cpu_affinity("") {
43  }
44 
45  ~opts();
46 };
47 
48 std::ostream&
49 operator<<(std::ostream &os, const opts &oo);
50 
51 struct sim_stats {
52  double wallTime;
53  double simulatedTime;
56  wallTime(0),
57  simulatedTime(0),
58  numResults(-1)
59  {}
60 };
61 
62 int
63 parse_opts(int argc, char **argv, opts &oo);
64 
65 void
66 print_help(int argc, char **argv);
67 
68 
69 void
70 resize_topology(int max_nproc, sprockit::sim_parameters* params, bool verbose = true);
71 
72 void
73 map_env_params(sprockit::sim_parameters* params);
74 
75 namespace sstmac {
76 
77 parallel_runtime* init();
78 
79 void finalize(parallel_runtime* rt);
80 
81 void init_opts(opts& oo, int argc, char** argv);
82 
83 void
84 init_params(parallel_runtime* rt, opts& oo, sprockit::sim_parameters* params, bool parallel);
85 
86 void
87 remap_deprecated_params(sprockit::sim_parameters* params);
88 
89 void
90 remap_params(sprockit::sim_parameters* params, bool verbose = true);
91 
92 void
93 run(opts& oo,
95  sprockit::sim_parameters* params,
96  sim_stats& stats);
97 
98 void
99 try_main(sprockit::sim_parameters* params,
100  int argc, char **argv,
101  bool params_only = false);
102 
103 void
104 run_params(parallel_runtime* rt,
105  sprockit::sim_parameters* params,
106  sim_stats& stats);
107 
108 void
109 init_first_run(parallel_runtime* rt,
110  sprockit::sim_parameters* params);
111 
112 }
113 
114 #endif
115 
void run_params(parallel_runtime *rt, sprockit::sim_parameters *params, sim_stats &stats)
void print_help(int argc, char **argv)
int numResults
Definition: sstmac.h:54
Definition: sstmac.h:24
bool print_params
Definition: sstmac.h:30
std::string configfile
Definition: sstmac.h:27
void remap_deprecated_params(sprockit::sim_parameters *params)
std::string debug
Definition: sstmac.h:26
std::string cpu_affinity
Definition: sstmac.h:32
void resize_topology(int max_nproc, sprockit::sim_parameters *params, bool verbose=true)
void map_env_params(sprockit::sim_parameters *params)
void init_opts(opts &oo, int argc, char **argv)
double wallTime
Definition: sstmac.h:52
parallel_runtime * init()
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
void finalize(parallel_runtime *rt)
sim_stats()
Definition: sstmac.h:55
double simulatedTime
Definition: sstmac.h:53
int help
Definition: sstmac.h:25
void init_first_run(parallel_runtime *rt, sprockit::sim_parameters *params)
void remap_params(sprockit::sim_parameters *params, bool verbose=true)
int parse_opts(int argc, char **argv, opts &oo)
std::ostream & operator<<(std::ostream &os, const opts &oo)
void run(opts &oo, sstmac::parallel_runtime *rt, sprockit::sim_parameters *params, sim_stats &stats)
void try_main(sprockit::sim_parameters *params, int argc, char **argv, bool params_only=false)
bool print_walltime
Definition: sstmac.h:29
sprockit::sim_parameters * params
Definition: sstmac.h:28
bool low_res_timer
Definition: sstmac.h:31
opts()
Definition: sstmac.h:34
void init_params(parallel_runtime *rt, opts &oo, sprockit::sim_parameters *params, bool parallel)