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

formatted the experiment scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_work/development/mem_time_tests/parameters/nothing/main.py

    r8304 r8326  
    1 """Simple water flow example using ANUGA
    2 Water flowing down a channel
    3 """
    41#------------------------------------------------------------------------------
    52# Import necessary modules
    63#------------------------------------------------------------------------------
    7 # Import standard shallow water domain and standard boundaries.
    84import anuga
    95import time
    106import random
    117import subprocess
    12 import ex1
    138import csv
    149import os
    1510from anuga.utilities import system_tools, log
    1611from anuga.abstract_2d_finite_volumes.util import add_directories
    17 #------------------------------------------------------------------------------
    18 # Setup computational domain
    19 #------------------------------------------------------------------------------
    20 a = []
     12from anuga.utilities.log_analyser import analyse_log
    2113
     14#--------------------------------------------------------------------------------------
     15# Set up variables for the correct directories to store the output
     16#--------------------------------------------------------------------------------------
    2217home = os.getenv('INUNDATIONHOME')
    23 
    24 
    25 scenariodir = add_directories(home, ["data","mem_time_test", "parameters",
    26                                      "nothing"])
     18scenariodir = add_directories(home, ["data","mem_time_test", "parameters","nothing"])
    2719file = 'ex1.csv'
    28 
    29 log.log_filename = os.path.join(scenariodir, 'log.txt')
    30 
    3120file_path = os.path.join(scenariodir, file)
     21store = 'store.txt'
     22file_path_store = os.path.join(scenariodir, store)
    3223
    3324spamWriter = csv.writer(open(file_path, 'wb'))
     25spamWriter.writerow(['Run Number' , 'Time Taken','Space Used'])
     26e = open(file_path_store,'a') #create the file
     27e.close()
    3428
    35 spamWriter.writerow(['Run Number' , 'Time Taken','Space Used'])
     29#main loop, that stores the current run number so that unique folders exist for the information
     30for n in range(0,300,1):
    3631
     32    e = open(file_path_store,'r+')
     33    e.write(str(n)) #store the run number
     34   
     35    x = time.clock() #time it
     36    subprocess.call(['python2.5', 'ex1.py']) #run script
     37    y = time.clock() #time it
    3738
    38 for n in range(0,300,1):
    39     system_tools.MemoryUpdate()
    40     x = time.clock()
    41     ex1.runex()
    42     y = time.clock()
    43     d = system_tools.MemoryUpdate()[0]
    44     spamWriter.writerow([n ,(y-x),d])
    45     a.append((n,y-x,d))
    46 print a
     39    spamWriter.writerow([n ,(y-x)])
    4740
     41print "DONE"
     42
     43analyse_log(scenariodir, 'metalog.csv') #get the memory usage from the log files
Note: See TracChangeset for help on using the changeset viewer.