Skip to content

Commit 3a9608f

Browse files
authored
Change name of GlobalParams to SharedParams for clarity. (#1306)
1 parent 7126694 commit 3a9608f

File tree

15 files changed

+178
-140
lines changed

15 files changed

+178
-140
lines changed

src/sst/core/cfgoutput/jsonConfigOutput.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ to_json(json::ordered_json& j, SubCompWrapper const& comp_wrapper)
103103
j["params"][paramsItr] = comp->params.find<std::string>(paramsItr);
104104
}
105105

106-
for ( auto const& paramsItr : comp->getSubscribedGlobalParamSets() ) {
107-
j["params_global_sets"].push_back(paramsItr);
106+
for ( auto const& paramsItr : comp->getSubscribedSharedParamSets() ) {
107+
j["params_shared_sets"].push_back(paramsItr);
108108
}
109109

110110
for ( auto const& scItr : comp->subComponents ) {
@@ -126,8 +126,8 @@ to_json(json::ordered_json& j, CompWrapper const& comp_wrapper)
126126
j["params"][paramsItr] = comp->params.find<std::string>(paramsItr);
127127
}
128128

129-
for ( auto const& paramsItr : comp->getSubscribedGlobalParamSets() ) {
130-
j["params_global_sets"].push_back(paramsItr);
129+
for ( auto const& paramsItr : comp->getSubscribedSharedParamSets() ) {
130+
j["params_shared_sets"].push_back(paramsItr);
131131
}
132132

133133
for ( auto const& scItr : comp->subComponents ) {
@@ -235,10 +235,10 @@ JSONConfigGraphOutput::generate(const Config* cfg, ConfigGraph* graph)
235235
outputJson["program_options"]["checkpoint-sim-period"] = cfg->checkpoint_sim_period();
236236
outputJson["program_options"]["checkpoint-wall-period"] = std::to_string(cfg->checkpoint_wall_period());
237237

238-
// Put in the global param sets
239-
for ( const auto& set : getGlobalParamSetNames() ) {
240-
for ( const auto& kvp : getGlobalParamSet(set) ) {
241-
if ( kvp.first != "<set_name>" ) outputJson["global_params"][set][kvp.first] = kvp.second;
238+
// Put in the shared param sets
239+
for ( const auto& set : getSharedParamSetNames() ) {
240+
for ( const auto& kvp : getSharedParamSet(set) ) {
241+
if ( kvp.first != "<set_name>" ) outputJson["shared_params"][set][kvp.first] = kvp.second;
242242
}
243243
}
244244

src/sst/core/cfgoutput/pythonConfigOutput.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ PythonConfigGraphOutput::generateCommonComponent(const char* objName, const Conf
7272
fprintf(outputFile, "%s.addParams(", objName);
7373
generateParams(comp->params);
7474
fprintf(outputFile, ")\n");
75-
// Add global param sets
76-
for ( auto x : getSubscribedGlobalParamSets(comp->params) ) {
77-
fprintf(outputFile, "%s.addGlobalParamSet(\"%s\")\n", objName, x.c_str());
75+
// Add shared param sets
76+
for ( auto x : getSubscribedSharedParamSets(comp->params) ) {
77+
fprintf(outputFile, "%s.addSharedParamSet(\"%s\")\n", objName, x.c_str());
7878
}
7979
}
8080

@@ -289,12 +289,12 @@ PythonConfigGraphOutput::generate(const Config* cfg, ConfigGraph* graph)
289289
outputFile, "sst.setProgramOption(\"checkpoint-wall-period\", \"%" PRIu32 "\")\n",
290290
cfg->checkpoint_wall_period());
291291

292-
// Output the global params
293-
fprintf(outputFile, "# Define the global parameter sets:\n");
294-
std::vector<std::string> global_param_sets = getGlobalParamSetNames();
295-
for ( auto& x : global_param_sets ) {
296-
fprintf(outputFile, "sst.addGlobalParams(\"%s\", {\n", x.c_str());
297-
for ( auto y : getGlobalParamSet(x) ) {
292+
// Output the shared params
293+
fprintf(outputFile, "# Define the shared parameter sets:\n");
294+
std::vector<std::string> shared_param_sets = getSharedParamSetNames();
295+
for ( auto& x : shared_param_sets ) {
296+
fprintf(outputFile, "sst.addSharedParams(\"%s\", {\n", x.c_str());
297+
for ( auto y : getSharedParamSet(x) ) {
298298
// If the key is <set_name>, then we can skip since it's
299299
// just metadata
300300
if ( y.first != "<set_name>" )

src/sst/core/configGraph.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ ConfigGraph::addComponent(const std::string& name, const std::string& type)
794794
}
795795

796796
void
797-
ConfigGraph::addGlobalParam(const std::string& global_set, const std::string& key, const std::string& value)
797+
ConfigGraph::addSharedParam(const std::string& shared_set, const std::string& key, const std::string& value)
798798
{
799-
Params::insert_global(global_set, key, value);
799+
Params::insert_shared(shared_set, key, value);
800800
}
801801

802802
void

src/sst/core/configGraph.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,22 @@ class ConfigComponent : public SST::Core::Serialization::serializable
318318
void setStatisticParameters(const std::string& statisticName, const Params& params, bool recursively = false);
319319
void setStatisticLoadLevel(uint8_t level, bool recursively = false);
320320

321-
void addGlobalParamSet(const std::string& set) { params.addGlobalParamSet(set); }
321+
void addSharedParamSet(const std::string& set) { params.addSharedParamSet(set); }
322+
[[deprecated(
323+
"addGlobalParamSet() has been deprecated and will be removed in SST 16. Please use addSharedParamSet()")]] void
324+
addGlobalParamSet(const std::string& set)
325+
{
326+
params.addSharedParamSet(set);
327+
}
322328
std::vector<std::string> getParamsLocalKeys() const { return params.getLocalKeys(); }
323-
std::vector<std::string> getSubscribedGlobalParamSets() const { return params.getSubscribedGlobalParamSets(); }
329+
std::vector<std::string> getSubscribedSharedParamSets() const { return params.getSubscribedSharedParamSets(); }
330+
331+
[[deprecated("getSubscribedGlobalParamSets() has been deprecated and will be removed in SST 16. Please use "
332+
"getSubscribedSharedParamSets()")]] std::vector<std::string>
333+
getSubscribedGlobalParamSets() const
334+
{
335+
return params.getSubscribedSharedParamSets();
336+
}
324337

325338
void addPortModule(const std::string& port, const std::string& type, const Params& params);
326339

@@ -467,8 +480,12 @@ class ConfigGraph : public SST::Core::Serialization::serializable
467480
/** Create a new component */
468481
ComponentId_t addComponent(const std::string& name, const std::string& type);
469482

470-
/** Add a parameter to a global param set */
471-
void addGlobalParam(const std::string& global_set, const std::string& key, const std::string& value);
483+
/** Add a parameter to a shared param set */
484+
void addSharedParam(const std::string& shared_set, const std::string& key, const std::string& value);
485+
486+
[[deprecated(
487+
"addGlobalParam() has been deprecated and will be removed in SST 16. Please use addSharedParam()")]] void
488+
addGlobalParam(const std::string& shared_set, const std::string& key, const std::string& value);
472489

473490
/** Set the statistic output module */
474491
void setStatisticOutput(const std::string& name);

src/sst/core/configGraphOutput.h

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,40 @@ class ConfigGraphOutput
7575
FILE* outputFile;
7676

7777
/**
78-
* Get a named global parameter set.
78+
* Get a named shared parameter set.
7979
*
8080
* @param name Name of the set to get
8181
*
82-
* @return returns a copy of the reqeusted global param set
82+
* @return returns a copy of the reqeusted shared param set
8383
*
8484
*/
85-
static std::map<std::string, std::string> getGlobalParamSet(const std::string& name)
85+
static std::map<std::string, std::string> getSharedParamSet(const std::string& name)
8686
{
87-
return Params::getGlobalParamSet(name);
87+
return Params::getSharedParamSet(name);
8888
}
8989

9090

91+
[[deprecated("getGlobalParamSet() has been deprecated and will be removed in SST 16. Please use "
92+
"getSharedParamSet()")]] static std::map<std::string, std::string>
93+
getGlobalParamSet(const std::string& name)
94+
{
95+
return getSharedParamSet(name);
96+
}
9197
/**
92-
* Get a vector of the names of available global parameter sets.
98+
* Get a vector of the names of available shared parameter sets.
9399
*
94-
* @return returns a vector of the names of available global param
100+
* @return returns a vector of the names of available shared param
95101
* sets
96102
*
97103
*/
98-
static std::vector<std::string> getGlobalParamSetNames() { return Params::getGlobalParamSetNames(); }
104+
static std::vector<std::string> getSharedParamSetNames() { return Params::getSharedParamSetNames(); }
99105

106+
[[deprecated("getGlobalParamSetNames() has been deprecated and will be removed in SST 16. Please use "
107+
"getSharedParamSetNames()")]] static std::vector<std::string>
108+
getGlobalParamSetNames()
109+
{
110+
return getSharedParamSetNames();
111+
}
100112

101113
/**
102114
* Get a vector of the local keys
@@ -109,16 +121,23 @@ class ConfigGraphOutput
109121

110122

111123
/**
112-
* Get a vector of the global param sets this Params object is
124+
* Get a vector of the shared param sets this Params object is
113125
* subscribed to
114126
*
115-
* @return returns a vector of the global param sets his Params
127+
* @return returns a vector of the shared param sets his Params
116128
* object is subscribed to
117129
*
118130
*/
119-
std::vector<std::string> getSubscribedGlobalParamSets(const Params& params) const
131+
std::vector<std::string> getSubscribedSharedParamSets(const Params& params) const
132+
{
133+
return params.getSubscribedSharedParamSets();
134+
}
135+
136+
[[deprecated("getSubscribedGlobalParamSets() has been deprecated and will be removed in SST 16. Please use "
137+
"getSubscribedSharedParamSets()")]] std::vector<std::string>
138+
getSubscribedGlobalParamSets(const Params& params) const
120139
{
121-
return params.getSubscribedGlobalParamSets();
140+
return getSubscribedSharedParamSets(params);
122141
}
123142
};
124143

src/sst/core/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ main(int argc, char* argv[])
10031003
Comms::broadcast(Params::keyMap, 0);
10041004
Comms::broadcast(Params::keyMapReverse, 0);
10051005
Comms::broadcast(Params::nextKeyID, 0);
1006-
Comms::broadcast(Params::global_params, 0);
1006+
Comms::broadcast(Params::shared_params, 0);
10071007

10081008
std::set<uint32_t> my_ranks;
10091009
std::set<uint32_t> your_ranks;

src/sst/core/model/json/jsonmodel.cc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ SSTJSONModelDefinition::recursiveSubcomponent(ConfigComponent* Parent, const nlo
113113
}
114114
}
115115

116-
// read all the global parameters
117-
if ( subArray.contains("params_global_sets") ) {
118-
for ( auto& globalArray : subArray["params_global_sets"].items() ) {
119-
Comp->addGlobalParamSet(globalArray.value().get<std::string>());
116+
// read all the shared parameters
117+
if ( subArray.contains("params_shared_sets") ) {
118+
for ( auto& sharedArray : subArray["params_shared_sets"].items() ) {
119+
Comp->addSharedParamSet(sharedArray.value().get<std::string>());
120120
}
121121
}
122122

@@ -196,10 +196,10 @@ SSTJSONModelDefinition::discoverComponents(const json& jFile)
196196
}
197197
}
198198

199-
// read all the global parameters
200-
if ( compArray.contains("params_global_sets") ) {
201-
for ( auto& globalArray : compArray["params_global_sets"].items() ) {
202-
Comp->addGlobalParamSet(globalArray.value().get<std::string>());
199+
// read all the shared parameters
200+
if ( compArray.contains("params_shared_sets") ) {
201+
for ( auto& sharedArray : compArray["params_shared_sets"].items() ) {
202+
Comp->addSharedParamSet(sharedArray.value().get<std::string>());
203203
}
204204
}
205205

@@ -334,15 +334,15 @@ SSTJSONModelDefinition::discoverProgramOptions(const json& jFile)
334334
}
335335

336336
void
337-
SSTJSONModelDefinition::discoverGlobalParams(const json& jFile)
337+
SSTJSONModelDefinition::discoverSharedParams(const json& jFile)
338338
{
339-
std::string GlobalName;
339+
std::string SharedName;
340340

341-
if ( jFile.contains("global_params") ) {
342-
for ( auto& gp : jFile["global_params"].items() ) {
343-
GlobalName = gp.key();
344-
for ( auto& param : jFile["global_params"].at(GlobalName).items() ) {
345-
graph->addGlobalParam(GlobalName, param.key(), param.value().get<std::string>());
341+
if ( jFile.contains("shared_params") ) {
342+
for ( auto& gp : jFile["shared_params"].items() ) {
343+
SharedName = gp.key();
344+
for ( auto& param : jFile["shared_params"].at(SharedName).items() ) {
345+
graph->addSharedParam(SharedName, param.key(), param.value().get<std::string>());
346346
}
347347
}
348348
}
@@ -488,8 +488,8 @@ SSTJSONModelDefinition::createConfigGraph()
488488
// discover all the globals
489489
discoverProgramOptions(jFile);
490490

491-
// discover the global parameters
492-
discoverGlobalParams(jFile);
491+
// discover the shared parameters
492+
discoverSharedParams(jFile);
493493

494494
// discover the components
495495
discoverComponents(jFile);

src/sst/core/model/json/jsonmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class SSTJSONModelDefinition : public SSTModelDescription
7070
void discoverProgramOptions(const json& jFile);
7171
void discoverComponents(const json& jFile);
7272
void discoverLinks(const json& jFile);
73-
void discoverGlobalParams(const json& jFile);
73+
void discoverSharedParams(const json& jFile);
7474
void discoverStatistics(const json& jFile);
7575
ComponentId_t findComponentIdByName(const std::string& Name);
7676
};

src/sst/core/model/python/pymodel.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ setCallPythonFinalize(PyObject* UNUSED(self), PyObject* arg)
874874
}
875875

876876
static PyObject*
877-
globalAddParam(PyObject* UNUSED(self), PyObject* args)
877+
addSharedParam(PyObject* UNUSED(self), PyObject* args)
878878
{
879879
char* set = nullptr;
880880
char* param = nullptr;
@@ -891,7 +891,7 @@ globalAddParam(PyObject* UNUSED(self), PyObject* args)
891891
}
892892

893893
static PyObject*
894-
globalAddParams(PyObject* UNUSED(self), PyObject* args)
894+
addSharedParams(PyObject* UNUSED(self), PyObject* args)
895895
{
896896
char* set = nullptr;
897897
PyObject* dict = nullptr;
@@ -984,8 +984,10 @@ static PyMethodDef sstModuleMethods[] = {
984984
{ "findComponentByName", findComponentByName, METH_O,
985985
"Looks up to find a previously created component/subcomponent, based off of its name. Returns None if none "
986986
"are to be found." },
987-
{ "addGlobalParam", globalAddParam, METH_VARARGS, "Add a parameter to the specified global set." },
988-
{ "addGlobalParams", globalAddParams, METH_VARARGS, "Add parameters in dictionary to the specified global set." },
987+
{ "addGlobalParam", addSharedParam, METH_VARARGS, "Add a parameter to the specified shared set." },
988+
{ "addGlobalParams", addSharedParams, METH_VARARGS, "Add parameters in dictionary to the specified shared set." },
989+
{ "addSharedParam", addSharedParam, METH_VARARGS, "Add a parameter to the specified shared set." },
990+
{ "addSharedParams", addSharedParams, METH_VARARGS, "Add parameters in dictionary to the specified shared set." },
989991
{ "getElapsedExecutionTime", getElapsedExecutionTime, METH_NOARGS,
990992
"Gets the real elapsed time since simulation start, returned as a UnitAlgebra. Not precise enough for "
991993
"getting fine timings. For that, use the built-in time module." },

src/sst/core/model/python/pymodel_comp.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,15 +541,15 @@ compCreateStatistic(PyObject* self, PyObject* args)
541541
}
542542

543543
static PyObject*
544-
compAddGlobalParamSet(PyObject* self, PyObject* arg)
544+
compAddSharedParamSet(PyObject* self, PyObject* arg)
545545
{
546546
const char* set = nullptr;
547547
PyErr_Clear();
548548
set = SST_ConvertToCppString(arg);
549549

550550
ConfigComponent* c = getComp(self);
551551

552-
if ( set != nullptr ) { c->addGlobalParamSet(set); }
552+
if ( set != nullptr ) { c->addSharedParamSet(set); }
553553
else {
554554
return nullptr;
555555
}
@@ -579,7 +579,8 @@ static PyMethodDef componentMethods[] = {
579579
{ "setSubComponent", compSetSubComponent, METH_VARARGS, "Bind a subcomponent to slot <name>, with type <type>" },
580580
{ "setCoordinates", compSetCoords, METH_VARARGS,
581581
"Set (X,Y,Z) coordinates of this component, for use with visualization" },
582-
{ "addGlobalParamSet", compAddGlobalParamSet, METH_O, "Add global parameter set to the component" },
582+
{ "addSharedParamSet", compAddSharedParamSet, METH_O, "Add shared parameter set to the component" },
583+
{ "addGlobalParamSet", compAddSharedParamSet, METH_O, "Add shared parameter set to the component" },
583584
{ nullptr, nullptr, 0, nullptr }
584585
};
585586

@@ -689,7 +690,8 @@ static PyMethodDef subComponentMethods[] = {
689690
"Enable a statistic with a name and return a handle to it" },
690691
{ "setStatistic", compSetStatistic, METH_VARARGS, "Reuse a statistic for the binding" },
691692
{ "setSubComponent", compSetSubComponent, METH_VARARGS, "Bind a subcomponent to slot <name>, with type <type>" },
692-
{ "addGlobalParamSet", compAddGlobalParamSet, METH_O, "Add global parameter set to the component" },
693+
{ "addSharedParamSet", compAddSharedParamSet, METH_O, "Add shared parameter set to the component" },
694+
{ "addGlobalParamSet", compAddSharedParamSet, METH_O, "Add shared parameter set to the component" },
693695
{ "setCoordinates", compSetCoords, METH_VARARGS,
694696
"Set (X,Y,Z) coordinates of this component, for use with visualization" },
695697
{ nullptr, nullptr, 0, nullptr }

0 commit comments

Comments
 (0)