SST  14.0.0
StructuralSimulationToolkit
coreTest_Module.h
1 // Copyright 2009-2024 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-2024, 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_MODULE_H
13 #define SST_CORE_CORETEST_MODULE_H
14 
15 #include "sst/core/component.h"
16 #include "sst/core/link.h"
17 #include "sst/core/module.h"
18 #include "sst/core/rng/rng.h"
19 
20 #include <vector>
21 
22 using namespace SST;
23 using namespace SST::RNG;
24 
25 namespace SST {
26 namespace CoreTestModule {
27 
29 {
30 
31 public:
32  SST_ELI_REGISTER_MODULE_API(SST::CoreTestModule::CoreTestModuleExample) // API & module in one
33 
34  SST_ELI_REGISTER_MODULE(
35  CoreTestModuleExample, "coreTestElement", "CoreTestModule", SST_ELI_ELEMENT_VERSION(1, 0, 0),
36  "CoreTest module to demonstrate interface.", SST::CoreTestModule::CoreTestModuleExample)
37 
38  SST_ELI_DOCUMENT_PARAMS(
39  { "rng", "The random number generator to use (Marsaglia or Mersenne), default is Mersenne", "Mersenne"},
40  { "seed_w", "The seed to use for the random number generator", "7" },
41  { "seed_z", "The seed to use for the random number generator", "5" },
42  { "seed", "The seed to use for the random number generator.", "11" },
43  )
44 
47  std::string getRNGType() const;
48  uint32_t getNext();
49 
51  void serialize_order(SST::Core::Serialization::serializer& ser) override;
52  ImplementSerializable(SST::CoreTestModule::CoreTestModuleExample)
53 
54 private:
55  std::string rng_type;
56  Random* rng;
57 };
58 
59 
61 {
62 public:
63  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
64  SST_ELI_REGISTER_COMPONENT(
66  "coreTestElement",
67  "coreTestModuleLoader",
68  SST_ELI_ELEMENT_VERSION(1,0,0),
69  "Component that loads an RNG module",
70  COMPONENT_CATEGORY_UNCATEGORIZED
71  )
72 
73  SST_ELI_DOCUMENT_PARAMS(
74  { "seed_w", "The seed to use for the random number generator", "7" },
75  { "seed_z", "The seed to use for the random number generator", "5" },
76  { "seed", "The seed to use for the random number generator.", "11" },
77  { "rng", "The random number generator to use (Marsaglia or Mersenne), default is Mersenne", "Mersenne"},
78  { "count", "The number of random numbers to generate, default is 1000", "1000" },
79  { "verbose", "Sets the output verbosity of the component", "0" }
80  )
81 
82  // Optional since there is nothing to document
83  SST_ELI_DOCUMENT_STATISTICS(
84  )
85 
86  // Optional since there is nothing to document
87  SST_ELI_DOCUMENT_PORTS(
88  )
89 
90  // Optional since there is nothing to document
91  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
92  )
93 
94  coreTestModuleLoader(SST::ComponentId_t id, SST::Params& params);
96  void setup() override;
97  void finish() override;
98  void serialize_order(SST::Core::Serialization::serializer& ser) override;
99  ImplementSerializable(SST::CoreTestModule::coreTestModuleLoader)
100 
101 private:
102  coreTestModuleLoader(); // for serialization only
103 
104  virtual bool tick(SST::Cycle_t);
105 
106  Output* output;
107  int rng_max_count;
108  int rng_count;
109  CoreTestModuleExample* rng_module;
110 };
111 
112 } // namespace CoreTestModule
113 } // namespace SST
114 
115 #endif // SST_CORE_CORETEST_MODULE_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:53
Implements the base class for random number generators for the SST core.
Definition: rng.h:29
Definition: constant.h:21
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Main component object for the simulation.
Definition: component.h:30
Definition: coreTest_Module.h:28
Definition: action.cc:18
Module is a tag class used with the loadModule function.
Definition: module.h:22
Parameter store.
Definition: params.h:55
Definition: coreTest_Module.h:60