forked from qizzpzlz/simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (57 loc) · 2 KB
/
main.cpp
File metadata and controls
72 lines (57 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "includes/parser.h"
#include "includes/scenario.h"
#include "includes/cluster.h"
#include "includes/cluster_simulation.h"
#include "spdlog/spdlog.h"
#include <fstream>
//#if defined
#if defined _WIN32
const std::string SCENARIO_PATH = "../scenarios/";
#else
const std::string SCENARIO_PATH = "scenarios/";
#endif
const std::string HOSTS_FILE = "hosts_final.json";
const std::string SCENARIO_FILE = "sliced_10000_Scenario_From_1000000_1000000.json";
int main()
{
// Temporary CLI for input files
std::string scenario_path;
std::string host_path;
// int lines;
// std::cout << "##Cluster Simulator" << std::endl;
// std::cout << "Path to scenario file: ";
// std::cin >> scenario_path;
// std::cout << "Input the number of lines to read: ";
// std::cin >> lines;
// std::cout << "Path to host file: ";
// std::cin >> host_path;
ClusterSimulator::Scenario scenario;
ClusterSimulator::Cluster cluster;
// Parse the given scenario and the cluster from json files.
if (!host_path.empty() && !scenario_path.empty())
{
ClusterSimulator::Parser::parse_scenario(&scenario, scenario_path);
ClusterSimulator::Parser::parse_cluster(&cluster, host_path);
}
else
{
ClusterSimulator::Parser::parse_scenario(&scenario, SCENARIO_PATH + SCENARIO_FILE, 5000);
ClusterSimulator::Parser::parse_cluster(&cluster, SCENARIO_PATH + HOSTS_FILE);
}
// Start simulation
ClusterSimulator::ClusterSimulation simulation{ scenario, cluster };
simulation.run();
// Print summary
simulation.print_summary();
//std::string current_working_dir(NPath);
//std::cout << current_working_dir; ClusterSimulator::ParseScenario(SCENARIO_PATH + "lines.json");
//ClusterSimulator::ParseCluster(SCENARIO_PATH + HOSTS_FILE);
//ClusterSimulator::parse_scenario(SCENARIO_PATH + SCENARIO_FILE);
//test
//double simulationTime = 7200;
//int nodeNum = 8;
//RandomAlgorithm algorithm{};
//Simulation simulation{algorithm, simulationTime, nodeNum};
//simulation.simulate();
ClusterSimulator::ClusterSimulation::jobmart_file_.close();
}