Ignore:
Timestamp:
Jan 31, 2012, 10:54:12 AM (13 years ago)
Author:
pittj
Message:

formatted the experiment scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_work/development/mem_time_tests/hardware/cairns/runcairns.py

    r8311 r8326  
    1010
    1111Geoscience Australia, 2004-present
     12
     13This has remained unchanged aside from the parallelism added, the resource statistics
     14and the output directories, its also been scaled down so it runs faster
    1215"""
    1316
     
    1922import time
    2023import sys
     24import anuga
     25from anuga_parallel import distribute, myid, numprocs
     26from anuga.abstract_2d_finite_volumes.util import add_directories
     27from anuga.utilities import log
    2128
    22 # Related major packages
    23 import anuga
    24 import liststore
    2529
    2630# Application specific imports
    2731import project                 # Definition of file names and polygons
    2832
    29 from anuga_parallel import distribute, myid, numprocs, finalize, barrier
    30 from anuga.abstract_2d_finite_volumes.util import add_directories
    31 from anuga.utilities import system_tools, log
     33
     34# set up variables for the correct output directories
     35home = os.getenv('INUNDATIONHOME')
     36scenariodir = add_directories(home, ["data", "mem_time_test", "parallel", "cairns"])
     37h = 'CAIRNS.msh'
     38file_pathh = os.path.join(scenariodir, h)
     39store ='store.txt'
     40file_path_store = os.path.join(scenariodir, store)
     41scenariodirV = add_directories(home, ["data","mem_time_test", "parallel",
     42                                       "cairns", "parrallel-" + str(numprocs) +"-"+str(myid)])
     43log.log_filename = os.path.join(scenariodirV, "anuga.log")
     44log._setup = False
    3245
    3346
    34 home2 = os.getenv('INUNDATIONHOME')
    35 
    36 scenariodir2 = add_directories(home2, ["data", "mem_time_test", "parallel", "cairns"])
    37 
    38 h = 'CAIRNS.msh'
    39 file_pathh = os.path.join(scenariodir2, h)
    40 store ='store.txt'
    41 file_path_store = os.path.join(scenariodir2, store)
    42 
    43 
    44 system_tools.MemoryUpdate()
    45 
     47log.resource_usage_timing(prefix = 'BeforeSimulation')#get memory statistics at this point
    4648#------------------------------------------------------------------------------
    4749# Preparation of topographic data
     
    4951#------------------------------------------------------------------------------
    5052# Create DEM from asc data
    51 anuga.asc2dem(os.path.join(scenariodir2, 'cairns.asc'), use_cache=True, verbose=True)
     53anuga.asc2dem(os.path.join(scenariodir, 'cairns.asc'), use_cache=True, verbose=True)
    5254
    5355# Create pts file for onshore DEM
    54 anuga.dem2pts(os.path.join(scenariodir2,'cairns.dem'), use_cache=True, verbose=True)
     56anuga.dem2pts(os.path.join(scenariodir,'cairns.dem'), use_cache=True, verbose=True)
    5557
    5658#------------------------------------------------------------------------------
     
    5860# overall clipping polygon with a tagged
    5961# boundary and interior regions as defined in project.py
     62# (in serial, so the set up only runs once)
    6063#------------------------------------------------------------------------------
    6164if myid == 0:
     
    7780else:
    7881    domain = None
     82
     83log.resource_usage_timing(prefix = 'AfterMesh')#get memory statistics at this point
    7984     
     85#parallel
    8086domain = distribute(domain)
    8187                               
     
    8490#------------------------------------------------------------------------------
    8591domain.set_name('cairns_' + project.scenario) # Name of sww file
    86 domain.set_datadir(scenariodir2)                       # Store sww output here
     92domain.set_datadir(scenariodirV)                       # Store sww output here
    8793domain.set_minimum_storable_height(0.01)      # Store only depth > 1cm
    8894
     
    95101domain.set_quantity('friction', 0.0)
    96102domain.set_quantity('elevation',
    97                     filename=os.path.join(scenariodir2, 'cairns.pts'),
     103                    filename=os.path.join(scenariodir, 'cairns.pts'),
    98104                    use_cache=True,
    99105                    verbose=True,
    100106                    alpha=0.1)
     107log.resource_usage_timing(prefix='afterinitialconditions') #get memory statistics at this point
    101108
    102109#------------------------------------------------------------------------------
     
    138145                         'onshore': Bd,
    139146                         'top': Bd})
    140 
     147log.resource_usage_timing(prefix='afterboundary') #get memory statistics at this point
    141148#------------------------------------------------------------------------------
    142149# Evolve system through time
     
    175182        print domain.boundary_statistics(tags='ocean_east')
    176183           
     184
    177185print 'That took %.2f seconds' %(time.time()-t0)
    178186
    179 liststore.spacelist[myid] = system_tools.MemoryUpdate()[0]
    180 a = sum(liststore.spacelist)
    181 
    182 f = open(file_path_store, 'r+')
    183 f.write(str(a))
    184 
     187log.resource_usage_timing(prefix='aftersimulation') #get memory statistics at this point
Note: See TracChangeset for help on using the changeset viewer.