Skip to content

Commit 42b92ad

Browse files
Merge pull request #1205 from sstsimulator/devel
Automatically Merged using SST Master Branch Merger
2 parents 3814a60 + 1d2562c commit 42b92ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2465
-80
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ WhitespaceSensitiveMacros:
196196
- SST_ELI_REGISTER_SUBCOMPONENT_DERIVED
197197
- SST_ELI_REGISTER_SUBCOMPONENT_DERIVED_API
198198
- SST_ELI_REGISTER_REALTIME_ACTION
199+
- SST_ELI_REGISTER_PORTMODULE
199200
- STRINGIZE
200201
- PP_STRINGIZE
201202
- BOOST_PP_STRINGIZE

src/sst/core/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ nobase_dist_sst_HEADERS = \
5555
output.h \
5656
params.h \
5757
pollingLinkQueue.h \
58+
portModule.h \
5859
profile.h \
5960
profile/profiletool.h \
6061
profile/clockHandlerProfileTool.h \
@@ -203,6 +204,7 @@ sst_core_sources = \
203204
output.cc \
204205
params.cc \
205206
pollingLinkQueue.cc \
207+
portModule.cc \
206208
profile/profiletool.cc \
207209
profile/clockHandlerProfileTool.cc \
208210
profile/eventHandlerProfileTool.cc \

src/sst/core/activity.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ class Activity : public SST::Core::MemPoolItem
180180
virtual void printTrackingInfo(const std::string& UNUSED(header), Output& UNUSED(out)) const {}
181181
#endif
182182

183+
/** Set a new Queue order */
184+
void setQueueOrder(uint64_t order) { queue_order = order; }
185+
186+
virtual void copyAllDeliveryInfo(const Activity* act)
187+
{
188+
delivery_time = act->delivery_time;
189+
priority_order = act->priority_order;
190+
queue_order = act->queue_order;
191+
}
192+
183193
protected:
184194
/** Set the priority of the Activity */
185195
void setPriority(uint64_t priority) { priority_order = (priority_order & 0x00000000FFFFFFFFul) | (priority << 32); }
@@ -197,6 +207,7 @@ class Activity : public SST::Core::MemPoolItem
197207
return buf.str();
198208
}
199209

210+
200211
// Function used by derived classes to serialize data members.
201212
// This class is not serializable, because not all class that
202213
// inherit from it need to be serializable.
@@ -206,24 +217,20 @@ class Activity : public SST::Core::MemPoolItem
206217
ser& priority_order;
207218
ser& queue_order;
208219
}
209-
ImplementVirtualSerializable(SST::Activity)
210220

211-
212-
/** Set a new Queue order */
213-
void setQueueOrder(uint64_t order)
214-
{
215-
queue_order = order;
216-
}
221+
ImplementVirtualSerializable(SST::Activity);
217222

218223
private:
219224
// Data members
220225
SimTime_t delivery_time;
226+
221227
// This will hold both the priority (high bits) and the link order
222228
// (low_bits)
223-
uint64_t priority_order;
229+
uint64_t priority_order;
230+
224231
// Used for TimeVortex implementations that don't naturally keep
225232
// the insertion order
226-
uint64_t queue_order;
233+
uint64_t queue_order;
227234
};
228235

229236
} // namespace SST

src/sst/core/baseComponent.cc

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "sst/core/factory.h"
1919
#include "sst/core/link.h"
2020
#include "sst/core/linkMap.h"
21+
#include "sst/core/portModule.h"
2122
#include "sst/core/profile/clockHandlerProfileTool.h"
2223
#include "sst/core/profile/eventHandlerProfileTool.h"
2324
#include "sst/core/serialization/serialize.h"
@@ -88,6 +89,11 @@ BaseComponent::~BaseComponent()
8889
"Warning: BaseComponent destructor failed to remove ComponentInfo from parent.\n");
8990
}
9091
}
92+
93+
// Delete any portModules
94+
for ( auto port : portModules ) {
95+
delete port;
96+
}
9197
}
9298

