Changeset 8328
- Timestamp:
- Feb 2, 2012, 1:08:40 PM (13 years ago)
- Location:
- trunk/anuga_work/development/mem_time_tests
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/mem_time_tests/hardware/cairns/main.py
r8326 r8328 22 22 file_path = os.path.join(scenariodir, file1) 23 23 24 spamWriter = csv.writer(open(file_path, 'wb')) 25 spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken s']) 24 firstex1 = open(file_path, 'wb') 25 spamWriter = csv.writer(firstex1) 26 spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken (s)']) 26 27 27 28 … … 48 49 print 'DONE' 49 50 50 analyse_log(scenariodir, 'metalog.csv') # interrogate log files for the memory usage information 51 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 52 53 #close ex1.csv so we can read from it for a different csv reader object 54 firstex1.close() 55 56 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 57 ex1 = csv.reader(open(file_path,'rb')) 58 metalog = csv.reader(open(meta_path,'rb')) 59 final = csv.writer(open(final_path,'wb')) 60 61 62 for row in ex1: 63 d = metalog.next() 64 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/hardware/template/main.py
r8326 r8328 22 22 file1 = 'ex1.csv' 23 23 file_path = os.path.join(scenariodir, file1) 24 spamWriter = csv.writer(open(file_path, 'wb')) 25 spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken s','Total Space']) 24 25 firstex1 = open(file_path, 'wb') 26 spamWriter = csv.writer(firstex1) 27 spamWriter.writerow(['Number Of Processors' ,'Time Taken (s)']) 26 28 27 29 … … 50 52 print 'Done' 51 53 52 analyse_log(scenariodir, 'metalog.csv') #get all the memory usage statistics 54 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 55 56 #close ex1.csv so we can read from it for a different csv reader object 57 firstex1.close() 58 59 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 60 ex1 = csv.reader(open(file_path,'rb')) 61 metalog = csv.reader(open(meta_path,'rb')) 62 final = csv.writer(open(final_path,'wb')) 63 64 65 for row in ex1: 66 d = metalog.next() 67 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/parameters/nothing/ex1.py
r8326 r8328 5 5 import time 6 6 import os 7 import sys 7 8 from anuga.utilities import log 8 9 from anuga.abstract_2d_finite_volumes.util import add_directories 9 10 10 #set up the variables to correctly store the temporary data 11 #set up the variables to correctly store the output data and log file 12 n = sys.argv[1] 11 13 home = os.getenv('INUNDATIONHOME') 12 scenariodir = add_directories(home, ["data","mem_time_test", "parameters","nothing"])13 store ='store.txt'14 file_path_store = os.path.join(scenariodir, store)15 16 #get the run number from the store text file17 f = open(file_path_store,'r+')18 n = float(f.readline())19 f.close()20 21 #set up the variables to correctly store the output data and log file22 14 scenariodirV = add_directories(home, ["data","mem_time_test", "parameters", 23 15 "nothing","nothing"+"-"+str(n)]) … … 34 26 35 27 domain.set_name('channel1') # Output name 36 domain.set_datadir(scenariodir )28 domain.set_datadir(scenariodirV) 37 29 38 30 log.resource_usage_timing(prefix = 'AfterMesh') #get memory usage here -
trunk/anuga_work/development/mem_time_tests/parameters/nothing/main.py
r8326 r8328 19 19 file = 'ex1.csv' 20 20 file_path = os.path.join(scenariodir, file) 21 store = 'store.txt' 22 file_path_store = os.path.join(scenariodir, store) 21 meta = 'metalog.csv' 22 meta_path = os.path.join(scenariodir, meta) 23 final = 'final.csv' 24 final_path = os.path.join(scenariodir, final) 23 25 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()26 #set up needed files 27 firstex1 = open(file_path, 'wb') 28 spamWriter = csv.writer(firstex1) 29 spamWriter.writerow(['Run Number' , 'Time Taken(s)','Space Used']) 28 30 29 31 #main loop, that stores the current run number so that unique folders exist for the information 30 32 for n in range(0,300,1): 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 33 34 x = time.time() #time it 35 subprocess.call(['python2.5', 'ex1.py' ,str(n)]) #run script 36 y = time.time() #time it 38 37 39 38 spamWriter.writerow([n ,(y-x)]) … … 41 40 print "DONE" 42 41 43 analyse_log(scenariodir, 'metalog.csv') #get the memory usage from the log files 42 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 43 44 #close ex1.csv so we can read from it for a different csv reader object 45 firstex1.close() 46 47 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 48 ex1 = csv.reader(open(file_path,'rb')) 49 metalog = csv.reader(open(meta_path,'rb')) 50 final = csv.writer(open(final_path,'wb')) 51 52 53 for row in ex1: 54 d = metalog.next() 55 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/parameters/timelen-over-timestep/ex1.py
r8326 r8328 4 4 import anuga 5 5 import time 6 import random7 6 import os 7 import sys 8 8 from anuga.abstract_2d_finite_volumes.util import add_directories 9 9 from anuga.utilities import log 10 10 11 #set up variables to store the temporary data 11 #set up variables to store the data and the log files 12 g = sys.argv[1] 13 h = sys.argv[2] 12 14 home = os.getenv('INUNDATIONHOME') 13 scenariodir = add_directories(home, ["data","mem_time_test", "parameters",14 "timelen-over-timestep"])15 store ='store.txt'16 file_path_store = os.path.join(scenariodir, store)17 storen ='storen.txt'18 file_path_storen = os.path.join(scenariodir, storen)19 20 #get the time length and time step from the text files21 f = open(file_path_store,'r+')22 g = float(f.readline())23 f.close()24 f = open(file_path_storen,'r+')25 h = float(f.readline())26 f.close()27 28 #set up variables to store the data and the log files29 15 scenariodirV = add_directories(home, ["data","mem_time_test", "parameters", 30 16 "timelen-over-timestep", "TT-" + str(g) +"-"+ str(h)]) 31 17 log.log_filename = os.path.join(scenariodirV, "anuga.log") 32 18 log._setup = False 33 34 19 35 20 log.resource_usage_timing(prefix = 'BeforeSimulation') #get memory usage here -
trunk/anuga_work/development/mem_time_tests/parameters/timelen-over-timestep/main.py
r8326 r8328 21 21 file = 'ex1.csv' 22 22 file_path = os.path.join(scenariodir, file) 23 spamWriter = csv.writer(open(file_path, 'wb')) 24 spamWriter.writerow(['Time Length', 'Time Step' , 'Time Taken','Space Used']) 25 store ='store.txt' 26 file_path_store = os.path.join(scenariodir, store) 27 storen ='storen.txt' 28 file_path_storen = os.path.join(scenariodir, storen) 23 meta = 'metalog.csv' 24 meta_path = os.path.join(scenariodir, meta) 25 final = 'final.csv' 26 final_path = os.path.join(scenariodir, final) 29 27 30 28 #create each file 31 e = open(file_path_store,'a') 32 e.close() 33 e = open(file_path_storen,'a') 34 e.close() 35 36 29 firstex1 = open(file_path, 'wb') 30 spamWriter = csv.writer(firstex1) 31 spamWriter.writerow(['Time Length(s)','Time Step (s)' , 'Time Taken','Space Used']) 37 32 38 33 # main loops that give the time length (m) and the time step (n) … … 40 35 41 36 for n in range(1,1000,5): 42 n = n/100 0.0 #adjust it so its small enough to see the nature of the relationship37 n = n/100.0 #adjust it so its small enough to see the nature of the relationship 43 38 44 #write to file 45 s = open(file_path_store,'r+') 46 s.write(str(float(m))) 47 t = open(file_path_storen,'r+') 48 t.write(str(n)) 49 50 x = time.clock()#time it 51 subprocess.call(['python2.5', 'ex1.py'])#run it 52 y = time.clock()#time it 39 x = time.time()#time it 40 subprocess.call(['python2.5', 'ex1.py',str(m),str(n)])#run it 41 y = time.time()#time it 53 42 spamWriter.writerow([m,n ,(y-x),'b'])#write the results 54 43 55 44 print 'Done' 56 45 57 analyse_log(scenariodir, 'metalog.csv')#get the memory usage statistics from the log files 46 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 47 48 #close ex1.csv so we can read from it for a different csv reader object 49 firstex1.close() 50 51 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 52 ex1 = csv.reader(open(file_path,'rb')) 53 metalog = csv.reader(open(meta_path,'rb')) 54 final = csv.writer(open(final_path,'wb')) 55 56 57 for row in ex1: 58 d = metalog.next() 59 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/parameters/timelen/ex1.py
r8326 r8328 5 5 import time 6 6 import os 7 import sys 7 8 from anuga.abstract_2d_finite_volumes.util import add_directories 8 9 from anuga.utilities import log 9 10 10 #set up variables for the temporary data files 11 #set up variables to store the results and the log files of each experiment 12 f = sys.argv[1] 11 13 home = os.getenv('INUNDATIONHOME') 12 scenariodir = add_directories(home, ["data","mem_time_test", "parameters",13 "timelength"])14 store ='store.txt'15 file_path_store = os.path.join(scenariodir, store)16 17 #get the time length from the store text file18 s = open(file_path_store,'r+')19 f = float(s.readline())20 s.close()21 22 #set up variables to store the results and the log files of each experiment23 14 scenariodirV = add_directories(home, ["data","mem_time_test", "parameters", 24 15 "timelength", "timelength-" + str(f)]) -
trunk/anuga_work/development/mem_time_tests/parameters/timelen/main.py
r8326 r8328 20 20 file = 'ex1.csv' 21 21 file_path = os.path.join(scenariodir, file) 22 store ='store.txt' 23 file_path_store = os.path.join(scenariodir, store) 22 meta = 'metalog.csv' 23 meta_path = os.path.join(scenariodir, meta) 24 final = 'final.csv' 25 final_path = os.path.join(scenariodir, final) 24 26 25 spamWriter = csv.writer(open(file_path, 'wb')) 26 spamWriter.writerow(['Time Length(s)' , 'Time Taken(s)', 'Space Used'])27 e = open(file_path_store,'a')28 e.close()27 #set up needed files 28 firstex1 = open(file_path, 'wb') 29 spamWriter = csv.writer(firstex1) 30 spamWriter.writerow(['Time Length (s)' , 'Time Taken (s)','Space Used']) 29 31 30 32 #main loop that does the same experiment with different time lengths 31 for n in range(1,1000 00,100):33 for n in range(1,1000,100): 32 34 33 h = open(file_path_store,'r+') 34 h.write(str(n)) #store the time length 35 36 x = time.clock() #time it 37 subprocess.call(['python2.5', 'ex1.py']) #run script 38 y = time.clock() #time it 35 x = time.time() #time it 36 subprocess.call(['python2.5', 'ex1.py', str(n)]) #run script 37 y = time.time() #time it 39 38 spamWriter.writerow([n ,(y-x)]) #write results 40 39 41 40 print 'Done' 42 41 43 #get the memory usage from the log files of each run 44 analyse_log(scenariodir, 'metalog.csv') 42 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 43 44 #close ex1.csv so we can read from it for a different csv reader object 45 firstex1.close() 46 47 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 48 ex1 = csv.reader(open(file_path,'rb')) 49 metalog = csv.reader(open(meta_path,'rb')) 50 final = csv.writer(open(final_path,'wb')) 51 52 53 for row in ex1: 54 d = metalog.next() 55 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/parameters/timestep/ex1.py
r8326 r8328 5 5 import anuga 6 6 import time 7 import random7 import sys 8 8 import os 9 9 from anuga.abstract_2d_finite_volumes.util import add_directories 10 10 from anuga.utilities import log 11 11 12 #set up the variables for the temporary file directories 12 #set up the variables for the log files and data directories 13 f = sys.argv[1] 13 14 home = os.getenv('INUNDATIONHOME') 14 scenariodir = add_directories(home, ["data","mem_time_test", "parameters","timestep"])15 16 store ='store.txt'17 file_path_store = os.path.join(scenariodir, store)18 19 s = open(file_path_store,'r+') # read the timestep from the text file20 f = float(s.readline())21 s.close()22 23 #set up the variables for the log files and data directories24 15 scenariodirV = add_directories(home, ["data","mem_time_test", "parameters", 25 16 "timestep", "timestep-" + str(f)]) -
trunk/anuga_work/development/mem_time_tests/parameters/timestep/main.py
r8326 r8328 19 19 file = 'ex1.csv' 20 20 file_path = os.path.join(scenariodir, file) 21 store ='store.txt' 22 file_path_store = os.path.join(scenariodir, store) 21 meta = 'metalog.csv' 22 meta_path = os.path.join(scenariodir, meta) 23 final = 'final.csv' 24 final_path = os.path.join(scenariodir, final) 23 25 24 spamWriter = csv.writer(open(file_path, 'wb')) 25 spamWriter.writerow(['TimeStep' , 'Time Taken','Space Used']) 26 27 e = open(file_path_store,'a') # create file 28 e.close() 26 #set up needed files 27 firstex1 = open(file_path, 'wb') 28 spamWriter = csv.writer(firstex1) 29 spamWriter.writerow(['Time Step (s)' , 'Time Taken','Space Used']) 29 30 30 31 #main loop that runs the script with different time steps (yield steps) 31 32 for n in range(1,10000,10): 33 32 34 n = n/100.0 # get it in the right range 33 34 g = open(file_path_store,'r+') 35 g.write(str(n)) #write the time step to the file 36 37 x = time.clock()#time it 38 subprocess.call(['python2.5', 'ex1.py']) # run it 39 y = time.clock() #time it 35 x = time.time()#time it 36 subprocess.call(['python2.5', 'ex1.py',str(n)]) # run it 37 y = time.time() #time it 40 38 spamWriter.writerow([n ,(y-x),'b']) #record results 41 39 42 40 print 'Done' 43 41 44 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files 42 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 43 44 #close ex1.csv so we can read from it for a different csv reader object 45 firstex1.close() 46 47 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 48 ex1 = csv.reader(open(file_path,'rb')) 49 metalog = csv.reader(open(meta_path,'rb')) 50 final = csv.writer(open(final_path,'wb')) 51 52 53 for row in ex1: 54 d = metalog.next() 55 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/scenarios/channelflow/ex1.py
r8326 r8328 4 4 import anuga 5 5 import time 6 import random6 import sys 7 7 import os 8 8 from anuga.abstract_2d_finite_volumes.util import add_directories 9 9 from anuga.utilities import log 10 10 11 #set up the variables for the temporary storage files 11 #set up variables to store the experiment data and the log file 12 length = sys.argv[1] 13 lower = sys.argv[2] 14 12 15 home = os.getenv('INUNDATIONHOME') 13 scenariodir = add_directories(home, ["data","mem_time_test", "scenarios",14 "channelflow"])15 store = 'store.txt'16 file_path_store = os.path.join(scenariodir, store)17 storen = 'storen.txt'18 file_path_storen = os.path.join(scenariodir, storen)19 20 #read the percentage of water coverage and the length of the boundary21 f = open(file_path_store,'r+')22 length = float(f.readline())23 f.close()24 f = open(file_path_storen,'r+')25 lower = float(f.readline())26 f.close()27 28 #set up variables to store the experiment data and the log file29 16 scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios", 30 17 "channelflow", "channelflow-" + str(lower) +"-"+ str(length)]) … … 36 23 # Setup computational domain 37 24 #------------------------------------------------------------------------------ 38 points, vertices, boundary = anuga.rectangular_cross( 100,300,len1=length, len2=length) # Mesh25 points, vertices, boundary = anuga.rectangular_cross(50,150,len1=length, len2=length) # Mesh 39 26 domain = anuga.Domain(points, vertices, boundary) # Create domain 40 domain.set_datadir(scenariodir )27 domain.set_datadir(scenariodirV) 41 28 domain.set_name('channel1.sww') # Output name 42 29 -
trunk/anuga_work/development/mem_time_tests/scenarios/channelflow/main.py
r8326 r8328 17 17 scenariodir = add_directories(home, ["data","mem_time_test", "scenarios", 18 18 "channelflow"]) 19 store ='store.txt'20 file_path_store = os.path.join(scenariodir, store)21 storen ='storen.txt'22 file_path_storen = os.path.join(scenariodir, storen)23 19 file = 'ex1.csv' 24 20 file_path = os.path.join(scenariodir, file) 21 meta = 'metalog.csv' 22 meta_path = os.path.join(scenariodir, meta) 23 final = 'final.csv' 24 final_path = os.path.join(scenariodir, final) 25 25 26 #set up the output files 27 spamWriter = csv.writer(open(file_path, 'wb')) 28 spamWriter.writerow(['Length','Stage','Time','Space']) 29 e = open(file_path_store,'a') 30 e.close() 31 e = open(file_path_storen,'a') 32 e.close() 26 #set up needed files 27 firstex1 = open(file_path, 'wb') 28 spamWriter = csv.writer(firstex1) 29 spamWriter.writerow(['Side Lenght(m)','Percentage Of Water Coverage' , 'Time Taken(s)','Space Used']) 33 30 34 31 #the main loops that give the length of the inflow boundary (i) and the place to begin the step (n) 35 for i in range(1 00,100000,10000):36 for n in range( 1,i/10,i/100):32 for i in range(1,1000,100): 33 for n in range(0,110,10): 37 34 38 35 #adjust 39 i = i /100.0 40 n = n/10.0 41 42 #write these values to files 43 g = open(file_path_store,'r+') 44 g.write(str(i)) 45 h = open(file_path_storen,'r+') 46 h.write(str(n)) 36 n = n*(i/100.0) 47 37 48 38 z = time.time() #time it 49 subprocess.call(['python2.5', 'ex1.py' ])#run the script39 subprocess.call(['python2.5', 'ex1.py',str(i),str(n)])#run the script 50 40 y = time.time() #time it 51 41 52 spamWriter.writerow([i,n ,(y-z), 'b'])#record it42 spamWriter.writerow([i,n/(i/100.0),(y-z), 'b'])#record it 53 43 print 'DONE' 54 44 55 analyse_log(scenariodir, 'metalog.csv')#get the memory usage statistics from the various log files 45 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 46 47 #close ex1.csv so we can read from it for a different csv reader object 48 firstex1.close() 49 50 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 51 ex1 = csv.reader(open(file_path,'rb')) 52 metalog = csv.reader(open(meta_path,'rb')) 53 final = csv.writer(open(final_path,'wb')) 54 55 56 for row in ex1: 57 d = metalog.next() 58 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/scenarios/stage/ex1.py
r8326 r8328 4 4 import anuga 5 5 import time 6 import random6 import sys 7 7 import os 8 8 from anuga.abstract_2d_finite_volumes.util import add_directories 9 9 from anuga.utilities import log 10 10 11 #set up the variables for the temporary data storage 11 #set up variables to store the output of the simulation and the log files 12 l = float(sys.argv[1]) 13 tide = sys.argv[2] 14 12 15 home = os.getenv('INUNDATIONHOME') 13 scenariodir = add_directories(home, ["data","mem_time_test", "scenarios",14 "stage"])15 store = 'store.txt'16 file_path_store = os.path.join(scenariodir, store)17 storen = 'storen.txt'18 file_path_storen = os.path.join(scenariodir, storen)19 20 #read the values from the text files21 f = open(file_path_store,'r+')22 l = float(f.readline())23 f.close()24 f = open(file_path_storen,'r+')25 tide = float(f.readline())26 f.close()27 28 #set up variables to store the output of the simulation and the log files29 16 scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios", 30 17 "stage", "stage-" + str(tide) +"-"+ str(l)]) … … 37 24 #------------------------------------------------------------------------------ 38 25 points, vertices, boundary = anuga.rectangular_cross(100,300, 39 len1=l, len2=(l/2 )) # Mesh26 len1=l, len2=(l/2.0)) # Mesh 40 27 domain = anuga.Domain(points, vertices, boundary) # Create domain 41 28 domain.set_datadir(scenariodirV) -
trunk/anuga_work/development/mem_time_tests/scenarios/stage/main.py
r8326 r8328 19 19 file = 'ex1.csv' 20 20 file_path = os.path.join(scenariodir, file) 21 store ='store.txt'22 file_path_store = os.path.join(scenariodir, store)23 storen ='storen.txt'24 fi le_path_storen = os.path.join(scenariodir, storen)21 meta = 'metalog.csv' 22 meta_path = os.path.join(scenariodir, meta) 23 final = 'final.csv' 24 final_path = os.path.join(scenariodir, final) 25 25 26 26 #create files 27 spamWriter = csv.writer(open(file_path, 'wb')) 28 spamWriter.writerow(['Stage','Extent','Time','Space']) 29 e = open(file_path_store,'a') 30 e.close() 31 e = open(file_path_storen,'a') 32 e.close() 27 firstex1 = open(file_path, 'wb') 28 spamWriter = csv.writer(firstex1) 29 spamWriter.writerow(['Depth(m)','Extent(m^2)' , 'Time Taken(s)','Space Used']) 33 30 34 31 #these are the main loops that determine the side length of the bounding square(m) … … 36 33 for m in range(100,1000,100): 37 34 for n in range(1,100,10): 38 39 # thsese values are written to the files40 g = open(file_path_store,'r+')41 g.write(str(m))42 h = open(file_path_storen,'r+')43 h.write(str(n))44 35 45 36 z = time.time() #time it 46 subprocess.call(['python2.5', 'ex1.py' ]) # run the simulation script37 subprocess.call(['python2.5', 'ex1.py',str(m),str(n)]) # run the simulation script 47 38 y = time.time() #time it 48 39 spamWriter.writerow([n ,((m**2)/2),(y-z),'a']) #record it 49 40 print 'DONE' 50 41 51 analyse_log(scenariodir, 'metalog.csv') #get the memory usage information from the log files 42 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 43 44 #close ex1.csv so we can read from it for a different csv reader object 45 firstex1.close() 46 47 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 48 ex1 = csv.reader(open(file_path,'rb')) 49 metalog = csv.reader(open(meta_path,'rb')) 50 final = csv.writer(open(final_path,'wb')) 51 52 53 for row in ex1: 54 d = metalog.next() 55 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/scenarios/vel2/ex1.py
r8326 r8328 4 4 import anuga 5 5 import time 6 import random6 import sys 7 7 import os 8 8 from anuga.abstract_2d_finite_volumes.util import add_directories 9 9 from anuga.utilities import log 10 10 11 # set up the variables for the temporary files 11 #set up variables for the simulation output and the log files 12 k= sys.argv[1] 13 l= sys.argv[2] 14 12 15 home = os.getenv('INUNDATIONHOME') 13 16 scenariodir = add_directories(home, ["data","mem_time_test", "scenarios", 14 "velocity"]) 15 store ='store.txt' 16 file_path_store = os.path.join(scenariodir, store) 17 storen = 'storen.txt' 18 file_path_storen = os.path.join(scenariodir, storen) 19 storea = 'storea.txt' 20 file_path_storea = os.path.join(scenariodir, storea) 21 22 # read the velocity and the map side length from the text files 23 f = open(file_path_store,'r+') 24 k = float(f.readline()) 25 f.close() 26 f = open(file_path_storen,'r+') 27 l = float(f.readline()) 28 f.close() 29 30 #set up variables for the simulation output and the log files 17 "velocity"]) 31 18 scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios", 32 19 "velocity", "velocity-" + str(k) +"-"+ str(l)]) 20 21 store = 'store.txt' 22 store_path = os.path.join(scenariodir, store) 23 33 24 log.log_filename = os.path.join(scenariodirV, "anuga.log") 34 25 log._setup = False … … 78 69 79 70 #write the number of triangles to the file 80 c = open( file_path_storea,'r+')71 c = open(store_path,'r+') 81 72 c.write(str(number)) -
trunk/anuga_work/development/mem_time_tests/scenarios/vel2/main.py
r8326 r8328 3 3 #------------------------------------------------------------------------------ 4 4 import anuga 5 import random6 5 import subprocess 7 6 import csv … … 19 18 file = 'ex1.csv' 20 19 file_path = os.path.join(scenariodir, file) 21 storea ='storea.txt'22 file_path_storea = os.path.join(scenariodir, storea)23 store ='store.txt'24 fi le_path_store = os.path.join(scenariodir, store)25 store n ='storen.txt'26 file_path_storen = os.path.join(scenariodir, storen)20 meta = 'metalog.csv' 21 meta_path = os.path.join(scenariodir, meta) 22 final = 'final.csv' 23 final_path = os.path.join(scenariodir, final) 24 store = 'store.txt' 25 store_path = os.path.join(scenariodir, store) 27 26 28 #create and set up the files 29 spamWriter = csv.writer(open(file_path, 'wb')) 30 spamWriter.writerow(['Velocity','Number Of Triangles','Extent','Time','Space']) 31 e = open(file_path_storea,'a') 32 e.close() 33 e = open(file_path_store,'a') 34 e.close() 35 e = open(file_path_storen,'a') 36 e.close() 27 #set up needed files 28 firstex1 = open(file_path, 'wb') 29 spamWriter = csv.writer(firstex1) 30 spamWriter.writerow(['Velocity(m/s)','Number Of Triangles','Extent(m^2)' , 'Time Taken(s)','Space Used']) 31 storeopen = open(store_path,'a') 32 storeopen.close 37 33 38 34 # these are the main loops that give the velocity of inflow (m) and the map side length(n) 39 35 for m in range(0,250,10): 40 36 for n in range(1,2000,300): 41 #write these values to the temporary file 42 g = open(file_path_store,'r+') 43 g.write(str(m)) 44 h = open(file_path_storen,'r+') 45 h.write(str(n)) 46 37 47 38 z = time.time() #time it 48 subprocess.call(['python2.5', 'ex1.py' ])#run simulation script39 subprocess.call(['python2.5', 'ex1.py', str(m), str(n)])#run simulation script 49 40 y = time.time() #time it 50 41 51 42 # read the number of triangles from this text file 52 f = open( file_path_storea,'r+')43 f = open(store_path,'r+') 53 44 h = float(f.readline()) 54 45 f.close() … … 57 48 print 'DONE' 58 49 59 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files 50 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 51 52 #close ex1.csv so we can read from it for a different csv reader object 53 firstex1.close() 54 55 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 56 ex1 = csv.reader(open(file_path,'rb')) 57 metalog = csv.reader(open(meta_path,'rb')) 58 final = csv.writer(open(final_path,'wb')) 59 60 61 for row in ex1: 62 d = metalog.next() 63 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/triangles/area/main.py
r8326 r8328 18 18 scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"]) 19 19 file1 = 'ex1.csv' 20 file_path = os.path.join(scenariodir, file1) 21 storel ='storel.txt' 22 file_path_storel = os.path.join(scenariodir, storel) 23 storea ='storea.txt' 24 file_path_storea = os.path.join(scenariodir, storea) 20 meta = 'metalog.csv' 21 meta_path = os.path.join(scenariodir, meta) 22 final = 'final.csv' 23 final_path = os.path.join(scenariodir, final) 25 24 storen ='storen.txt' 26 25 file_path_storen = os.path.join(scenariodir, storen) 27 26 28 #create and set up the files 29 spamWriter = csv.writer(open(file_path, 'wb')) 30 spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) 31 e = open(file_path_storea,'a') 32 e.close() 33 e = open(file_path_storel,'a') 34 e.close() 27 #set up needed files 28 firstex1 = open(file_path, 'wb') 29 spamWriter = csv.writer(firstex1) 30 spamWriter.writerow(['Number of Triangles','Max Area(m^2)','Extent(m^2)' , 'Time Taken(s)','Space Used']) 35 31 e = open(file_path_storen,'a') 36 32 e.close() … … 41 37 for m in range(90,100,10): 42 38 for l in range(100,2000,100): 43 44 #write these values to file 45 g = open(file_path_storel,'r+') 46 g.write(str(l)) 47 h = open(file_path_storea,'r+') 48 h.write(str(m)) 49 39 50 40 z = time.time()# time it 51 41 52 42 #the different ways each host calls MPI properly 53 43 if (host == 'cyclone.agso.gov.au'): 54 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py' ])44 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py',str(m),str(l)]) 55 45 if (host == 'tornado.agso.gov.au'): 56 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py' ])46 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py',str(m),str(l)]) 57 47 if (host == 'vayu1'): 58 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py' ])48 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py',str(m),str(l)]) 59 49 if (host == 'rhe-compute1.ga.gov.au'): 60 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.6', 'runcairns.py' ])50 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.6', 'runcairns.py',str(m),str(l)]) 61 51 if (host == 'xe'): 62 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py' ])52 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py',str(m),str(l)]) 63 53 64 54 y = time.time()# time it … … 69 59 f.close() 70 60 71 spamWriter.writerow([i, d,(l*l),'x' ,(y-z)])# record it61 spamWriter.writerow([i,m,(l*l),'x' ,(y-z)])# record it 72 62 73 63 print 'Done' 74 64 75 analyse_log(scenariodir, 'metalog.csv') #get the memory statisticsfrom the log files65 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 76 66 67 #close ex1.csv so we can read from it for a different csv reader object 68 firstex1.close() 69 70 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 71 ex1 = csv.reader(open(file_path,'rb')) 72 metalog = csv.reader(open(meta_path,'rb')) 73 final = csv.writer(open(final_path,'wb')) 74 75 76 for row in ex1: 77 d = metalog.next() 78 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) 79 -
trunk/anuga_work/development/mem_time_tests/triangles/area/runcairns.py
r8326 r8328 16 16 storen ='storen.txt' 17 17 file_path_storen = os.path.join(scenariodir, storen) 18 storel = 'storel.txt'19 file_path_storel = os.path.join(scenariodir, storel)20 storea = 'storea.txt'21 file_path_storea = os.path.join(scenariodir, storea)22 23 #read the maximum triangle area and the map side length from the files24 f = open(file_path_storel,'r+')25 length = float(f.readline())26 f.close()27 f = open(file_path_storea,'r+')28 area = float(f.readline())29 f.close()30 18 31 19 #set up the variables for the output data and the log files 20 length = sys.argv[2] 21 area = sys.argv[1] 22 32 23 scenariodirV = add_directories(home, ["data","mem_time_test", "triangles", 33 24 "area", "triangles-" + str(area) +"-"+ str(length)]) -
trunk/anuga_work/development/mem_time_tests/triangles/fromregions/main.py
r8326 r8328 18 18 storea ='storea.txt' 19 19 file_path_storea = os.path.join(scenariodir, storea) 20 store ='store.txt'21 file_path_store = os.path.join(scenariodir, store)22 storen ='storen.txt'23 fi le_path_storen = os.path.join(scenariodir, storen)20 meta = 'metalog.csv' 21 meta_path = os.path.join(scenariodir, meta) 22 final = 'final.csv' 23 final_path = os.path.join(scenariodir, final) 24 24 file = 'ex1.csv' 25 25 file_path = os.path.join(scenariodir, file) 26 26 27 27 #create and set up the files 28 spamWriter = csv.writer(open(file_path, 'wb')) 29 spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) 28 firstex1 = open(file_path, 'wb') 29 spamWriter = csv.writer(firstex1) 30 spamWriter.writerow(['Number Of Triangles','Maximum Area(m^2)','Extent(m^2)' , 'Time Taken(s)','Space Used']) 30 31 e = open(file_path_storea,'a') 31 e.close()32 e = open(file_path_store,'a')33 e.close()34 e = open(file_path_storen,'a')35 32 e.close() 36 33 37 34 #these are the main loops that determine the maximum triangle area (m) and the map side length(n) 38 for m in range(1,100,10): 39 for n in range(1,1000,100): 40 41 #write these values to file 42 g = open(file_path_store,'r+') 43 g.write(str(m)) 44 h = open(file_path_storen,'r+') 45 h.write(str(n)) 35 for m in range(20,1000,50): 36 for n in range(1,100000,10000): 46 37 47 38 z = time.time() #time it 48 subprocess.call(['python2.5', 'runcairns.py' ])#run simulation39 subprocess.call(['python2.5', 'runcairns.py',str(m),str(n)])#run simulation 49 40 y = time.time() #time it 50 41 … … 57 48 print 'DONE' 58 49 59 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files 50 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 51 52 #close ex1.csv so we can read from it for a different csv reader object 53 firstex1.close() 54 55 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 56 ex1 = csv.reader(open(file_path,'rb')) 57 metalog = csv.reader(open(meta_path,'rb')) 58 final = csv.writer(open(final_path,'wb')) 59 60 61 for row in ex1: 62 d = metalog.next() 63 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) -
trunk/anuga_work/development/mem_time_tests/triangles/fromregions/runcairns.py
r8326 r8328 5 5 import time 6 6 import sys 7 import random8 7 import anuga 9 8 from anuga.abstract_2d_finite_volumes.util import add_directories … … 14 13 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 15 14 "fromregions"]) 16 store ='store.txt'17 file_path_store = os.path.join(scenariodir, store)18 storen ='storen.txt'19 file_path_storen = os.path.join(scenariodir, storen)20 15 storea = 'storea.txt' 21 16 file_path_storea = os.path.join(scenariodir, storea) 22 17 23 #read the maximum triangle area and map side length from the text files24 f = open(file_path_store,'r+')25 a = float(f.readline())26 f.close()27 f = open(file_path_storen,'r+')28 l = float(f.readline())29 f.close()30 18 31 19 #set up the variables for the simulation output and the log files 20 a = sys.argv[1] 21 l = sys.argv[2] 22 32 23 scenariodirV = add_directories(home, ["data","mem_time_test", "triangles", 33 24 "fromregions", "triangles-" + str(a) +"-"+ str(l)]) 34 25 h = 'CAIRNS.msh' 35 26 file_pathh = os.path.join(scenariodirV, h) 27 log._setup = False 36 28 log.log_filename = os.path.join(scenariodirV, "anuga.log") 37 log._setup = False38 29 39 30 log.resource_usage_timing(prefix = 'BeforeSimulation') #get memory usage -
trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/main.py
r8326 r8328 18 18 storea ='storea.txt' 19 19 file_path_storea = os.path.join(scenariodir, storea) 20 store ='store.txt'21 file_path_store = os.path.join(scenariodir, store)22 storen ='storen.txt'23 fi le_path_storen = os.path.join(scenariodir, storen)20 meta = 'metalog.csv' 21 meta_path = os.path.join(scenariodir, meta) 22 final = 'final.csv' 23 final_path = os.path.join(scenariodir, final) 24 24 file = 'ex1.csv' 25 25 file_path = os.path.join(scenariodir, file) 26 26 27 #create and set up the output files 28 spamWriter = csv.writer(open(file_path, 'wb')) 29 spamWriter.writerow(['Number Of Triangles' ,'MxM Rectangular Mesh', 'Extent', 'Space Used MB' , 'Time Taken s']) 27 #set up needed files 28 firstex1 = open(file_path, 'wb') 29 spamWriter = csv.writer(firstex1) 30 spamWriter.writerow(['Number of Triangles','Matrix Size','Extent(m^2)' , 'Time Taken(s)','Space Used']) 30 31 e = open(file_path_storea,'a') 31 e.close()32 e = open(file_path_store,'a')33 e.close()34 e = open(file_path_storen,'a')35 32 e.close() 36 33 37 34 #these main loops assign the matrix size[number of triangles] (m) and the map side length(n) 38 for m in range(1, 500,10):35 for m in range(1,300,30): 39 36 for n in range(1,1000,100): 40 37 41 #write these values to file42 g = open(file_path_store,'r+')43 g.write(str(m))44 h = open(file_path_storen,'r+')45 h.write(str(n))46 47 38 z = time.time() #time it 48 subprocess.call(['python2.5', 'runcairns.py' ]) #run the simulation39 subprocess.call(['python2.5', 'runcairns.py',str(m),str(n)]) #run the simulation 49 40 y = time.time() #time it 50 41 … … 57 48 print 'DONE' 58 49 59 analyse_log(scenariodir, 'metalog.csv')#get the memory statisticsfrom the log files50 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 60 51 52 #close ex1.csv so we can read from it for a different csv reader object 53 firstex1.close() 54 55 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 56 ex1 = csv.reader(open(file_path,'rb')) 57 metalog = csv.reader(open(meta_path,'rb')) 58 final = csv.writer(open(final_path,'wb')) 59 60 61 for row in ex1: 62 d = metalog.next() 63 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]]) 64 -
trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/runcairns.py
r8326 r8328 13 13 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 14 14 "rectanglecross"]) 15 store ='store.txt'16 file_path_store = os.path.join(scenariodir, store)17 storen ='storen.txt'18 file_path_storen = os.path.join(scenariodir, storen)19 15 storea = 'storea.txt' 20 16 file_path_storea = os.path.join(scenariodir, storea) 21 17 22 #read the matrix size(number of triangles) and the map size from these files 23 f = open(file_path_store,'r+') 24 a = int(f.readline()) 25 f.close() 26 f = open(file_path_storen,'r+') 27 l = float(f.readline()) 28 f.close() 18 #set up the variables for the simulation out put and log files 19 a = int(sys.argv[1]) 20 l = float(sys.argv[2]) 29 21 30 #set up the variables for the simulation out put and log files31 22 scenariodirV = add_directories(home, ["data","mem_time_test", "triangles", 32 23 "rectanglecross", "triangles-" + str(a) +"-"+ str(l)])
Note: See TracChangeset
for help on using the changeset viewer.