Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
parallel Namespace Reference

Functions

def Run_Parallel_Model
 
def Run_Parallel_Comparison
 

Function Documentation

def parallel.Run_Parallel_Comparison (   Loc_Parallel_Timing_Files,
  Parallelisation,
  PROC_Z,
  PROC_XY,
  Total 
)

Definition at line 151 of file parallel.py.

References functions_main.Find_Nektar_Files(), and CG_Iterations.Parse_Nektar_Output().

152 def Run_Parallel_Comparison(Loc_Parallel_Timing_Files, Parallelisation, PROC_Z, PROC_XY, Total):
153 
154  if (Parallelisation is 'Modal'):
155  Timings_Fin = {}
156  Data = []
157 
158  (Nektar_Modes_Fin, Timing_Files_Fin) = Find_Nektar_Files(Loc_Parallel_Timing_Files)
159 
160  for i in range(0, len(Timing_Files_Fin)):
161  Data.append(np.mean(Parse_Nektar_Output(Loc_Parallel_Timing_Files + Timing_Files_Fin[i]))/10)
162 
163  # Calculate the mean, standard deviation and variance of the difference between the data and the fitted model
164  difference = []
165 
166  for i in range(0, len(Timing_Files_Fin)):
167  difference.append(abs(Data[i] - Total[i]))
168 
169  mean_diff = np.mean(difference)
170  std_dev_diff = np.std(difference)
171  var_diff = np.var(difference)
172 
173  # Print these results for the user to see
174  print('The mean of the differences between the Data and the Model is ' + str(mean_diff))
175  print('The standard deviation of the differences between the Data and the Model is ' + str(std_dev_diff))
176  print('The variance of the differences between the Data and the Model is ' + str(var_diff))
177 
178  fig, ax = plt.subplots()
179  ax.plot(PROC_Z, Data, label = 'Data')
180  ax.plot(PROC_Z, Total, label = 'Model')
181  ax.set_xlabel('$ R_Z $')
182  ax.set_ylabel('Timestep (s)')
183  ax.set_title('Length of Single Timestep: Model vs Data')
184  plt.legend(loc=1)
185  fig.savefig("Output/Figures/Mode_Full.png")
186 
187  if (Parallelisation is 'Elemental'):
188  Timings_Fin = {}
189  Data = []
190 
191  (Nektar_Modes_Fin, Timing_Files_Fin) = Find_Nektar_Files(Loc_Parallel_Timing_Files)
192 
193  for i in range(0, len(Timing_Files_Fin)):
194  Data.append(np.mean(Parse_Nektar_Output(Loc_Parallel_Timing_Files + Timing_Files_Fin[i]))/10)
195 
196  # Calculate the mean, standard deviation and variance of the difference between the data and the fitted model
197  difference = []
198 
199  for i in range(0, len(Timing_Files_Fin)):
200  difference.append(abs(Data[i] - Total[i]))
201 
202  mean_diff = np.mean(difference)
203  std_dev_diff = np.std(difference)
204  var_diff = np.var(difference)
205 
206  # Print these results for the user to see
207  print('The mean of the differences between the Data and the Model is ' + str(mean_diff))
208  print('The standard deviation of the differences between the Data and the Model is ' + str(std_dev_diff))
209  print('The variance of the differences between the Data and the Model is ' + str(var_diff))
210 
211  fig, ax = plt.subplots()
212  ax.plot(PROC_XY, Data, label = 'Data')
213  ax.plot(PROC_XY, Total, label = 'Model')
214  ax.set_xlabel('$ R_{XY} $')
215  ax.set_ylabel('Timestep (s)')
216  ax.set_title('Length of Single Timestep: Model vs Data')
217  plt.legend(loc=1)
218  fig.savefig("Output/Figures/Element_Full.png")
219 
220  if (Parallelisation is 'Hybrid_Socket' or Parallelisation is 'Hybrid_Node'):
221  Data = []
222 
223  (Nektar_Modes_Fin, Timing_Files_Fin) = Find_Nektar_Files(Loc_Parallel_Timing_Files)
224 
225  for i in range(0, len(Timing_Files_Fin)):
226  Data.append(np.mean(Parse_Nektar_Output(Loc_Parallel_Timing_Files + Timing_Files_Fin[i]))/10)
227 
228  # Calculate the mean, standard deviation and variance of the difference between the data and the fitted model
229  difference = []
230 
231  for i in range(0, len(Timing_Files_Fin)):
232  difference.append(abs(Data[i] - Total[i]))
233 
234  mean_diff = np.mean(difference)
235  std_dev_diff = np.std(difference)
236  var_diff = np.var(difference)
237 
238  # Print these results for the user to see
239  print('The mean of the differences between the Data and the Model is ' + str(mean_diff))
240  print('The standard deviation of the differences between the Data and the Model is ' + str(std_dev_diff))
241  print('The variance of the differences between the Data and the Model is ' + str(var_diff))
242 
243  fig, ax = plt.subplots()
244  ax.plot(PROC_Z, Data, label = 'Data')
245  ax.plot(PROC_Z, Total, label = 'Model')
246  ax.set_xlabel('$ R_Z $')
247  ax.set_ylabel('Timestep (s)')
248  ax.set_title('Length of Single Timestep: Model vs Data')
249  plt.legend(loc=1)
250  fig.savefig("Output/Figures/Hybrid_Full.png")
def Parse_Nektar_Output
def Run_Parallel_Comparison
Definition: parallel.py:151
def parallel.Run_Parallel_Model (   Parallelisation,
  Scheme,
  Mesh_File,
  Num_Modes,
  P,
  Num_Constants,
  Fit,
  BW_Node_To_Node,
  LAT_Node_To_Node,
  BW_Socket_To_Socket,
  LAT_Socket_To_Socket,
  BW_Core_To_Core,
  LAT_Core_To_Core,
  Num_Core_Per_Socket,
  Num_Sock_Per_Node,
  PROC_TOT,
  Pressure,
  Velocity_1,
  Velocity_2,
  Velocity_3 
)