9399
void
@@ -221,7 +227,7 @@ BaseComponent::isPortConnected(const std::string& name) const
221227
// child and remove it from my linkmap. The child will insert it into
222228
// their link map.
223229
Link*
224-
BaseComponent::getLinkFromParentSharedPort(const std::string& port)
230+
BaseComponent::getLinkFromParentSharedPort(const std::string& port, std::vector<ConfigPortModule>& port_modules)
225231
{
226232
LinkMap* myLinks = my_info->getLinkMap();
227233

@@ -237,6 +243,16 @@ BaseComponent::getLinkFromParentSharedPort(const std::string& port)
237243
// it from my link map and return it to the child.
238244
if ( !tmp->isConfigured() ) {
239245
myLinks->removeLink(port);
246+
// Need to see if there are any associated PortModules
247+
if ( my_info->portModules != nullptr ) {
248+
auto it = my_info->portModules->find(port);
249+
if ( it != my_info->portModules->end() ) {
250+
// Found PortModules, swap them into
251+
// port_modules and remove from my map
252+
port_modules.swap(it->second);
253+
my_info->portModules->erase(it);
254+
}
255+
}
240256
return tmp;
241257
}
242258
}
@@ -246,7 +262,9 @@ BaseComponent::getLinkFromParentSharedPort(const std::string& port)
246262
// parent shared with me and if so, call
247263
// getLinkFromParentSharedPort on them
248264

249-
if ( my_info->sharesPorts() ) { return my_info->parent_info->component->getLinkFromParentSharedPort(port); }
265+
if ( my_info->sharesPorts() ) {
266+
return my_info->parent_info->component->getLinkFromParentSharedPort(port, port_modules);
267+
}
250268
else {
251269
return nullptr;
252270
}
@@ -266,7 +284,8 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
266284
// with parents if sharing is turned on
267285
if ( nullptr == tmp ) {
268286
if ( my_info->sharesPorts() ) {
269-
tmp = my_info->parent_info->component->getLinkFromParentSharedPort(name);
287+
std::vector<ConfigPortModule> port_modules;
288+
tmp = my_info->parent_info->component->getLinkFromParentSharedPort(name, port_modules);
270289
// If I got a link from my parent, I need to put it in my
271290
// link map
272291
if ( nullptr != tmp ) {
@@ -277,6 +296,15 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
277296
myLinks->insertLink(name, tmp);
278297
// Need to set the link's defaultTimeBase to nullptr
279298
tmp->setDefaultTimeBase(nullptr);
299+
300+
// Need to see if I got any port_modules, if so, need
301+
// to add them to my_info->portModules
302+
if ( port_modules.size() > 0 ) {
303+
if ( nullptr == my_info->portModules ) {
304+
my_info->portModules = new std::map<std::string, std::vector<ConfigPortModule>>();
305+
}
306+
(*my_info->portModules)[name].swap(port_modules);
307+
}
280308
}
281309
}
282310
}
@@ -301,6 +329,29 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
301329
if ( tool->profileSends() ) tmp->attachTool(tool, mdata);
302330
}
303331
}
332+
333+
// Check for PortModules
334+
if ( my_info->portModules != nullptr ) {
335+
auto it = my_info->portModules->find(name);
336+
if ( it != my_info->portModules->end() ) {
337+
EventHandlerMetaData mdata(my_info->getID(), getName(), getType(), name);
338+
for ( auto& portModule : it->second ) {
339+
auto* pm = Factory::getFactory()->CreateWithParams<PortModule>(
340+
portModule.type, portModule.params, portModule.params);
341+
pm->setComponent(this);
342+
if ( pm->installOnSend() ) tmp->attachTool(pm, mdata);
343+
if ( pm->installOnReceive() ) {
344+
if ( handler )
345+
handler->attachInterceptTool(pm, mdata);
346+
else
347+
fatal(
348+
CALL_INFO_LONG, 1, "ERROR: Trying to install a receive PortModule on a Polling Link\n");
349+
}
350+
portModules.push_back(pm);
351+
}
352+
}
353+
}
354+
304355
if ( nullptr != time_base )
305356
tmp->setDefaultTimeBase(time_base);
306357
else

src/sst/core/baseComponent.h

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "sst/core/event.h"
1919
#include "sst/core/factory.h"
2020
#include "sst/core/oneshot.h"
21+
#include "sst/core/portModule.h"
2122
#include "sst/core/profile/componentProfileTool.h"
2223
#include "sst/core/serialization/serializable_base.h"
2324
#include "sst/core/serialization/serialize.h"
@@ -145,15 +146,27 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
145146
/** Return the base simulation Output class instance */
146147
Output& getSimulationOutput() const;
147148

