Changeset 4237


Ignore:
Timestamp:
Feb 7, 2007, 4:38:38 PM (18 years ago)
Author:
duncan
Message:

adding profiling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/loading_pts_test.py

    r4216 r4237  
    4949bathymetry_filename=project.bathymetry_filename
    5050print 'Starting domain.set_quantity.  Loading ', bathymetry_filename
    51 domain.set_quantity('elevation',
    52                     filename=bathymetry_filename,
    53                     alpha=0.02,                   
    54                     verbose=True,
    55                     use_cache=False)
     51s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=False)"
     52
     53
     54import profile, pstats
     55FN = 'profile.dat'
     56
     57profile.run(s, FN)
    5658
    5759print 'Set_quantity elevation took %.2f seconds' %(time.time()-t0)
    58 import sys; sys.exit()
    5960
    60 #-------------------------
    61 # Distribute domain if run in parallel
    62 #-------------------------
    63 if numprocs > 1:
    64     domain = distribute(domain)
     61S = pstats.Stats(FN)
     62#S.sort_stats('time').print_stats(20)
     63s = S.sort_stats('cumulative').print_stats(30)
    6564
    66 
    67 #-------------------------
    68 # Set simulation parameters
    69 #-------------------------
    70 domain.set_name(project.output_filename)  # Name of output sww file
    71 domain.set_default_order(2)               # Apply second order scheme
    72 domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
    73 domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
    74 domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
    75 
    76 
    77 #-------------------------
    78 # Boundary Conditions
    79 #-------------------------
    80 
    81 # Create boundary function from timeseries provided in file
    82 function = file_function(project.boundary_filename,
    83                          domain, verbose=True)
    84 
    85 # Create and assign boundary objects
    86 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
    87 Br = Reflective_boundary(domain)
    88 domain.set_boundary({'wave': Bts, 'wall': Br})
    89 
    90 
    91 #-------------------------
    92 # Evolve through time
    93 #-------------------------
    94 import time
    95 t0 = time.time()
    96 
    97 for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
    98     domain.write_time()
    99 
    100 print 'That took %.2f seconds' %(time.time()-t0)
     65print s
Note: See TracChangeset for help on using the changeset viewer.