SST  10.1.0
StructuralSimulationToolkit
coreTest_Component.h
1 // Copyright 2009-2020 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-2020, 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 _CORETESTCOMPONENT_H
17 #define _CORETESTCOMPONENT_H
18 
19 #include <sst/core/component.h>
20 #include <sst/core/link.h>
21 #include <sst/core/rng/marsaglia.h>
22 
23 namespace SST {
24 namespace CoreTestComponent {
25 
27 {
28 public:
29 
30  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
31  SST_ELI_REGISTER_COMPONENT(
33  "coreTestElement",
34  "coreTestComponent",
35  SST_ELI_ELEMENT_VERSION(1,0,0),
36  "CoreTest Test Component",
37  COMPONENT_CATEGORY_PROCESSOR
38  )
39 
40  SST_ELI_DOCUMENT_PARAMS(
41  { "workPerCycle", "Count of busy work to do during a clock tick.", NULL},
42  { "commFreq", "Approximate frequency of sending an event during a clock tick.", NULL},
43  { "commSize", "Size of communication to send.", "16"}
44  )
45 
46  // Optional since there is nothing to document
47  SST_ELI_DOCUMENT_STATISTICS(
48  )
49 
50  SST_ELI_DOCUMENT_PORTS(
51  {"Nlink", "Link to the coreTestComponent to the North", { "coreTestComponent.coreTestComponentEvent", "" } },
52  {"Slink", "Link to the coreTestComponent to the South", { "coreTestComponent.coreTestComponentEvent", "" } },
53  {"Elink", "Link to the coreTestComponent to the East", { "coreTestComponent.coreTestComponentEvent", "" } },
54  {"Wlink", "Link to the coreTestComponent to the West", { "coreTestComponent.coreTestComponentEvent", "" } }
55  )
56 
57  // Optional since there is nothing to document
58  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
59  )
60 
61  coreTestComponent(SST::ComponentId_t id, SST::Params& params);
63 
64  void setup() { }
65  void finish() {
66  printf("Component Finished.\n");
67  }
68 
69 private:
70  coreTestComponent(); // for serialization only
71  coreTestComponent(const coreTestComponent&); // do not implement
72  void operator=(const coreTestComponent&); // do not implement
73 
74  void handleEvent(SST::Event *ev);
75  virtual bool clockTic(SST::Cycle_t);
76 
77  int workPerCycle;
78  int commFreq;
79  int commSize;
80  int neighbor;
81 
83  SST::Link* N;
84  SST::Link* S;
85  SST::Link* E;
86  SST::Link* W;
87 };
88 
89 } // namespace CoreTestComponent
90 } // namespace SST
91 
92 #endif /* _CORETESTCOMPONENT_H */
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_Component.h:64
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_Component.h:26
Implements a random number generator using the Marsaglia method.
Definition: marsaglia.h:39
Parameter store.
Definition: params.h:44
void finish()
Called after simulation completes, but before objects are destroyed.
Definition: coreTest_Component.h:65
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31