DisCostiC v2.0.0
Distributed Cost in Cluster: a cross-architecture simulator for massively parallel MPI programs
Loading...
Searching...
No Matches
NodeLvlScg.cpp
Go to the documentation of this file.
1
8
9int bound = 0;
10
11extern int scaling_cores;
12extern int bytes_to_send;
13
14// Global variables for setting individual system properties
15extern int virtual_rank;
16extern int system_number;
17extern int task_per_node;
18extern int node;
20extern int cores_per_socket;
21extern int cc_numa_domain;
22extern int socket;
23extern int primary_processes;
24extern int secondary_processes;
25extern int heteregeneous_mode;
26extern int cacheline_size;
27extern std::string arch_name;
28
30{
32 MEMORY = 1
33};
34
36{
37 Machine machine = NM.getMachine();
38 ECM ecm = NM.getECM();
39 DisCosTiC_Datatype flops = NM.getFlops();
40 *perf_est = (flops / ecm.T_MECM_) * (machine.f_core_ * 1000); // This gives me the MFlop/s
41
42 if (ecm.T_OL_ == ecm.T_ECM_)
43 {
44 *runtime = ecm.T_ECM_ / (machine.f_core_ * (machine.cachelinesize / 8) * 1e9);
45 bound = COMPUTE;
46 }
47 else
48 {
49
50 *runtime = ecm.T_MECM_ / (machine.f_core_ * (machine.cachelinesize / 8) * 1e9);
51 bound = MEMORY;
52 }
53}
54
55// TODO Add scalability functions from kerncraft
56
58{
59 ECM ecm = NM.getECM();
61
62 if (ecm.T_L3Mem_ != 0.0)
63 {
64
66 unsigned int scaling_cores_local;
67
68 // Calculation of Utilization
69 util[0] = 0.0;
70 scaling_cores_local = m.cores_per_socket_ * m.sockets_ + 5000;
71 for (unsigned int c = 1; c < m.cores_per_numa_domain_ + 1; ++c)
72 {
73 if (c * ecm.T_L3Mem_ > (ecm.T_ECM_ + util[c - 1] * (c - 1) * ecm.T_L3Mem_ * 0.5))
74 {
75 util[c] = 1.0;
76 scaling_cores_local = std::min(scaling_cores_local, c);
77 }
78 else
79 {
80 util[c] = (c * ecm.T_L3Mem_) / (ecm.T_ECM_ + util[c - 1] * (c - 1) * (ecm.T_L3Mem_ * 0.5));
81 }
82 }
83
84 scaling_cores = scaling_cores_local;
85 for (unsigned int c = 1; c < m.cores_per_socket_ + 1; ++c)
86 {
87
88 DisCosTiC_Timetype numa = 0.0;
89 if (c <= scaling_cores_local)
90 {
91 numa = ecm.T_ECM_ / (ecm.T_ECM_ / ecm.T_L3Mem_);
92 }
93 else
94 {
95 numa = ecm.T_L3Mem_;
96 }
97 scaling_numa[c - 1] = numa;
98
99 if (0 < c && c <= m.cores_per_numa_domain_)
100 {
101 scaling_performance[c - 1] = (numa / util[c]);
102 }
103 else if (m.cores_per_numa_domain_ < c && c <= m.cores_per_socket_)
104 {
105 scaling_performance[c - 1] = (numa / util[m.cores_per_numa_domain_]) * ((double)(m.cores_per_numa_domain_) / (c));
106 }
107 else
108 {
109 std::cerr << "The number of cores must be greater than zero and only upto the max number available as defined by cores per socket and sockets in the machine file." << std::endl;
110 exit(EXIT_FAILURE);
111 }
112 }
113 }
114 else
115 {
116 for (unsigned int c = 1; c < m.cores_per_socket_ + 1; ++c)
117 {
118 scaling_performance[c - 1] = ecm.T_ECM_ / static_cast<DisCosTiC_Timetype>(c);
120 }
121 }
122}
123
124void executeKerncraft(char *argV[], int size)
125{
126
127 std::string execCommand;
128
129 for (int i = 0; i < size; ++i)
130 {
131 execCommand.append(argV[i]);
132 execCommand.append(" ");
133 }
134
135 system(execCommand.c_str());
136
137 return;
138}
139
140double maximum_time(double *array, int size)
141{
142 int temp = 0;
143 for (int i = 0; i < size; ++size)
144 {
145 temp = std::max<double>(array[i], temp);
146 }
147 return temp;
148}
std::size_t DisCosTiC_Datatype
Definition DataType.hpp:52
double DisCosTiC_Timetype
Definition DataType.hpp:51
bound_type
Definition DisCosTiC.cpp:52
int virtual_rank
Definition DisCosTiC.cpp:62
int secondary_processes
Definition DisCosTiC.cpp:71
void estimation(NodeModel &NM, DisCosTiC_Timetype *perf_est, DisCosTiC_Timetype *runtime)
int socket
Definition DisCosTiC.cpp:69
int scaling_cores
Definition AST.hpp:36
int heteregeneous_mode
Definition DisCosTiC.cpp:72
int cacheline_size
@ COMPUTE
@ MEMORY
__declspec(noalias) void scaling(NodeModel &NM
DisCosTiC_Timetype * scaling_performance
int system_number
Definition DisCosTiC.cpp:63
int primary_processes
Definition DisCosTiC.cpp:70
int cores_per_socket
Definition DisCosTiC.cpp:67
int bound
Definition NodeLvlScg.cpp:9
DisCosTiC_Timetype DisCosTiC_Timetype * scaling_numa
int bytes_to_send
Definition AST.hpp:37
int task_per_node
Definition DisCosTiC.cpp:64
int cc_numa_domain_per_socket
Definition DisCosTiC.cpp:66
std::string arch_name
Definition DisCosTiC.cpp:77
Machine m
int cc_numa_domain
Definition DisCosTiC.cpp:68
int node
Definition DisCosTiC.cpp:65
void scaling(NodeModel &NM, DisCosTiC_Timetype *scaling_performance, DisCosTiC_Timetype *scaling_numa)
void executeKerncraft(char *argV[], int size)
double maximum_time(double *array, int size)
end NodeModel_HPP
Definition NodeModel.hpp:63
ECM & getECM()
Machine & getMachine()
DisCosTiC_Datatype getFlops()
DisCosTiC_Timetype T_ECM_
Definition NodeModel.hpp:57
DisCosTiC_Timetype T_OL_
Definition NodeModel.hpp:52
DisCosTiC_Timetype T_MECM_
Definition NodeModel.hpp:58
DisCosTiC_Timetype T_L3Mem_
Definition NodeModel.hpp:56
DisCosTiC_Datatype cores_per_numa_domain_
Definition NodeModel.hpp:38
DisCosTiC_Datatype sockets_
Definition NodeModel.hpp:40
DisCosTiC_Timetype cachelinesize
Definition NodeModel.hpp:46
DisCosTiC_Timetype f_core_
Definition NodeModel.hpp:41
DisCosTiC_Datatype cores_per_socket_
Definition NodeModel.hpp:39