- Timestamp:
- Feb 2, 2012, 1:08:40 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.