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