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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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]])
Note: See TracChangeset for help on using the changeset viewer.