148-
/** return the time since the simulation began in units specified by
149-
the parameter.
150-
@param tc TimeConverter specifying the units */
151-
SimTime_t getCurrentSimTime(TimeConverter* tc) const;
152-
/** return the time since the simulation began in the default timebase */
149+
/**
150+
Return the simulated time since the simulation began in units specified by
151+
the parameter.
152+
153+
@param tc TimeConverter specifying the units
154+
*/
155+
SimTime_t getCurrentSimTime(TimeConverter* tc) const;
156+
157+
/**
158+
Return the simulated time since the simulation began in the
159+
default timebase
160+
*/
153161
inline SimTime_t getCurrentSimTime() const { return getCurrentSimTime(my_info->defaultTimeBase); }
154-
/** return the time since the simulation began in timebase specified
155-
@param base Timebase frequency in SI Units */
156-
SimTime_t getCurrentSimTime(const std::string& base) const;
162+
163+
/**
164+
Return the simulated time since the simulation began in
165+
timebase specified
166+
167+
@param base Timebase frequency in SI Units
168+
*/
169+
SimTime_t getCurrentSimTime(const std::string& base) const;
157170

158171
/** Utility function to return the time since the simulation began in nanoseconds */
159172
SimTime_t getCurrentSimTimeNano() const;
@@ -901,10 +914,11 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
901914
std::vector<Clock::HandlerBase*> clock_handlers;
902915

903916
void addSelfLink(const std::string& name);
904-
Link* getLinkFromParentSharedPort(const std::string& port);
917+
Link* getLinkFromParentSharedPort(const std::string& port, std::vector<ConfigPortModule>& port_modules);
905918

906919
using StatNameMap = std::map<std::string, std::map<std::string, Statistics::StatisticBase*>>;
907920

921+
std::vector<PortModule*> portModules;
908922
std::map<StatisticId_t, Statistics::StatisticBase*> m_explicitlyEnabledSharedStats;
909923
std::map<StatisticId_t, StatNameMap> m_explicitlyEnabledUniqueStats;
910924
StatNameMap m_enabledAllStats;

src/sst/core/componentInfo.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ComponentInfo::ComponentInfo(ComponentId_t id, const std::string& name) :
2929
component(nullptr),
3030
params(nullptr),
3131
defaultTimeBase(nullptr),
32+
portModules(nullptr),
3233
statConfigs(nullptr),
3334
enabledStatNames(nullptr),
3435
enabledAllStats(false),
@@ -49,6 +50,7 @@ ComponentInfo::ComponentInfo() :
4950
component(nullptr),
5051
params(nullptr),
5152
defaultTimeBase(nullptr),
53+
portModules(nullptr),
5254
statConfigs(nullptr),
5355
enabledStatNames(nullptr),
5456
enabledAllStats(false),
@@ -89,6 +91,7 @@ ComponentInfo::ComponentInfo(
8991
component(nullptr),
9092
params(/*new Params()*/ nullptr),
9193
defaultTimeBase(nullptr),
94+
portModules(nullptr),
9295
statConfigs(nullptr),
9396
enabledStatNames(nullptr),
9497
enabledAllStats(false),
@@ -113,6 +116,7 @@ ComponentInfo::ComponentInfo(
113116
component(nullptr),
114117
params(&ccomp->params),
115118
defaultTimeBase(nullptr),
119+
portModules(&ccomp->portModules),
116120
statConfigs(&ccomp->statistics),
117121
enabledStatNames(&ccomp->enabledStatNames),
118122
enabledAllStats(ccomp->enabledAllStats),
@@ -157,6 +161,7 @@ ComponentInfo::ComponentInfo(ComponentInfo&& o) :
157161
subComponents(std::move(o.subComponents)),
158162
params(o.params),
159163
defaultTimeBase(o.defaultTimeBase),
164+
portModules(o.portModules),
160165
statConfigs(o.statConfigs),
161166
allStatConfig(o.allStatConfig),
162167
statLoadLevel(o.statLoadLevel),

src/sst/core/componentInfo.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class BaseComponent;
2727
class ComponentInfoMap;
2828
class LinkMap;
2929

30+
class ConfigPortModule;
3031
class ConfigComponent;
3132
class ConfigStatistic;
3233

@@ -116,10 +117,11 @@ class ComponentInfo
116117

117118
TimeConverter* defaultTimeBase;
118119

119-
std::map<StatisticId_t, ConfigStatistic>* statConfigs;
120-
std::map<std::string, StatisticId_t>* enabledStatNames;
121-
bool enabledAllStats;
122-
const ConfigStatistic* allStatConfig;
120+
std::map<std::string, std::vector<ConfigPortModule>>* portModules;
121+
std::map<StatisticId_t, ConfigStatistic>* statConfigs;
122+
std::map<std::string, StatisticId_t>* enabledStatNames;
123+
bool enabledAllStats;
124+
const ConfigStatistic* allStatConfig;
123125

124126
uint8_t statLoadLevel;
125127

src/sst/core/configGraph.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,12 @@ ConfigComponent::findStatistic(StatisticId_t sid) const
595595
}
596596
}
597597

