SST 15.0
Structural Simulation Toolkit
jsonmodel.h
1// -*- c++ -*-
2
3// Copyright 2009-2025 NTESS. Under the terms
4// of Contract DE-NA0003525 with NTESS, the U.S.
5// Government retains certain rights in this software.
6//
7// Copyright (c) 2009-2025, NTESS
8// All rights reserved.
9//
10// This file is part of the SST software package. For license
11// information, see the LICENSE file in the top level directory of the
12// distribution.
13
14#ifndef SST_CORE_MODEL_JSON_JSONMODEL_H
15#define SST_CORE_MODEL_JSON_JSONMODEL_H
16
17#include "sst/core/component.h"
18#include "sst/core/config.h"
19#include "sst/core/configGraph.h"
20#include "sst/core/cputimer.h"
21#include "sst/core/factory.h"
22#include "sst/core/memuse.h"
23#include "sst/core/model/sstmodel.h"
24#include "sst/core/output.h"
25#include "sst/core/rankInfo.h"
26#include "sst/core/sst_types.h"
27#include "sst/core/warnmacros.h"
28
29#include "nlohmann/json.hpp"
30
31#include <fstream>
32#include <string>
33#include <tuple>
34#include <vector>
35
36using namespace SST;
37using json = nlohmann::json;
38
39namespace SST::Core {
40
41class SSTJSONModelDefinition : public SSTModelDescription
42{
43public:
44 SST_ELI_REGISTER_MODEL_DESCRIPTION(
46 "sst",
47 "model.json",
48 SST_ELI_ELEMENT_VERSION(1,0,0),
49 "JSON model for building SST simulation graphs",
50 true)
51
52 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(".json")
53
54 SSTJSONModelDefinition(const std::string& script_file, int verbosity, Config* config, double start_time);
56
58
59protected:
60 std::string scriptName;
61 Output* output;
62 Config* config;
63 ConfigGraph* graph;
64 ComponentId_t nextComponentId;
65 double start_time;
66
67private:
68 void setStatGroupOptions(const json& jFile);
69 void recursiveSubcomponent(ConfigComponent* Parent, const nlohmann::basic_json<>& compArray);
70 void discoverProgramOptions(const json& jFile);
71 void discoverComponents(const json& jFile);
72 void discoverLinks(const json& jFile);
73 void discoverSharedParams(const json& jFile);
74 void discoverStatistics(const json& jFile);
75 ComponentId_t findComponentIdByName(const std::string& Name);
76};
77
78} // namespace SST::Core
79
80#endif // SST_CORE_MODEL_JSON_JSONMODEL_H
Represents the configuration of a generic component.
Definition configGraph.h:263
A Configuration Graph A graph representing Components and Links.
Definition configGraph.h:450
Class to contain SST Simulation Configuration variables.
Definition config.h:41
Definition jsonmodel.h:42
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition jsonmodel.cc:506
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:54