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