Open mperrinel opened 4 years ago
@jjwilke I started to analysed/worked on this issue. The current way to create a sst.StatisticGroup is to provide only its name as a parameter. Then to add a statistic to the group, it is necessary to use the addStatistic method that takes a name and Params, as parameters. There are also two other methods : setOuput and setFrequency.
To start the modification on the StatisticGroup, I suggest to use the work done with the new Statistic python object (ConfigStatistic). Basically, the idea is to modify the way that a statistic is registered in ConfigStatGroup (configGraph.h) :
std::map<std::string, Params> statMap;
to
std::vector<StatisticId_t> statistics;
Since that we have an ID for every statistics, we can use it to retrieve all ConfigStatistic instances when necessary, like it is already done, in the same struct (ConfigStatGroup), for the components:
std::vector<ComponentId_t> components;
As a result, this first modification should permit to create a StatisticGroup like that in the python file :
a = sst.Component("a", "ctest.CtestComponent")
statA = a.setStatistic("traffic_intensity")
statA.addParams({"type":"sst.StatVTK"})
group = sst.StatisticGroup("StatVTKGroup")
group.addStatistic(statA)
In this issue, you may want to have the output to be defined directly at the construction of the StatisticGroup :
group = sst.StatisticGroup("StatVTKGroup", "sst.StatisticOutputExodus")
What do you think about that ? We can discuss this tomorrow at the call.
The StatisticsGroup permits to add all Statistics of the group to all added components of the group.
a = sst.Component("a", "ctest.CtestComponent")
b = sst.Component("b", "ctest.CtestComponent")
statA = a.setStatistic("traffic_intensity")
statA.addParams({"type":"sst.StatVTK"})
group = sst.StatisticGroup("StatVTKGroup")
group.addComponent(b)
group.addStatistic(statA)
In this example, b is a component on the group "StatVTKGroup", on which, the statA statistic have been added. That means b have also the statA statistic. As a result, we don't need to do :
b.enableStatistics(["traffic_intensity"], {"type":"sst.StatVTK"})
But this example shows also two things:
In addition, the StatisticProcessingEngine class holds the default group and a list of named group :
StatisticGroup m_defaultGroup;
std::vector<StatisticGroup> m_statGroups;
A StatisticGroup can be constructed by two ways:
The setup method of the StatisticProcessingEngine fill the m_statGroups variable member. The registerStatisticCore creates a default StatisticGroup as a local variable, then try to find a StatisticGroup that knows the statistic provided at a parameter, and in case of success, re-assigned the local StatisticGroup with it. I think it is possible to remove the local variable and simply use the variable members.
Let's talk about the design of the group at the meeting.
@jjwilke We said on last Friday meeting that we don't want to use the addComponent method anymore from the python file parameter. What is the best way to do that ? :
Modify the C++/Python in the simulation to the StatisticGroup more sensibly in the python