- Timestamp:
- Jan 31, 2012, 10:54:12 AM (12 years ago)
- 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 ANUGA2 Water flowing down a channel3 """4 1 #------------------------------------------------------------------------------ 5 2 # Import necessary modules 6 3 #------------------------------------------------------------------------------ 7 # Import standard shallow water domain and standard boundaries.8 4 import anuga 9 5 import time 10 6 import random 11 7 import subprocess 12 import ex113 8 import csv 14 9 import os 15 10 from anuga.utilities import system_tools, log 16 11 from anuga.abstract_2d_finite_volumes.util import add_directories 17 #------------------------------------------------------------------------------ 18 # Setup computational domain 19 #------------------------------------------------------------------------------ 20 a = [] 12 from anuga.utilities.log_analyser import analyse_log 21 13 14 #-------------------------------------------------------------------------------------- 15 # Set up variables for the correct directories to store the output 16 #-------------------------------------------------------------------------------------- 22 17 home = os.getenv('INUNDATIONHOME') 23 24 25 scenariodir = add_directories(home, ["data","mem_time_test", "parameters", 26 "nothing"]) 18 scenariodir = add_directories(home, ["data","mem_time_test", "parameters","nothing"]) 27 19 file = 'ex1.csv' 28 29 log.log_filename = os.path.join(scenariodir, 'log.txt')30 31 20 file_path = os.path.join(scenariodir, file) 21 store = 'store.txt' 22 file_path_store = os.path.join(scenariodir, store) 32 23 33 24 spamWriter = csv.writer(open(file_path, 'wb')) 25 spamWriter.writerow(['Run Number' , 'Time Taken','Space Used']) 26 e = open(file_path_store,'a') #create the file 27 e.close() 34 28 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 30 for n in range(0,300,1): 36 31 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 37 38 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)]) 47 40 41 print "DONE" 42 43 analyse_log(scenariodir, 'metalog.csv') #get the memory usage from the log files
Note: See TracChangeset
for help on using the changeset viewer.