SST  11.1.0
StructuralSimulationToolkit
coreTest_DistribComponent.h
1 // Copyright 2009-2021 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2021, NTESS
6 // All rights reserved.
7 //
8 // Portions are copyright of other developers:
9 // See the file CONTRIBUTORS.TXT in the top level directory
10 // the distribution for more information.
11 //
12 // This file is part of the SST software package. For license
13 // information, see the LICENSE file in the top level directory of the
14 // distribution.
15 
16 #ifndef SST_CORE_CORETEST_DISTRIBCOMPONENT_H
17 #define SST_CORE_CORETEST_DISTRIBCOMPONENT_H
18 
19 #include "sst/core/component.h"
20 #include "sst/core/rng/distrib.h"
21 
22 using namespace SST;
23 using namespace SST::RNG;
24 
25 namespace SST {
26 namespace CoreTestDistribComponent {
27 
29 {
30 public:
31  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
32  SST_ELI_REGISTER_COMPONENT(
34  "coreTestElement",
35  "coreTestDistribComponent",
36  SST_ELI_ELEMENT_VERSION(1,0,0),
37  "Random Number Distribution Component",
38  COMPONENT_CATEGORY_UNCATEGORIZED
39  )
40 
41  SST_ELI_DOCUMENT_PARAMS(
42  { "count", "Number of random values to generate from the distribution", "1000"},
43  { "distrib", "Random distribution to use - \"gaussian\" (or \"normal\"), or \"exponential\"", "gaussian"},
44  { "mean", "Mean value to use if we are sampling from the Gaussian/Normal distribution", "1.0"},
45  { "stddev", "Standard deviation to use for the distribution", "0.2"},
46  { "lambda", "Lambda value to use for the exponential distribution", "1.0"},
47  { "binresults", "Print the results, only if value is \"1\"", "1"},
48  { "probcount", "Number of probabilities in discrete distribution", "1"},
49  { "prob%(probcount)d", "Probability values for discrete distribution", "1"}
50  )
51 
52  // Optional since there is nothing to document
53  SST_ELI_DOCUMENT_STATISTICS(
54  )
55 
56  // Optional since there is nothing to document
57  SST_ELI_DOCUMENT_PORTS(
58  )
59 
60  // Optional since there is nothing to document
61  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
62  )
63 
64  coreTestDistribComponent(SST::ComponentId_t id, SST::Params& params);
65  void finish();
66  void setup() {}
67 
68 private:
69  coreTestDistribComponent(); // for serialization only
70  coreTestDistribComponent(const coreTestDistribComponent&); // do not implement
71  void operator=(const coreTestDistribComponent&); // do not implement
72 
73  virtual bool tick(SST::Cycle_t);
74 
75  SSTRandomDistribution* comp_distrib;
76 
77  int rng_max_count;
78  int rng_count;
79  bool bin_results;
80  std::string dist_type;
81 
82  std::map<int64_t, uint64_t>* bins;
83 };
84 
85 } // namespace CoreTestDistribComponent
86 } // namespace SST
87 
88 #endif // SST_CORE_CORETEST_DISTRIBCOMPONENT_H
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_DistribComponent.h:66
Main component object for the simulation.
Definition: component.h:30
Definition: coreTest_DistribComponent.h:28
Parameter store.
Definition: params.h:43
Base class of statistical distributions in SST.
Definition: distrib.h:22