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