Changeset 8328


Ignore:
Timestamp:
Feb 2, 2012, 1:08:40 PM (13 years ago)
Author:
pittj
Message:

metalog and ex1 merge added, code is now correct across all major experiments

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  
    2222file_path = os.path.join(scenariodir, file1)
    2323
    24 spamWriter = csv.writer(open(file_path, 'wb'))
    25 spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken s'])
     24firstex1 = open(file_path, 'wb')
     25spamWriter = csv.writer(firstex1)
     26spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken (s)'])
    2627
    2728
     
    4849print 'DONE'
    4950
    50 analyse_log(scenariodir, 'metalog.csv') # interrogate log files for the memory usage information
     51analyse_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
     54firstex1.close()
     55
     56#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     57ex1 = csv.reader(open(file_path,'rb'))
     58metalog = csv.reader(open(meta_path,'rb'))
     59final = csv.writer(open(final_path,'wb'))
     60
     61
     62for 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  
    2222file1 = 'ex1.csv'
    2323file_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
     25firstex1 = open(file_path, 'wb')
     26spamWriter = csv.writer(firstex1)
     27spamWriter.writerow(['Number Of Processors' ,'Time Taken (s)'])
    2628
    2729
     
    5052print 'Done'
    5153
    52 analyse_log(scenariodir, 'metalog.csv') #get all the memory usage statistics
     54analyse_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
     57firstex1.close()
     58
     59#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     60ex1 = csv.reader(open(file_path,'rb'))
     61metalog = csv.reader(open(meta_path,'rb'))
     62final = csv.writer(open(final_path,'wb'))
     63
     64
     65for 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  
    55import time
    66import os
     7import sys
    78from anuga.utilities import log
    89from anuga.abstract_2d_finite_volumes.util import add_directories
    910
    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
     12n = sys.argv[1]
    1113home = 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 file
    17 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 file
    2214scenariodirV = add_directories(home, ["data","mem_time_test", "parameters",
    2315                                     "nothing","nothing"+"-"+str(n)])
     
    3426
    3527domain.set_name('channel1') # Output name
    36 domain.set_datadir(scenariodir)
     28domain.set_datadir(scenariodirV)
    3729
    3830log.resource_usage_timing(prefix = 'AfterMesh')  #get memory usage here
  • trunk/anuga_work/development/mem_time_tests/parameters/nothing/main.py

    r8326 r8328  
    1919file = 'ex1.csv'
    2020file_path = os.path.join(scenariodir, file)
    21 store = 'store.txt'
    22 file_path_store = os.path.join(scenariodir, store)
     21meta = 'metalog.csv'
     22meta_path = os.path.join(scenariodir, meta)
     23final = 'final.csv'
     24final_path = os.path.join(scenariodir, final)
    2325
    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
     27firstex1 = open(file_path, 'wb')
     28spamWriter = csv.writer(firstex1)
     29spamWriter.writerow(['Run Number' , 'Time Taken(s)','Space Used'])
    2830
    2931#main loop, that stores the current run number so that unique folders exist for the information
    3032for 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
    3837
    3938    spamWriter.writerow([n ,(y-x)])
     
    4140print "DONE"
    4241
    43 analyse_log(scenariodir, 'metalog.csv') #get the memory usage from the log files
     42analyse_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
     45firstex1.close()
     46
     47#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     48ex1 = csv.reader(open(file_path,'rb'))
     49metalog = csv.reader(open(meta_path,'rb'))
     50final = csv.writer(open(final_path,'wb'))
     51
     52
     53for 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  
    44import anuga
    55import time
    6 import random
    76import os
     7import sys
    88from anuga.abstract_2d_finite_volumes.util import add_directories
    99from anuga.utilities import log
    1010
    11 #set up variables to store the temporary data
     11#set up variables to store the data and the log files
     12g = sys.argv[1]
     13h = sys.argv[2]
    1214home = 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 files
    21 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 files
    2915scenariodirV = add_directories(home, ["data","mem_time_test", "parameters",
    3016                                       "timelen-over-timestep", "TT-" + str(g) +"-"+ str(h)])
    3117log.log_filename = os.path.join(scenariodirV, "anuga.log")
    3218log._setup = False
    33 
    3419
    3520log.resource_usage_timing(prefix = 'BeforeSimulation') #get memory usage here
  • trunk/anuga_work/development/mem_time_tests/parameters/timelen-over-timestep/main.py

    r8326 r8328  
    2121file = 'ex1.csv'
    2222file_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)
     23meta = 'metalog.csv'
     24meta_path = os.path.join(scenariodir, meta)
     25final = 'final.csv'
     26final_path = os.path.join(scenariodir, final)
    2927
    3028#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 
     29firstex1 = open(file_path, 'wb')
     30spamWriter = csv.writer(firstex1)
     31spamWriter.writerow(['Time Length(s)','Time Step (s)' , 'Time Taken','Space Used'])
    3732
    3833# main loops that give the time length (m) and the time step (n)
     
    4035
    4136    for n in range(1,1000,5):
    42         n = n/1000.0 #adjust it so its small enough to see the nature of the relationship
     37        n = n/100.0 #adjust it so its small enough to see the nature of the relationship
    4338
    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
    5342        spamWriter.writerow([m,n ,(y-x),'b'])#write the results
    5443
    5544print 'Done'
    5645
    57 analyse_log(scenariodir, 'metalog.csv')#get the memory usage statistics from the log files
     46analyse_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
     49firstex1.close()
     50
     51#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     52ex1 = csv.reader(open(file_path,'rb'))
     53metalog = csv.reader(open(meta_path,'rb'))
     54final = csv.writer(open(final_path,'wb'))
     55
     56
     57for 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  
    55import time
    66import os
     7import sys
    78from anuga.abstract_2d_finite_volumes.util import add_directories
    89from anuga.utilities import log
    910
    10 #set up variables for the temporary data files
     11#set up variables to store the results and the log files of each experiment
     12f = sys.argv[1]
    1113home = 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 file
    18 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 experiment
    2314scenariodirV = add_directories(home, ["data","mem_time_test", "parameters",
    2415                                       "timelength", "timelength-" + str(f)])
  • trunk/anuga_work/development/mem_time_tests/parameters/timelen/main.py

    r8326 r8328  
    2020file = 'ex1.csv'
    2121file_path = os.path.join(scenariodir, file)
    22 store ='store.txt'
    23 file_path_store = os.path.join(scenariodir, store)
     22meta = 'metalog.csv'
     23meta_path = os.path.join(scenariodir, meta)
     24final = 'final.csv'
     25final_path = os.path.join(scenariodir, final)
    2426
    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
     28firstex1 = open(file_path, 'wb')
     29spamWriter = csv.writer(firstex1)
     30spamWriter.writerow(['Time Length (s)' , 'Time Taken (s)','Space Used'])
    2931
    3032#main loop that does the same experiment with different time lengths
    31 for n in range(1,100000,100):
     33for n in range(1,1000,100):
    3234
    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
    3938    spamWriter.writerow([n ,(y-x)]) #write results
    4039
    4140print 'Done'
    4241
    43 #get the memory usage from the log files of each run
    44 analyse_log(scenariodir, 'metalog.csv')
     42analyse_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
     45firstex1.close()
     46
     47#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     48ex1 = csv.reader(open(file_path,'rb'))
     49metalog = csv.reader(open(meta_path,'rb'))
     50final = csv.writer(open(final_path,'wb'))
     51
     52
     53for 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  
    55import anuga
    66import time
    7 import random
     7import sys
    88import os
    99from anuga.abstract_2d_finite_volumes.util import add_directories
    1010from anuga.utilities import log
    1111
    12 #set up the variables for the temporary file directories
     12#set up the variables for the log files and data directories
     13f = sys.argv[1]
    1314home = 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 file
    20 f = float(s.readline())
    21 s.close()
    22 
    23 #set up the variables for the log files and data directories
    2415scenariodirV = add_directories(home, ["data","mem_time_test", "parameters",
    2516                                       "timestep", "timestep-" + str(f)])
  • trunk/anuga_work/development/mem_time_tests/parameters/timestep/main.py

    r8326 r8328  
    1919file = 'ex1.csv'
    2020file_path = os.path.join(scenariodir, file)
    21 store ='store.txt'
    22 file_path_store = os.path.join(scenariodir, store)
     21meta = 'metalog.csv'
     22meta_path = os.path.join(scenariodir, meta)
     23final = 'final.csv'
     24final_path = os.path.join(scenariodir, final)
    2325
    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
     27firstex1 = open(file_path, 'wb')
     28spamWriter = csv.writer(firstex1)
     29spamWriter.writerow(['Time Step (s)' , 'Time Taken','Space Used'])
    2930
    3031#main loop that runs the script with different time steps (yield steps)
    3132for n in range(1,10000,10):
     33
    3234    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
    4038    spamWriter.writerow([n ,(y-x),'b']) #record results
    4139
    4240print 'Done'
    4341
    44 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files
     42analyse_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
     45firstex1.close()
     46
     47#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     48ex1 = csv.reader(open(file_path,'rb'))
     49metalog = csv.reader(open(meta_path,'rb'))
     50final = csv.writer(open(final_path,'wb'))
     51
     52
     53for 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  
    44import anuga
    55import time
    6 import random
     6import sys
    77import os
    88from anuga.abstract_2d_finite_volumes.util import add_directories
    99from anuga.utilities import log
    1010
    11 #set up the variables for the temporary storage files
     11#set up variables to store the experiment data and the log file
     12length = sys.argv[1]
     13lower = sys.argv[2]
     14
    1215home = 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 boundary
    21 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 file
    2916scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios",
    3017                                       "channelflow", "channelflow-" + str(lower) +"-"+ str(length)])
     
    3623# Setup computational domain
    3724#------------------------------------------------------------------------------
    38 points, vertices, boundary = anuga.rectangular_cross(100,300,len1=length, len2=length) # Mesh
     25points, vertices, boundary = anuga.rectangular_cross(50,150,len1=length, len2=length) # Mesh
    3926domain = anuga.Domain(points, vertices, boundary) # Create domain
    40 domain.set_datadir(scenariodir)
     27domain.set_datadir(scenariodirV)
    4128domain.set_name('channel1.sww') # Output name
    4229
  • trunk/anuga_work/development/mem_time_tests/scenarios/channelflow/main.py

    r8326 r8328  
    1717scenariodir = add_directories(home, ["data","mem_time_test", "scenarios",
    1818                                     "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)
    2319file = 'ex1.csv'
    2420file_path = os.path.join(scenariodir, file)
     21meta = 'metalog.csv'
     22meta_path = os.path.join(scenariodir, meta)
     23final = 'final.csv'
     24final_path = os.path.join(scenariodir, final)
    2525
    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
     27firstex1 = open(file_path, 'wb')
     28spamWriter = csv.writer(firstex1)
     29spamWriter.writerow(['Side Lenght(m)','Percentage Of Water Coverage' , 'Time Taken(s)','Space Used'])
    3330
    3431#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(100,100000,10000):
    36     for n in range(1,i/10,i/100):
     32for i in range(1,1000,100):
     33    for n in range(0,110,10):
    3734       
    3835        #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)
    4737
    4838        z = time.time() #time it
    49         subprocess.call(['python2.5', 'ex1.py'])#run the script
     39        subprocess.call(['python2.5', 'ex1.py',str(i),str(n)])#run the script
    5040        y = time.time() #time it
    5141
    52         spamWriter.writerow([i,n,(y-z), 'b'])#record it
     42        spamWriter.writerow([i,n/(i/100.0),(y-z), 'b'])#record it
    5343print 'DONE'
    5444
    55 analyse_log(scenariodir, 'metalog.csv')#get the memory usage statistics from the various log files
     45analyse_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
     48firstex1.close()
     49
     50#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     51ex1 = csv.reader(open(file_path,'rb'))
     52metalog = csv.reader(open(meta_path,'rb'))
     53final = csv.writer(open(final_path,'wb'))
     54
     55
     56for 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  
    44import anuga
    55import time
    6 import random
     6import sys
    77import os
    88from anuga.abstract_2d_finite_volumes.util import add_directories
    99from anuga.utilities import log
    1010
    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
     12l = float(sys.argv[1])
     13tide = sys.argv[2]
     14
    1215home = 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 files
    21 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 files
    2916scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios",
    3017                                       "stage", "stage-" + str(tide) +"-"+ str(l)])
     
    3724#------------------------------------------------------------------------------
    3825points, vertices, boundary = anuga.rectangular_cross(100,300,
    39                                                      len1=l, len2=(l/2)) # Mesh
     26                                                     len1=l, len2=(l/2.0)) # Mesh
    4027domain = anuga.Domain(points, vertices, boundary) # Create domain
    4128domain.set_datadir(scenariodirV)
  • trunk/anuga_work/development/mem_time_tests/scenarios/stage/main.py

    r8326 r8328  
    1919file = 'ex1.csv'
    2020file_path = os.path.join(scenariodir, file)
    21 store ='store.txt'
    22 file_path_store = os.path.join(scenariodir, store)
    23 storen ='storen.txt'
    24 file_path_storen = os.path.join(scenariodir, storen)
     21meta = 'metalog.csv'
     22meta_path = os.path.join(scenariodir, meta)
     23final = 'final.csv'
     24final_path = os.path.join(scenariodir, final)
    2525
    2626#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()
     27firstex1 = open(file_path, 'wb')
     28spamWriter = csv.writer(firstex1)
     29spamWriter.writerow(['Depth(m)','Extent(m^2)' , 'Time Taken(s)','Space Used'])
    3330
    3431#these are the main loops that determine the side length of the bounding square(m)
     
    3633for m in range(100,1000,100):
    3734    for n in range(1,100,10):
    38  
    39         # thsese values are written to the files
    40         g = open(file_path_store,'r+')
    41         g.write(str(m))
    42         h = open(file_path_storen,'r+')
    43         h.write(str(n))
    4435
    4536        z = time.time() #time it
    46         subprocess.call(['python2.5', 'ex1.py']) # run the simulation script
     37        subprocess.call(['python2.5', 'ex1.py',str(m),str(n)]) # run the simulation script
    4738        y = time.time() #time it
    4839        spamWriter.writerow([n ,((m**2)/2),(y-z),'a']) #record it
    4940print 'DONE'
    5041
    51 analyse_log(scenariodir, 'metalog.csv') #get the memory usage information from the log files
     42analyse_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
     45firstex1.close()
     46
     47#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     48ex1 = csv.reader(open(file_path,'rb'))
     49metalog = csv.reader(open(meta_path,'rb'))
     50final = csv.writer(open(final_path,'wb'))
     51
     52
     53for 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  
    44import anuga
    55import time
    6 import random
     6import sys
    77import os
    88from anuga.abstract_2d_finite_volumes.util import add_directories
    99from anuga.utilities import log
    1010
    11 # set up the variables for the temporary files
     11#set up variables for the simulation output and the log files
     12k= sys.argv[1]
     13l= sys.argv[2]
     14
    1215home = os.getenv('INUNDATIONHOME')
    1316scenariodir = 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"])
    3118scenariodirV = add_directories(home, ["data","mem_time_test", "scenarios",
    3219                                       "velocity", "velocity-" + str(k) +"-"+ str(l)])
     20
     21store = 'store.txt'
     22store_path = os.path.join(scenariodir, store)
     23
    3324log.log_filename = os.path.join(scenariodirV, "anuga.log")
    3425log._setup = False
     
    7869
    7970#write the number of triangles to the file
    80 c = open(file_path_storea,'r+')
     71c = open(store_path,'r+')
    8172c.write(str(number))
  • trunk/anuga_work/development/mem_time_tests/scenarios/vel2/main.py

    r8326 r8328  
    33#------------------------------------------------------------------------------
    44import anuga
    5 import random
    65import subprocess
    76import csv
     
    1918file = 'ex1.csv'
    2019file_path = os.path.join(scenariodir, file)
    21 storea ='storea.txt'
    22 file_path_storea = os.path.join(scenariodir, storea)
    23 store ='store.txt'
    24 file_path_store = os.path.join(scenariodir, store)
    25 storen ='storen.txt'
    26 file_path_storen = os.path.join(scenariodir, storen)
     20meta = 'metalog.csv'
     21meta_path = os.path.join(scenariodir, meta)
     22final = 'final.csv'
     23final_path = os.path.join(scenariodir, final)
     24store = 'store.txt'
     25store_path = os.path.join(scenariodir, store)
    2726
    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
     28firstex1 = open(file_path, 'wb')
     29spamWriter = csv.writer(firstex1)
     30spamWriter.writerow(['Velocity(m/s)','Number Of Triangles','Extent(m^2)' , 'Time Taken(s)','Space Used'])
     31storeopen = open(store_path,'a')
     32storeopen.close
    3733
    3834# these are the main loops that give the velocity of inflow (m) and the map side length(n)
    3935for m in range(0,250,10):
    4036     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       
    4738        z = time.time() #time it
    48         subprocess.call(['python2.5', 'ex1.py'])#run simulation script
     39        subprocess.call(['python2.5', 'ex1.py', str(m), str(n)])#run simulation script
    4940        y = time.time() #time it
    5041
    5142        # read the number of triangles from this text file
    52         f = open(file_path_storea,'r+')
     43        f = open(store_path,'r+')
    5344        h = float(f.readline())
    5445        f.close()
     
    5748print 'DONE' 
    5849
    59 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files
     50analyse_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
     53firstex1.close()
     54
     55#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     56ex1 = csv.reader(open(file_path,'rb'))
     57metalog = csv.reader(open(meta_path,'rb'))
     58final = csv.writer(open(final_path,'wb'))
     59
     60
     61for 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  
    1818scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"])
    1919file1 = '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)
     20meta = 'metalog.csv'
     21meta_path = os.path.join(scenariodir, meta)
     22final = 'final.csv'
     23final_path = os.path.join(scenariodir, final)
    2524storen ='storen.txt'
    2625file_path_storen = os.path.join(scenariodir, storen)
    2726
    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
     28firstex1 = open(file_path, 'wb')
     29spamWriter = csv.writer(firstex1)
     30spamWriter.writerow(['Number of Triangles','Max Area(m^2)','Extent(m^2)' , 'Time Taken(s)','Space Used'])
    3531e = open(file_path_storen,'a')
    3632e.close()
     
    4137for m in range(90,100,10):
    4238     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               
    5040        z = time.time()# time it
    5141
    5242        #the different ways each host calls MPI properly
    5343        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)])
    5545        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)])
    5747        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)])
    5949        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)])   
    6151        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)])
    6353       
    6454        y = time.time()# time it
     
    6959        f.close()
    7060
    71         spamWriter.writerow([i,d,(l*l),'x' ,(y-z)])# record it
     61        spamWriter.writerow([i,m,(l*l),'x' ,(y-z)])# record it
    7262
    7363print 'Done'
    7464
    75 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files
     65analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files
    7666
     67#close ex1.csv so we can read from it for a different csv reader object
     68firstex1.close()
     69
     70#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     71ex1 = csv.reader(open(file_path,'rb'))
     72metalog = csv.reader(open(meta_path,'rb'))
     73final = csv.writer(open(final_path,'wb'))
     74
     75
     76for 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  
    1616storen ='storen.txt'
    1717file_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 files
    24 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()
    3018
    3119#set up the variables for the output data and the log files
     20length = sys.argv[2]
     21area = sys.argv[1]
     22
    3223scenariodirV = add_directories(home, ["data","mem_time_test", "triangles",
    3324                                       "area", "triangles-" + str(area) +"-"+ str(length)])
  • trunk/anuga_work/development/mem_time_tests/triangles/fromregions/main.py

    r8326 r8328  
    1818storea ='storea.txt'
    1919file_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 file_path_storen = os.path.join(scenariodir, storen)
     20meta = 'metalog.csv'
     21meta_path = os.path.join(scenariodir, meta)
     22final = 'final.csv'
     23final_path = os.path.join(scenariodir, final)
    2424file = 'ex1.csv'
    2525file_path = os.path.join(scenariodir, file)
    2626
    2727#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'])
     28firstex1 = open(file_path, 'wb')
     29spamWriter = csv.writer(firstex1)
     30spamWriter.writerow(['Number Of Triangles','Maximum Area(m^2)','Extent(m^2)' , 'Time Taken(s)','Space Used'])
    3031e = 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')
    3532e.close()
    3633
    3734#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))
     35for m in range(20,1000,50):
     36    for n in range(1,100000,10000):
    4637
    4738        z = time.time() #time it
    48         subprocess.call(['python2.5', 'runcairns.py'])#run simulation
     39        subprocess.call(['python2.5', 'runcairns.py',str(m),str(n)])#run simulation
    4940        y = time.time() #time it
    5041
     
    5748print 'DONE'
    5849
    59 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files
     50analyse_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
     53firstex1.close()
     54
     55#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     56ex1 = csv.reader(open(file_path,'rb'))
     57metalog = csv.reader(open(meta_path,'rb'))
     58final = csv.writer(open(final_path,'wb'))
     59
     60
     61for 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  
    55import time
    66import sys
    7 import random
    87import anuga
    98from anuga.abstract_2d_finite_volumes.util import add_directories
     
    1413scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
    1514                                     "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)
    2015storea = 'storea.txt'
    2116file_path_storea = os.path.join(scenariodir, storea)
    2217
    23 #read the maximum triangle area and map side length from the text files
    24 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()
    3018
    3119#set up the variables for the simulation output and the log files
     20a = sys.argv[1]
     21l = sys.argv[2]
     22
    3223scenariodirV = add_directories(home, ["data","mem_time_test", "triangles",
    3324                                       "fromregions", "triangles-" + str(a) +"-"+ str(l)])
    3425h = 'CAIRNS.msh'
    3526file_pathh = os.path.join(scenariodirV, h)
     27log._setup = False
    3628log.log_filename = os.path.join(scenariodirV, "anuga.log")
    37 log._setup = False
    3829
    3930log.resource_usage_timing(prefix = 'BeforeSimulation') #get memory usage
  • trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/main.py

    r8326 r8328  
    1818storea ='storea.txt'
    1919file_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 file_path_storen = os.path.join(scenariodir, storen)
     20meta = 'metalog.csv'
     21meta_path = os.path.join(scenariodir, meta)
     22final = 'final.csv'
     23final_path = os.path.join(scenariodir, final)
    2424file = 'ex1.csv'
    2525file_path = os.path.join(scenariodir, file)
    2626
    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
     28firstex1 = open(file_path, 'wb')
     29spamWriter = csv.writer(firstex1)
     30spamWriter.writerow(['Number of Triangles','Matrix Size','Extent(m^2)' , 'Time Taken(s)','Space Used'])
    3031e = 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')
    3532e.close()
    3633
    3734#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):
     35for m in range(1,300,30):
    3936    for n in range(1,1000,100):
    4037
    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))
    46 
    4738        z = time.time() #time it
    48         subprocess.call(['python2.5', 'runcairns.py']) #run the simulation
     39        subprocess.call(['python2.5', 'runcairns.py',str(m),str(n)]) #run the simulation
    4940        y = time.time() #time it
    5041
     
    5748print 'DONE'
    5849
    59 analyse_log(scenariodir, 'metalog.csv')#get the memory statistics from the log files
     50analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files
    6051
     52#close ex1.csv so we can read from it for a different csv reader object
     53firstex1.close()
     54
     55#merge the metalog useful memory info and the ex1 recorded info into one csv file named final
     56ex1 = csv.reader(open(file_path,'rb'))
     57metalog = csv.reader(open(meta_path,'rb'))
     58final = csv.writer(open(final_path,'wb'))
     59
     60
     61for 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  
    1313scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
    1414                                     "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)
    1915storea = 'storea.txt'
    2016file_path_storea = os.path.join(scenariodir, storea)
    2117
    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
     19a = int(sys.argv[1])
     20l = float(sys.argv[2])
    2921
    30 #set up the variables for the simulation out put and log files
    3122scenariodirV = add_directories(home, ["data","mem_time_test", "triangles",
    3223                                       "rectanglecross", "triangles-" + str(a) +"-"+ str(l)])
Note: See TracChangeset for help on using the changeset viewer.