- 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/triangles/area/main.py
r8320 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 subprocess … … 12 8 import time 13 9 import liststore 14 from anuga.utilities import system_tools, log15 10 from anuga.abstract_2d_finite_volumes.util import add_directories 16 11 from anuga.utilities.log_analyser import analyse_log 17 12 18 13 #------------------------------------------------------------------------------ 19 # Set up computational domain14 # Set up variables for the correct directories to store the output 20 15 #------------------------------------------------------------------------------ 21 a = [] 22 #SpaceUsed = 0.0 23 #number = 0 24 25 home1 = os.getenv('INUNDATIONHOME') 16 home = os.getenv('INUNDATIONHOME') 26 17 host = os.getenv('HOST') 27 scenariodir = add_directories(home 1, ["data","mem_time_test", "triangles","area"])18 scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"]) 28 19 file1 = 'ex1.csv' 29 20 file_path = os.path.join(scenariodir, file1) … … 32 23 storea ='storea.txt' 33 24 file_path_storea = os.path.join(scenariodir, storea) 34 store ='store.txt'35 file_path_store = os.path.join(scenariodir, store)36 25 storen ='storen.txt' 37 26 file_path_storen = os.path.join(scenariodir, storen) 38 27 39 log.log_filename = os.path.join(scenariodir, 'log.txt') 40 28 #create and set up the files 41 29 spamWriter = csv.writer(open(file_path, 'wb')) 42 30 spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) 43 e = open(file_path_store,'a')44 e.close()45 31 e = open(file_path_storea,'a') 46 32 e.close() … … 50 36 e.close() 51 37 38 # this is the main loops that assigns the maximum triangle area (m) and the map side length(l) 52 39 40 n = 4 #number of processors to use 53 41 for m in range(90,100,10): 54 n = 4 #number of processors to use55 42 for l in range(100,2000,100): 56 43 44 #write these values to file 57 45 g = open(file_path_storel,'r+') 58 46 g.write(str(l)) 47 h = open(file_path_storea,'r+') 48 h.write(str(m)) 49 50 z = time.time()# time it 59 51 60 h = open(file_path_storea,'r+') 61 h.write(str(d)) 62 63 z = time.time() 52 #the different ways each host calls MPI properly 64 53 if (host == 'cyclone.agso.gov.au'): 65 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python 2.6', 'runcairns.py'])54 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) 66 55 if (host == 'tornado.agso.gov.au'): 67 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python 2.6', 'runcairns.py'])56 subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) 68 57 if (host == 'vayu1'): 69 58 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) … … 73 62 subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) 74 63 75 y = time.time() 64 y = time.time()# time it 76 65 77 f = open(file_path_store,'r+') 78 x = float(f.readline()) 79 f.close() 80 66 # read the number of triangles from this file 81 67 f = open(file_path_storen,'r+') 82 68 i = float(f.readline()) 83 69 f.close() 84 70 85 spamWriter.writerow([i,d,(l*l),x ,(y-z)]) 86 liststore.store = [0,0,0,0] 87 71 spamWriter.writerow([i,d,(l*l),'x' ,(y-z)])# record it 88 72 89 73 print 'Done' 90 74 75 analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files 76
Note: See TracChangeset
for help on using the changeset viewer.