Changeset 1603
- Timestamp:
- Jul 14, 2005, 10:14:26 AM (19 years ago)
- Location:
- inundation/ga/storm_surge/parallel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/parallel/parallel_shallow_water.py
r1601 r1603 100 100 101 101 self.timestep = min(self.local_timesteps) 102 102 103 pypar.barrier() 103 104 self.communication_broadcast_time += time.time()-t0 104 105 105 106 106 107 107 def update_timestep_2(self, yieldstep, finaltime): 108 109 # Calculate local timestep 108 109 def update_timestep(self, yieldstep, finaltime): 110 """Calculate local timestep 111 """ 112 113 114 #Compute minimal timestep on local process 110 115 Domain.update_timestep(self, yieldstep, finaltime) 111 116 117 118 112 119 import time 113 114 115 120 #Compute minimal timestep across all processes 116 121 self.local_timestep[0] = self.timestep 117 118 119 120 t0 = time.time()121 pypar.reduce(self.local_timestep, pypar.MIN, self.numproc-1,122 buffer=self.global_timestep,123 bypass=True)124 125 126 127 128 129 if self.processor == self.numproc-1:130 pypar.send(self.global_timestep, 0, use_buffer = True, bypass=True)131 132 if self.processor == 0:133 pypar.receive(self.numproc-1, buffer=self.global_timestep,134 bypass=True)135 136 self.communication_reduce_time += time.time()-t0137 138 139 t0 = time.time()140 pypar.broadcast(self.global_timestep, 0,141 bypass=True)142 self.communication_broadcast_time += time.time()-t0143 144 145 self.timestep = self.global_timestep[0]146 147 148 149 #else:150 # #Try using straight send and receives151 # t0 = time.time()152 # self.global_timestep[0] = self.timestep153 #154 # if self.processor == 0:155 # for i in range(1, self.numproc):156 # pypar.receive(i,157 # buffer=self.local_timestep,158 # bypass=True)#159 #160 # if self.local_timestep[0] < self.global_timestep[0]:161 # self.global_timestep[0] = self.local_timestep[0]162 # else:163 # pypar.send(self.local_timestep, 0,164 # use_buffer=True, bypass=True)165 # self.communication_reduce_time += time.time()-t0166 167 168 169 def update_timestep(self, yieldstep, finaltime):170 171 # Calculate local timestep172 Domain.update_timestep(self, yieldstep, finaltime)173 174 import time175 176 177 178 self.local_timestep[0] = self.timestep179 180 181 122 use_reduce_broadcast = True 182 123 if use_reduce_broadcast: … … 185 126 buffer=self.global_timestep, 186 127 bypass=True) 187 self.communication_reduce_time += time.time()-t0188 189 190 128 191 129 192 130 else: 193 # Try using straight send and receives131 #Alternative: Try using straight send and receives 194 132 t0 = time.time() 195 133 self.global_timestep[0] = self.timestep … … 206 144 pypar.send(self.local_timestep, 0, 207 145 use_buffer=True, bypass=True) 208 self.communication_reduce_time += time.time()-t0 146 147 148 149 pypar.barrier() 150 self.communication_reduce_time += time.time()-t0 151 209 152 210 153 211 154 155 #Broadcast minimal timestep to all 212 156 t0 = time.time() 213 157 pypar.broadcast(self.global_timestep, 0, 214 158 bypass=True) 159 160 pypar.barrier() 215 161 self.communication_broadcast_time += time.time()-t0 216 162 … … 219 165 220 166 221 #update_timestep = update_timestep_ 2167 #update_timestep = update_timestep_1 222 168 223 169 def update_ghosts(self): -
inundation/ga/storm_surge/parallel/run_parallel_sw_merimbula.py
r1601 r1603 188 188 # (domain.processor,domain.quantities['stage'].get_integral()) 189 189 190 191 #print 'P%d: That took %.2f seconds' %(myid, time.time()-t0) 192 #print 'P%d: Communication time %.2f seconds' %(myid, domain.communication_time) 193 #print 'P%d: Reduction Communication time %.2f seconds' %(myid, domain.communication_reduce_time) 194 #print 'P%d: Broadcast time %.2f seconds' %(myid, domain.communication_broadcast_time) 195 196 197 190 198 if myid == 0: 191 199 print 'That took %.2f seconds' %(time.time()-t0) … … 193 201 print 'Reduction Communication time %.2f seconds'%domain.communication_reduce_time 194 202 print 'Broadcast time %.2f seconds'%domain.communication_broadcast_time 203
Note: See TracChangeset
for help on using the changeset viewer.