SST 16.0.0
Structural Simulation Toolkit
coreTest_DistribComponent.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_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
22using namespace SST;
23using namespace SST::RNG;
24
25namespace SST::CoreTestDistribComponent {
26
27class coreTestDistribComponent : public SST::Component
28{
29public:
30 // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
31 SST_ELI_REGISTER_COMPONENT(
32 coreTestDistribComponent,
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
67private:
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
Main component object for the simulation.
Definition component.h:32
Definition coreTest_DistribComponent.h:28
void setup() override
Called after all components have been constructed and initialization has completed,...
Definition coreTest_DistribComponent.h:65
void finish() override
Called after complete phase, but before objects are destroyed.
Definition coreTest_DistribComponent.cc:32
Parameter store.
Definition params.h:65