Changeset 1588


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

Sped up communications with numeric put and take commands

Location:
inundation/ga/storm_surge
Files:
4 edited

Legend:

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

    r1575 r1588  
    8181        ltimestep = ones( 1, Float )
    8282        ltimestep[0] = self.timestep
    83 
    8483        gtimestep = zeros( 1, Float) # Buffer for results
    8584
     
    9998        # the separate processors
    10099
     100        from Numeric import take,put
    101101        import time
    102102        t0 = time.time()
     
    116116                        N = len(Idf)
    117117
    118                         for i in range(N):
    119                             Xout[i,0] = stage_cv[Idf[i]]
     118                        #for i in range(N):
     119                        #    Xout[i,0] = stage_cv[Idf[i]]
     120                        Xout[:,0] = take(stage_cv, Idf)
    120121
    121122                        pypar.send(Xout,send_proc)
     
    134135                    N = len(Idg)
    135136
    136 
    137                     for i in range(N):
    138                         stage_cv[Idg[i]] = X[i,0]
     137                    put(stage_cv, Idg, X[:,0])
     138                    #for i in range(N):
     139                    #    stage_cv[Idg[i]] = X[i,0]
    139140
    140141
     
    153154            N = len(Idg)
    154155
    155             for i in range(N):
    156                 #print i,Idg[i],Idf[i]
    157                 stage_cv[Idg[i]] = stage_cv[Idf[i]]
     156            #for i in range(N):
     157            #    #print i,Idg[i],Idf[i]
     158            #    stage_cv[Idg[i]] = stage_cv[Idf[i]]
    158159
    159 
     160            put(stage_cv, Idg, take(stage_cv, Idf))
    160161
    161162
  • 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 
  • inundation/ga/storm_surge/parallel/run_parallel_sw_merimbula.py

    r1585 r1588  
    145145                         ghost_recv_dict = ghost_recv_dict)
    146146
    147 domain.initialise_visualiser(rect=rect,scale_z =0.1)
     147#domain.initialise_visualiser(rect=rect,scale_z =0.1)
    148148#domain.initialise_visualiser(rect=rect)
    149149domain.visualise_color_stage = True
     
    175175    if myid == 0:
    176176        domain.write_time()
    177         print domain.quantities['stage'].get_integral()
     177        print 'Processor %d, Integral of stage %d'%\
     178               (domain.processor,domain.quantities['stage'].get_integral())
    178179
    179180if myid == 0:
    180181    print 'That took %.2f seconds' %(time.time()-t0)
     182    print 'Communication time %.2f seconds'%domain.communication_time
     183    print 'Reduction Communication time %.2f seconds'%domain.communication_reduce_time
Note: See TracChangeset for help on using the changeset viewer.