Changeset 2654


Ignore:
Timestamp:
Apr 4, 2006, 10:15:01 AM (18 years ago)
Author:
linda
Message:

Added routines to print domain stats in parallel

Location:
inundation/parallel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/run_parallel_advection.py

    r2625 r2654  
    1010import pypar
    1111
    12 from config import g, epsilon
    13 from Numeric import allclose, array, zeros, ones, Float
     12from print_stats import print_test_stats, build_full_flag
     13
    1414from parallel_meshes import parallel_rectangle
    1515
    16 from advection import Domain
    1716from parallel_advection import Parallel_Domain
    18 from parallel_advection import Transmissive_boundary, Dirichlet_boundary
     17from parallel_advection import Transmissive_boundary
    1918
    20 numprocs = pypar.size()
    21 myid = pypar.rank()
    22 processor_name = pypar.Get_processor_name()
    23 
    24 
    25 #N = 50
    26 N = 20
    27 M = 20
    28 
    29 points, vertices, boundary, full_send_dict, ghost_recv_dict =  \
    30     parallel_rectangle(N, M, len1_g=1.0)
    31 
    32 #Create advection domain with direction (1,-1)
    33 domain = Parallel_Domain(points, vertices, boundary,
    34                          full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0])
    35 
    36 # Initial condition is zero by default
    37 
    38 #turn on the visualisation
    39 rect = [0.0, 0.0, 1.0, 1.0]
    40 domain.initialise_visualiser(rect=rect)
    41 
    42 #Boundaries
    43 T = Transmissive_boundary(domain)
    44 D = Dirichlet_boundary(array([1.0]))
    45 
    46 domain.default_order = 2
    47 
    48 domain.set_boundary( {'left': T, 'right': T, 'bottom': T, 'top': T, 'ghost': None} )
    49 domain.check_integrity()
     19# Define the inititial conditions
    5020
    5121class Set_Stage:
     
    6131        return self.h*((x>self.x0)&(x<self.x1))
    6232
     33# Get information about the parallel set-up
     34
     35numprocs = pypar.size()
     36myid = pypar.rank()
     37processor_name = pypar.Get_processor_name()
     38
     39N = 20
     40M = 20
     41
     42# Build 1*1 domain containing M*N nodes split over numprocs * 1 processors
     43
     44points, vertices, boundary, full_send_dict, ghost_recv_dict =  \
     45    parallel_rectangle(N, M, len1_g=1.0)
     46
     47# Create advection domain with direction (1,-1)
     48# Initial condition is zero by default
     49
     50domain = Parallel_Domain(points, vertices, boundary,
     51                         full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0])
     52
     53# Make a notes of which triangles are full and which are ghost
     54
     55tri_full_flag = build_full_flag(domain, ghost_recv_dict)
     56
     57# Turn on the visualisation
     58
     59rect = [0.0, 0.0, 1.0, 1.0]
     60domain.initialise_visualiser(rect=rect)
     61
     62# Boundaries
     63
     64T = Transmissive_boundary(domain)
     65domain.default_order = 2
     66domain.set_boundary( {'left': T, 'right': T, 'bottom': T, 'top': T, 'ghost': None} )
     67
     68# Ensure that the domain definitions make sense
     69
     70domain.check_integrity()
     71
     72# Set the inititial conditions
     73
    6374domain.set_quantity('stage', Set_Stage(0.2,0.4,1.0))
     75
     76# Let processor 0 output some timing information
    6477
    6578if myid == 0:
     
    6780    t0 = time.time()
    6881
    69 #Check that the boundary value gets propagated to all elements
     82# Start the parallel computions
     83
    7084for t in domain.evolve(yieldstep = 0.1, finaltime = 3.0):
    7185    if myid == 0:
    7286        domain.write_time()
     87    print_test_stats(domain, tri_full_flag)
     88
     89# Output some computation statistics
    7390
    7491if myid == 0:
  • inundation/parallel/run_parallel_merimbula.py

    r2625 r2654  
    4747#from shallow_water import Domain
    4848
     49from print_stats import print_test_stats, build_full_flag
     50
    4951from pmesh2domain import pmesh_to_domain_instance
    5052from advection import Domain as Advection_Domain
     
    5254
    5355from generic_boundary_conditions import Transmissive_boundary
     56
    5457# mesh partition routines
    5558
     
    133136                                   velocity = [0.1,0.0])
    134137
     138# Make a notes of which triangles are full and which are ghost
     139
     140tri_full_flag = build_full_flag(domain, ghost_recv_dict)
     141
    135142#domain.initialise_visualiser(rect=rect)
    136143
     
    169176    if myid == 0:
    170177        domain.write_time()
    171 ##    Stage = domain.quantities['stage']
    172 ##    max_stage = max(max(Stage.edge_values))
    173 ##    print max_stage
    174 ##    if max_stage > 4.0:
    175 ##        print "######################", max_stage
     178    print_test_stats(domain, tri_full_flag)
    176179
    177180if myid == 0:
  • inundation/parallel/run_parallel_sw_merimbula.py

    r2152 r2654  
    4242sys.path.append('..'+sep+'pyvolution')
    4343
     44# Print debugging information
     45
     46from print_stats import print_test_stats, build_full_flag
     47
    4448# Numeric arrays
    4549
     
    191195    print 'No visualiser'
    192196
     197# Make a note of which triangles are full and which are ghost
     198
     199tri_full_flag = build_full_flag(domain, ghost_recv_dict)
    193200
    194201domain.default_order = 1
     
    199206T = Transmissive_boundary(domain)
    200207R = Reflective_boundary(domain)
    201 domain.set_boundary( {'outflow': R, 'inflow': R, 'inner':R, 'exterior': R, 'open':R} )
     208domain.set_boundary( {'outflow': R, 'inflow': R, 'inner':R, 'exterior': R, 'open':R, 'ghost':None} )
    202209
    203210
     
    222229    if myid == 0:
    223230        domain.write_time()
    224         #print 'Processor %d, Integral of stage %d'%\
    225         #       (domain.processor,domain.quantities['stage'].get_integral())
    226 
    227 
    228 #print 'P%d: That took %.2f seconds' %(myid, time.time()-t0)
    229 #print 'P%d: Communication time %.2f seconds' %(myid, domain.communication_time)
    230 #print 'P%d: Reduction Communication time %.2f seconds' %(myid, domain.communication_reduce_time)
    231 #print 'P%d: Broadcast time %.2f seconds' %(myid, domain.communication_broadcast_time)
     231    print_test_stats(domain, tri_full_flag)
     232
    232233
    233234
  • inundation/parallel/run_parallel_sw_merimbula_metis.py

    r2198 r2654  
    4949from Numeric import array, zeros, Float
    5050
     51# Print debugging information
     52
     53from print_stats import print_test_stats, build_full_flag
     54
    5155# pmesh
    5256
     
    171175                         ghost_recv_dict = ghost_recv_dict)
    172176
     177# Make a note of which triangles are full and which are ghost
     178
     179tri_full_flag = build_full_flag(domain, ghost_recv_dict)
    173180
    174181#try:
     
    218225        #print 'Processor %d, Integral of stage %d'%\
    219226        #       (domain.processor,domain.quantities['stage'].get_integral())
     227        #    print_test_stats(domain, tri_full_flag)
     228
    220229
    221230# Profiling
     
    230239  if myid == 0:
    231240    domain.write_time()
     241  print_test_stats(domain, tri_full_flag)
     242
    232243'''
    233244result = profiler.runctx(s, globals(), locals())
  • inundation/parallel/run_parallel_sw_rectangle.py

    r2625 r2654  
    2525# pmesh
    2626
    27 #from shallow_water import Domain
     27from print_stats import print_test_stats, build_full_flag
    2828
    2929from shallow_water import Domain
     
    5757                         full_send_dict  = full_send_dict,
    5858                         ghost_recv_dict = ghost_recv_dict)
     59
     60# Make a notes of which triangles are full and which are ghost
     61
     62tri_full_flag = build_full_flag(domain, ghost_recv_dict)
    5963
    6064print 'number of triangles = ', domain.number_of_elements
     
    112116    if myid == 0:
    113117        domain.write_time()
     118    print_test_stats(domain, tri_full_flag)
    114119
    115120if myid == 0:
Note: See TracChangeset for help on using the changeset viewer.