Definition at line 35 of file parallel.py.

References functions_main.Find_Topologies(), and functions_main.Partition().

35 
36  Velocity_3):
37 
38  # Find possible topologies when running in hybrid
39  if (Parallelisation is 'Hybrid_Socket' or Parallelisation is 'Hybrid_Node'):
40  (PROC_XY, PROC_Z) = Find_Topologies(PROC_TOT, Num_Modes)
41 
42  # Modal parallelisation values
43  if (Parallelisation is 'Modal'):
44  PROC_Z = [2, 4, 5, 8, 10, 20]
45  PROC_XY = [1, 1, 1, 1, 1, 1]
46 
47  # Elemental parallelisation values
48  if (Parallelisation is 'Elemental'):
49  PROC_Z = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
50  PROC_XY = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
51 
52 #------------------------------------
53 # Topology Class Input and Results
54 #------------------------------------
55 
56  Pairwise = []
57  Allreduce = []
58  Alltoall = []
59 
60  Communication = []
61  Serial = []
62 
63  Serial_Pairwise = []
64  Serial_Allreduce = []
65  Serial_Alltoall = []
66 
67  Total = []
68 
69  for i in range(0, len(PROC_Z)):
70 
71  # Set the communication count to 0
72  Communication_Count = 0.0
73 
74  # Create class instance with basic input
75  Simulation = Topology(PROC_Z[i], PROC_XY[i], Num_Core_Per_Socket, Num_Sock_Per_Node, Scheme)
76 
77  # Find the partition for the number of PROC_XY input
78  (Num_Element_Msg, Num_Elements) = Partition(Mesh_File, PROC_XY[i])
79 
80  # Input the benchmarked communication data
81  Simulation.Input_Communication(BW_Node_To_Node, LAT_Node_To_Node, BW_Socket_To_Socket, LAT_Socket_To_Socket, BW_Core_To_Core, LAT_Core_To_Core)
82 
83  # Distribute the modes and elements
84  Simulation.Distribute_Modes(Num_Modes);
85  Simulation.Distribute_Elements(Num_Element_Msg, Num_Elements);
86 
87  # Read in the CG iterations
88  Simulation.CG_Iterations(Pressure, Velocity_1, Velocity_2, Velocity_3)
89 
90  # Input P to genererate the data sizes
91  Simulation.Data_Size(P)
92 
93  # Input the fit from the serial model
94  Simulation.Hardware_Constant(Num_Constants, Fit)
95 
96  # Count pairwise exchange
97  Pairwise.append(Simulation.Communication_Pairwise_Exchange())
98  Communication_Count += Pairwise[i]
99 
100  # Count Allreduce
101  Allreduce.append(Simulation.Communication_Allreduce())
102  Communication_Count += Allreduce[i]
103 
104  # Count Alltoall
105  Alltoall.append(Simulation.Communication_Alltoall())
106  Communication_Count += Alltoall[i]
107 
108  # Count Serial
109  Serial.append(Simulation.Serial_Compute())
110 
111  # Count Serial with each type of communication
112  Serial_Pairwise.append(Serial[i] + Pairwise[i])
113  Serial_Allreduce.append(Serial[i] + Allreduce[i])
114  Serial_Alltoall.append(Serial[i] + Alltoall[i])
115 
116  # Record the total communication
117  Communication.append(Communication_Count)
118 
119  # Calculate the total length of a time step
120  Total.append(Communication[i] + Serial[i])
121 
122  if (Parallelisation == 'Hybrid'):
123  fig, ax = plt.subplots()
124  ax.plot(PROC_Z, Total, label = 'Model')
125  ax.set_xlabel('$ R_Z $')
126  ax.set_ylabel('Timestep (s)')
127  ax.set_title('Length of Single Timestep: Model')
128  plt.legend(loc=1)
129  fig.savefig("Output/Figures/Model_Hybrid.png")
130 
131  if (Parallelisation == 'Modal'):
132  fig, ax = plt.subplots()
133  ax.plot(PROC_Z, Total, label = 'Model')
134  ax.set_xlabel('$ R_Z $')
135  ax.set_ylabel('Timestep (s)')
136  ax.set_title('Length of Single Timestep: Model')
137  plt.legend(loc=1)
138  fig.savefig("Output/Figures/Model_Modal.png")
139 
140  if (Parallelisation == 'Elemental'):
141  fig, ax = plt.subplots()
142  ax.plot(PROC_XY, Total, label = 'Model')
143  ax.set_xlabel('$ R_{XY} $')
144  ax.set_ylabel('Timestep (s)')
145  ax.set_title('Length of Single Timestep: Model')
146  plt.legend(loc=1)
147  fig.savefig("Output/Figures/Model_Elemental.png")
148 
149  return(PROC_Z, PROC_XY, Total)
150 
# Run a series of plots showing outputs of the model vs data