598+
void
599+
ConfigComponent::addPortModule(const std::string& port, const std::string& type, const Params& params)
600+
{
601+
portModules[port].emplace_back(type, params);
602+
}
603+
598604
std::vector<LinkId_t>
599605
ConfigComponent::allLinks() const
600606
{

src/sst/core/configGraph.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,27 @@ class ConfigStatOutput : public SST::Core::Serialization::serializable
213213

214214
typedef SparseVectorMap<LinkId_t, ConfigLink*> ConfigLinkMap_t;
215215

216+
/**
217+
Class that represents a PortModule in ConfigGraph
218+
*/
219+
class ConfigPortModule : public SST::Core::Serialization::serializable
220+
{
221+
public:
222+
std::string type;
223+
Params params;
224+
225+
ConfigPortModule() = default;
226+
ConfigPortModule(const std::string& type, const Params& params) : type(type), params(params) {}
227+
228+
void serialize_order(SST::Core::Serialization::serializer& ser) override
229+
{
230+
ser& type;
231+
ser& params;
232+
}
233+
ImplementSerializable(SST::ConfigPortModule)
234+
};
235+
236+
216237
/** Represents the configuration of a generic component */
217238
class ConfigComponent : public SST::Core::Serialization::serializable
218239
{
@@ -231,9 +252,10 @@ class ConfigComponent : public SST::Core::Serialization::serializable
231252
uint8_t statLoadLevel; /*!< Statistic load level for this component */
232253
// std::vector<ConfigStatistic> enabledStatistics; /*!< List of subcomponents */
233254

234-
std::map<std::string, StatisticId_t> enabledStatNames;
235-
bool enabledAllStats;
236-
ConfigStatistic allStatConfig;
255+
std::map<std::string, std::vector<ConfigPortModule>> portModules;
256+
std::map<std::string, StatisticId_t> enabledStatNames;
257+
bool enabledAllStats;
258+
ConfigStatistic allStatConfig;
237259

238260
std::vector<ConfigComponent*> subComponents; /*!< List of subcomponents */
239261
std::vector<double> coords;
@@ -290,6 +312,7 @@ class ConfigComponent : public SST::Core::Serialization::serializable
290312
std::vector<std::string> getParamsLocalKeys() const { return params.getLocalKeys(); }
291313
std::vector<std::string> getSubscribedGlobalParamSets() const { return params.getSubscribedGlobalParamSets(); }
292314

315+
void addPortModule(const std::string& port, const std::string& type, const Params& params);
293316

294317
std::vector<LinkId_t> allLinks() const;
295318

@@ -311,6 +334,7 @@ class ConfigComponent : public SST::Core::Serialization::serializable
311334
ser& enabledStatNames;
312335
ser& enabledAllStats;
313336
ser& statistics;
337+
ser& portModules;
314338
ser& enabledAllStats;
315339
ser& allStatConfig;
316340
ser& statLoadLevel;

src/sst/core/event.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ class Event : public Activity
121121

122122
bool isEvent() final { return true; }
123123

124+
void copyAllDeliveryInfo(const Activity* act) final
125+
{
126+
Activity::copyAllDeliveryInfo(act);
127+
const Event* ev = static_cast<const Event*>(act);
128+
delivery_info = ev->delivery_info;
129+
}
130+
131+
124132
void serialize_order(SST::Core::Serialization::serializer& ser) override
125133
{
126134
Activity::serialize_order(ser);

0 commit comments

Comments
 (0)