Ignore:
Timestamp:
Jul 7, 2005, 5:02:56 PM (19 years ago)
Author:
steve
Message:

Sped up communications with numeric put and take commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/parallel/parallel_shallow_water.py

    r1575 r1588  
    108108
    109109
     110        from Numeric import take,put
    110111        import time
    111112        t0 = time.time()
     
    125126                        Xout = self.full_send_dict[send_proc][2]
    126127
    127                         N = len(Idf)
    128 
    129                         for i in range(N):
    130                             Xout[i,0] = stage_cv[Idf[i]]
    131                             Xout[i,1] = xmomentum_cv[Idf[i]]
    132                             Xout[i,2] = ymomentum_cv[Idf[i]]
    133 
     128                        Xout[:,0] = take(stage_cv,     Idf)
     129                        Xout[:,1] = take(xmomentum_cv, Idf)
     130                        Xout[:,2] = take(ymomentum_cv, Idf)
    134131
    135132                        pypar.send(Xout,send_proc)
     
    144141
    145142                    X = pypar.receive(iproc,X)
    146                     N = len(Idg)
    147143
    148                     for i in range(N):
    149                         stage_cv[Idg[i]]     = X[i,0]
    150                         xmomentum_cv[Idg[i]] = X[i,1]
    151                         ymomentum_cv[Idg[i]] = X[i,2]
    152 
     144                    put(stage_cv,     Idg, X[:,0])
     145                    put(xmomentum_cv, Idg, X[:,1])
     146                    put(ymomentum_cv, Idg, X[:,2])
    153147
    154148        #local update of ghost cells
     
    164158            Idg = self.ghost_recv_dict[iproc][0]
    165159
    166             N = len(Idg)
    167 
    168             for i in range(N):
    169                 stage_cv[Idg[i]]     = stage_cv[Idf[i]]
    170                 xmomentum_cv[Idg[i]] = xmomentum_cv[Idf[i]]
    171                 ymomentum_cv[Idg[i]] = ymomentum_cv[Idf[i]]
     160            put(stage_cv,     Idg, take(stage_cv,     Idf))
     161            put(xmomentum_cv, Idg, take(xmomentum_cv, Idf))
     162            put(ymomentum_cv, Idg, take(ymomentum_cv, Idf))
    172163
    173164        self.communication_time += time.time()-t0
     
    203194            #Pass control on to outer loop for more specific actions
    204195            yield(t)
    205 
Note: See TracChangeset for help on using the changeset viewer.