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