SST 12.1.0
Structural Simulation Toolkit
coreTest_StatisticsComponent.h
1// Copyright 2009-2022 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-2022, 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_STATISTICSCOMPONENT_H
17#define SST_CORE_CORETEST_STATISTICSCOMPONENT_H
18
19#include "sst/core/component.h"
20#include "sst/core/rng/rng.h"
21
22using namespace SST;
23using namespace SST::RNG;
24using namespace SST::Statistics;
25
26namespace SST {
27namespace CoreTestStatisticsComponent {
28
30{
31public:
32 // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
33 SST_ELI_REGISTER_COMPONENT(
35 "coreTestElement",
36 "StatisticsComponent.int",
37 SST_ELI_ELEMENT_VERSION(1,0,0),
38 "Statistics test component with ints",
39 COMPONENT_CATEGORY_UNCATEGORIZED
40 )
41
42 SST_ELI_DOCUMENT_PARAMS(
43 { "seed_w", "The seed to use for the random number generator", "7" },
44 { "seed_z", "The seed to use for the random number generator", "5" },
45 { "seed", "The seed to use for the random number generator.", "11" },
46 { "rng", "The random number generator to use (Marsaglia or Mersenne), default is Mersenne", "Mersenne"},
47 { "count", "The number of random numbers to generate, default is 1000", "1000" }
48 )
49
50 SST_ELI_DOCUMENT_STATISTICS(
51 { "stat1_U32", "Test Statistic 1 - Collecting U32 Data", "units", 1},
52 { "stat2_U64", "Test Statistic 2 - Collecting U64 Data", "units", 2},
53 { "stat3_I32", "Test Statistic 3 - Collecting I32 Data", "units", 3},
54 { "stat4_I64", "Test Statistic 4 - Collecting I64 Data", "units", 4},
55 { "stat5_U32", "Test Statistic 5 - Collecting U32 Data", "units", 5},
56 { "stat6_U64", "Test Statistic 6 - Collecting U64 Data", "units", 6}
57 )
58
59 // Optional since there is nothing to document
60 SST_ELI_DOCUMENT_PORTS(
61 )
62
63 // Optional since there is nothing to document
64 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
65 )
66
67 StatisticsComponentInt(ComponentId_t id, Params& params);
68 void setup() {}
69 void finish() {}
70
71private:
73 StatisticsComponentInt(const StatisticsComponentInt&); // do not implement
74 void operator=(const StatisticsComponentInt&); // do not implement
75
76 virtual bool Clock1Tick(SST::Cycle_t);
77
78 Random* rng;
79 std::string rng_type;
80 int rng_max_count;
81 int rng_count;
82 Output& output;
83
84 // Statistics
85 Statistic<uint32_t>* stat1_U32;
86 Statistic<uint64_t>* stat2_U64;
87 Statistic<int32_t>* stat3_I32;
88 Statistic<int64_t>* stat4_I64;
89};
90
92{
93public:
94 // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
95 SST_ELI_REGISTER_COMPONENT(
97 "coreTestElement",
98 "StatisticsComponent.float",
99 SST_ELI_ELEMENT_VERSION(1,0,0),
100 "Statistics test component with floats",
101 COMPONENT_CATEGORY_UNCATEGORIZED
102 )
103
104 SST_ELI_DOCUMENT_PARAMS(
105 { "seed_w", "The seed to use for the random number generator", "7" },
106 { "seed_z", "The seed to use for the random number generator", "5" },
107 { "seed", "The seed to use for the random number generator.", "11" },
108 { "rng", "The random number generator to use (Marsaglia or Mersenne), default is Mersenne", "Mersenne"},
109 { "count", "The number of random numbers to generate, default is 1000", "1000" }
110 )
111
112 SST_ELI_DOCUMENT_STATISTICS(
113 { "stat1_F32", "Test Statistic 1 - Collecting F32 Data", "units", 1},
114 { "stat2_F64", "Test Statistic 2 - Collecting F64 Data", "units", 2},
115 { "stat3_F64", "Test Statistic 2 - Collecting F64 Data", "units", 9},
116 )
117
118 // Optional since there is nothing to document
119 SST_ELI_DOCUMENT_PORTS(
120 )
121
122 // Optional since there is nothing to document
123 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
124 )
125
126 StatisticsComponentFloat(ComponentId_t id, Params& params);
127 void setup() {}
128 void finish() {}
129
130private:
132 StatisticsComponentFloat(const StatisticsComponentFloat&); // do not implement
133 void operator=(const StatisticsComponentFloat&); // do not implement
134
135 virtual bool Clock1Tick(SST::Cycle_t);
136
137 Random* rng;
138 std::string rng_type;
139 int rng_max_count;
140 int rng_count;
141 Output& output;
142
143 // Statistics
144 Statistic<float>* stat1_F32;
145 Statistic<double>* stat2_F64;
146 Statistic<double>* stat3_F64; // For testing stat sharing
147};
148
149} // namespace CoreTestStatisticsComponent
150} // namespace SST
151
152#endif // SST_CORE_CORETEST_STATISTICSCOMPONENT_H
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_StatisticsComponent.h:92
void setup()
Called after all components have been constructed and initialization has completed,...
Definition: coreTest_StatisticsComponent.h:127
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_StatisticsComponent.h:128
Definition: coreTest_StatisticsComponent.h:30
void setup()
Called after all components have been constructed and initialization has completed,...
Definition: coreTest_StatisticsComponent.h:68
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_StatisticsComponent.h:69
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition: output.h:52
Parameter store.
Definition: params.h:56
Implements the base class for random number generators for the SST core.
Definition: rng.h:28
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:361