- Timestamp:
- Aug 28, 2009, 2:34:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga_parallel/parallel_shallow_water.py
r7400 r7447 22 22 23 23 24 from anuga. shallow_water.shallow_water_domain import *24 from anuga.interface import Domain 25 25 26 26 … … 52 52 N = len(self) # number_of_triangles 53 53 54 # self.processor = pypar.rank()55 # self.numproc = pypar.size()56 #57 # # Setup Communication Buffers58 # self.nsys = 359 # for key in full_send_dict:60 # buffer_shape = full_send_dict[key][0].shape[0]61 # full_send_dict[key].append(num.zeros( (buffer_shape,self.nsys) ,num.loat))62 #63 #64 # for key in ghost_recv_dict:65 # buffer_shape = ghost_recv_dict[key][0].shape[0]66 # ghost_recv_dict[key].append(num.zeros( (buffer_shape,self.nsys) ,num.float))67 #68 # self.full_send_dict = full_send_dict69 self.ghost_recv_dict = ghost_recv_dict70 54 71 55 # Buffers for synchronisation of timesteps … … 73 57 self.global_timestep = num.zeros(1, num.float) 74 58 75 self.local_timesteps = num.zeros(self.numproc, num. loat)59 self.local_timesteps = num.zeros(self.numproc, num.float) 76 60 77 61 … … 150 134 151 135 import time 136 152 137 #Compute minimal timestep across all processes 153 138 self.local_timestep[0] = self.flux_timestep … … 167 152 for i in range(1, self.numproc): 168 153 pypar.receive(i, 169 buffer=self.local_timestep, 170 bypass=True) 154 buffer=self.local_timestep) 171 155 172 156 if self.local_timestep[0] < self.global_timestep[0]: … … 174 158 else: 175 159 pypar.send(self.local_timestep, 0, 176 use_buffer=True , bypass=True)160 use_buffer=True) 177 161 178 162 … … 187 171 self.communication_broadcast_time += time.time()-t0 188 172 189 #old_timestep = self.flux_timestep173 old_timestep = self.flux_timestep 190 174 self.flux_timestep = self.global_timestep[0] 191 175 #print 'Flux Timestep %15.5e %15.5e P%d_%d' %(self.flux_timestep, old_timestep, self.processor, self.numproc) … … 209 193 # the separate processors 210 194 211 212 from Numeric import take,put 195 import numpy as num 213 196 import time 214 197 t0 = time.time() … … 227 210 #print 'Send',i,q 228 211 Q_cv = self.quantities[q].centroid_values 229 Xout[:,i] = take(Q_cv, Idf) 230 231 pypar.send(Xout, send_proc, 232 use_buffer=True, bypass = True) 212 Xout[:,i] = num.take(Q_cv, Idf) 213 214 pypar.send(Xout, int(send_proc), use_buffer=True) 233 215 234 216 … … 238 220 239 221 Idg = self.ghost_recv_dict[iproc][0] 240 X = self.ghost_recv_dict[iproc][2]241 242 X = pypar.receive(i proc, buffer=X, bypass = True)222 X = self.ghost_recv_dict[iproc][2] 223 224 X = pypar.receive(int(iproc), buffer=X) 243 225 244 226 for i, q in enumerate(self.conserved_quantities): 245 227 #print 'Receive',i,q 246 228 Q_cv = self.quantities[q].centroid_values 247 put(Q_cv, Idg, X[:,i])229 num.put(Q_cv, Idg, X[:,i]) 248 230 249 231 #local update of ghost cells … … 262 244 #print 'LOCAL SEND RECEIVE',i,q 263 245 Q_cv = self.quantities[q].centroid_values 264 put(Q_cv, Idg, take(Q_cv,Idf))246 num.put(Q_cv, Idg, num.take(Q_cv, Idf)) 265 247 266 248 self.communication_time += time.time()-t0 267 249 268 ''' 269 This was removed due to not beening required to be redefined in parallel_shallow_water270 the original "write_time" is good... however might need some small edits to work properly271 with parallel- Nick and Ole April 2007272 def write_time(self):273 if self.min_timestep == self.max_timestep:274 print 'Processor %d/%d, Time = %.4f, delta t = %.8f, steps=%d (%d)'\275 %(self.processor, self.numproc,276 self.time, self.min_timestep, self.number_of_steps,277 self.number_of_first_order_steps)278 elif self.min_timestep > self.max_timestep:279 print 'Processor %d/%d, Time = %.4f, steps=%d (%d)'\280 %(self.processor, self.numproc,281 self.time, self.number_of_steps,282 self.number_of_first_order_steps)283 else:284 print 'Processor %d/%d, Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\285 %(self.processor, self.numproc,286 self.time, self.min_timestep,287 self.max_timestep, self.number_of_steps,288 self.number_of_first_order_steps)289 ''' 250 251 ## This was removed due to not beening required to be redefined in parallel_shallow_water 252 ## the original "write_time" is good... however might need some small edits to work properly 253 ## with parallel- Nick and Ole April 2007 254 ## def write_time(self): 255 ## if self.min_timestep == self.max_timestep: 256 ## print 'Processor %d/%d, Time = %.4f, delta t = %.8f, steps=%d (%d)'\ 257 ## %(self.processor, self.numproc, 258 ## self.time, self.min_timestep, self.number_of_steps, 259 ## self.number_of_first_order_steps) 260 ## elif self.min_timestep > self.max_timestep: 261 ## print 'Processor %d/%d, Time = %.4f, steps=%d (%d)'\ 262 ## %(self.processor, self.numproc, 263 ## self.time, self.number_of_steps, 264 ## self.number_of_first_order_steps) 265 ## else: 266 ## print 'Processor %d/%d, Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\ 267 ## %(self.processor, self.numproc, 268 ## self.time, self.min_timestep, 269 ## self.max_timestep, self.number_of_steps, 270 ## self.number_of_first_order_steps) 271 290 272 291 273 # commented out on the 7/11/06
Note: See TracChangeset
for help on using the changeset viewer.