Changeset 8303
- Timestamp:
- Jan 18, 2012, 1:32:53 PM (13 years ago)
- Location:
- trunk/anuga_work/development/mem_time_tests/triangles
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/mem_time_tests/triangles/area/main.py
r8300 r8303 7 7 # Import standard shallow water domain and standard boundaries. 8 8 import anuga 9 import random10 9 import subprocess 11 import run_parallel12 10 import csv 13 11 import os 14 12 import time 15 import liststore 13 from anuga.utilities import system_tools, log 14 from anuga.abstract_2d_finite_volumes.util import add_directories 15 16 16 17 17 #------------------------------------------------------------------------------ … … 19 19 #------------------------------------------------------------------------------ 20 20 a = [] 21 n = 300 22 spamWriter = csv.writer(open('ex1.csv', 'wb')) 21 #SpaceUsed = 0.0 22 #number = 0 23 spacelist = [0,0,0,0] 24 25 home = os.getenv('INUNDATIONHOME') 26 scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"]) 27 file = 'ex1.csv' 28 file_path = os.path.join(scenariodir, file) 29 storel ='storel.txt' 30 file_path_storel = os.path.join(scenariodir, storel) 31 storea ='storea.txt' 32 file_path_storea = os.path.join(scenariodir, storea) 33 store ='store.txt' 34 file_path_store = os.path.join(scenariodir, store) 35 storen ='storen.txt' 36 file_path_storen = os.path.join(scenariodir, storen) 37 38 spamWriter = csv.writer(open(file_path, 'wb')) 23 39 spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) 24 40 25 41 26 while (n > 0): 27 z = time.time() 28 run_parallel.runex(4) 29 n = n -1 30 y = time.time() 42 def rum(d): 43 f = 4 44 for l in range(1,2000,100): 45 46 g = open(file_path_storel,'r+') 47 g.write(str(l)) 31 48 32 f = open('store.txt','r+') 33 x = float(f.readline()) 34 f.close() 49 h = open(file_path_storea,'r+') 50 h.write(str(d)) 35 51 36 f = open('storel.txt','r+')37 c = float(f.readline())38 f.close()52 z = time.time() 53 subprocess.call(['mpirun', '-np', str(f), '-hostfile' ,'~/machinefiles/t.machines_tornado', '-x', 'PYTHONPATH','python2.5', 'runcairns.py']) 54 y = time.time() 39 55 40 f = open('storea.txt','r+')41 d =float(f.readline())42 f.close()56 f = open(file_path_store,'r+') 57 x = 3#float(f.readline()) 58 f.close() 43 59 44 f = open('storen.txt','r+')45 h =float(f.readline())46 f.close()60 f = open(file_path_storen,'r+') 61 i = 3#float(f.readline()) 62 f.close() 47 63 48 spamWriter.writerow([h,d,(c*c),x ,(y-z)]) 64 spamWriter.writerow([i,d,(l*l),x ,(y-z)]) 65 spacelist = [0,0,0,0] 49 66 50 liststore.spacelist = [0,0,0,0] 51 print a 67 for m in range(1,100,10): 68 rum(m) 52 69 70 print 'Done' 71 -
trunk/anuga_work/development/mem_time_tests/triangles/area/runcairns.py
r8300 r8303 19 19 import time 20 20 import sys 21 import random21 import main 22 22 23 23 # Related major packages 24 24 import anuga 25 from anuga_parallel import distribute, myid 26 from anuga.abstract_2d_finite_volumes.util import add_directories 27 from anuga.utilities import system_tools, log 25 28 26 from anuga_parallel import distribute, myid, numprocs, finalize, barrier 29 spacelist = [0,0,0,0] 27 30 28 import PyVM 29 import liststore 31 #home = os.getenv('INUNDATIONHOME') 32 scenariodir2 = add_directories(main.home, ["data", "mem_time_test", "triangles", "area"]) 30 33 31 length = random.random()*2000 + 1 32 area = random.random()*100 + 1 34 h = 'CAIRNS.msh' 35 file_pathh = os.path.join(scenariodir2, h) 36 store ='store.txt' 37 file_path_store = os.path.join(scenariodir2, store) 38 storen ='storen.txt' 39 file_path_storen = os.path.join(scenariodir2, storen) 40 storel = 'storel.txt' 41 file_path_storel = os.path.join(scenariodir2, store) 42 storea = 'store.txt' 43 file_path_storea = os.path.join(scenariodir2, storea) 33 44 45 f = open(file_path_storel,'r+') # SQRT extent this is set 46 length = float(f.readline()) 47 f.close() 34 48 35 PyVM.MemoryUpdate() 49 f = open(file_path_storea,'r+') #maxarea this is set 50 area = float(f.readline()) 51 f.close() 52 53 system_tools.MemoryUpdate() 36 54 #------------------------------------------------------------------------------ 37 55 # Create the triangular mesh and domain based on … … 46 64 'left': [3]}, 47 65 maximum_triangle_area=area, 48 mesh_filename= 'cairnsmesh.msh'66 mesh_filename=file_pathh 49 67 #,interior_regions=INTERIORREGIONS#, 50 68 #use_cache=True, … … 52 70 ) 53 71 54 n umber=len(domain)72 n = len(domain) 55 73 else: 56 74 domain = None … … 61 79 # Setup parameters of computational domain 62 80 #------------------------------------------------------------------------------ 63 domain.set_name('CAIRNS ') # Name of sww file64 domain.set_datadir( '.') # Store sww output here81 domain.set_name('CAIRNS.sww') # Name of sww file 82 domain.set_datadir(scenariodir2) # Store sww output here 65 83 66 84 #------------------------------------------------------------------------------ … … 93 111 'top': Br}) 94 112 113 95 114 #------------------------------------------------------------------------------ 96 115 # Evolve system through time … … 102 121 103 122 104 liststore.spacelist[myid] = PyVM.MemoryUpdate()[0]105 a = sum( liststore.spacelist)123 spacelist[myid] = system_tools.MemoryUpdate()[0] 124 a = sum(spacelist) 106 125 107 f = open('store.txt', 'r+')108 f.write(str(a))126 v = open(file_path_store, 'r+') 127 v.write(str(a)) 109 128 110 g = open('storel.txt', 'r+') 111 g.write(str(length)) 112 h = open('storea.txt', 'r+') 113 h.write(str(area)) 114 i = open('storen.txt', 'r+') 115 i.write(str(number)) 129 i = open(file_path_storen, 'r+') 130 i.write(str(n)) 116 131 132 -
trunk/anuga_work/development/mem_time_tests/triangles/fromregions/main.py
r8300 r8303 7 7 # Import standard shallow water domain and standard boundaries. 8 8 import anuga 9 import random10 9 import subprocess 11 10 import runcairns 12 11 import csv 13 12 import os 14 import PyVM15 13 import time 16 import liststore 14 from anuga.utilities import system_tools, log 15 from anuga.abstract_2d_finite_volumes.util import add_directories 17 16 18 17 #------------------------------------------------------------------------------ … … 20 19 #------------------------------------------------------------------------------ 21 20 a = [] 22 m = 20 23 spamWriter = csv.writer(open('ex1.csv', 'wb')) 21 22 23 home = os.getenv('INUNDATIONHOME') 24 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 25 "fromregions"]) 26 log.log_filename = os.path.join(scenariodir, 'log.txt') 27 28 file = 'ex1.csv' 29 file_path = os.path.join(scenariodir, file) 30 31 spamWriter = csv.writer(open(file_path, 'wb')) 24 32 spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) 25 33 … … 27 35 28 36 def runlist(r): 29 n = 20 30 while (n > 0): 31 c = random.random() * 2000 + 1 32 PyVM.MemoryUpdate() 37 for n in range(1,2000,100): 38 system_tools.MemoryUpdate() 33 39 z = time.time() 34 h = runcairns.runex( c,r)40 h = runcairns.runex(n,r) 35 41 y = time.time() 36 n = n -1 37 x = PyVM.MemoryUpdate()[0] 38 spamWriter.writerow([h,r,(c*c),x ,(y-z)]) 42 x = system_tools.MemoryUpdate()[0] 43 spamWriter.writerow([h,r,(n*n),x ,(y-z)]) 39 44 40 while (m > 0): 41 m = m -1 42 d = random.random() * 100 +1 43 d = 1.0 44 runlist(d) 45 for m in range(1,100,10): 46 runlist(m) 45 47 46 48 print 'DONE' -
trunk/anuga_work/development/mem_time_tests/triangles/fromregions/runcairns.py
r8300 r8303 24 24 25 25 # Related major packages 26 26 27 import anuga 28 from anuga.abstract_2d_finite_volumes.util import add_directories 27 29 28 import PyVM 29 import liststore 30 31 home = os.getenv('INUNDATIONHOME') 32 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 33 "fromregions"]) 34 35 36 file = 'CAIRNS.sww' 37 file_path = os.path.join(scenariodir, file) 38 39 h = 'CAIRNS.msh' 40 file_pathh = os.path.join(scenariodir, h) 30 41 31 42 def runex(l,a): 32 43 33 PyVM.MemoryUpdate()34 44 #------------------------------------------------------------------------------ 35 45 # Create the triangular mesh and domain based on … … 43 53 'left': [3]}, 44 54 maximum_triangle_area=a, 45 mesh_filename= 'cairnsmesh.msh'55 mesh_filename=file_pathh 46 56 #,interior_regions=INTERIORREGIONS#, 47 57 #use_cache=True, … … 55 65 # Setup parameters of computational domain 56 66 #------------------------------------------------------------------------------ 57 domain.set_name('CAIRNS ') # Name of sww file58 domain.set_datadir( '.') # Store sww output here67 domain.set_name('CAIRNS.sww') # Name of sww file 68 domain.set_datadir(scenariodir) # Store sww output here 59 69 60 70 #------------------------------------------------------------------------------ -
trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/main.py
r8300 r8303 7 7 # Import standard shallow water domain and standard boundaries. 8 8 import anuga 9 import random10 9 import subprocess 11 10 import runcairns 12 11 import csv 13 12 import os 14 import PyVM15 13 import time 16 import liststore 14 15 from anuga.utilities import system_tools, log 16 from anuga.abstract_2d_finite_volumes.util import add_directories 17 18 home = os.getenv('INUNDATIONHOME') 19 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 20 "rectanglecross"]) 21 22 log.log_filename = os.path.join(scenariodir, 'log.txt') 23 24 file = 'ex1.csv' 25 file_path = os.path.join(scenariodir, file) 17 26 18 27 #------------------------------------------------------------------------------ … … 20 29 #------------------------------------------------------------------------------ 21 30 a = [] 22 m = 20 23 spamWriter = csv.writer(open('ex1.csv', 'wb')) 31 spamWriter = csv.writer(open(file_path, 'wb')) 24 32 spamWriter.writerow(['Number Of Triangles' ,'MxM Rectangular Mesh', 'Extent', 'Space Used MB' , 'Time Taken s']) 25 33 … … 27 35 28 36 def runlist(r): 29 n = 20 30 while (n > 0): 31 c = random.random() * 2000 + 1 32 PyVM.MemoryUpdate() 37 for n in range(1,2000,100): 38 system_tools.MemoryUpdate() 33 39 z = time.time() 34 h = runcairns.runex( c,r)40 h = runcairns.runex(n,r) 35 41 y = time.time() 36 n = n -1 37 x = PyVM.MemoryUpdate()[0] 38 spamWriter.writerow([h,r,(c*c),x ,(y-z)]) 42 x = system_tools.MemoryUpdate()[0] 43 spamWriter.writerow([h,r,(n*n),x ,(y-z)]) 39 44 40 while (m > 0): 41 m = m -1 42 d = random.random() * 100 +1 43 d = 1.0 44 runlist(d) 45 for m in range(1,100,10): 46 runlist(m) 45 47 46 48 print 'DONE' -
trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/runcairns.py
r8300 r8303 25 25 # Related major packages 26 26 import anuga 27 from anuga.abstract_2d_finite_volumes.util import add_directories 27 28 28 import PyVM 29 import liststore 29 home = os.getenv('INUNDATIONHOME') 30 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 31 "rectanglecross"]) 32 33 34 file = 'CAIRNS.sww' 35 file_path = os.path.join(scenariodir, file) 36 37 h = 'CAIRNS.msh' 38 file_pathh = os.path.join(scenariodir, h) 39 30 40 31 41 def runex(l,a): 32 42 33 PyVM.MemoryUpdate() 43 34 44 #------------------------------------------------------------------------------ 35 45 # Create the triangular mesh and domain based on … … 47 57 # Setup parameters of computational domain 48 58 #------------------------------------------------------------------------------ 49 domain.set_name('CAIRNS ') # Name of sww file50 domain.set_datadir( '.') # Store sww output here59 domain.set_name('CAIRNS.sww') # Name of sww file 60 domain.set_datadir(scenariodir) # Store sww output here 51 61 52 62 #------------------------------------------------------------------------------ -
trunk/anuga_work/development/mem_time_tests/triangles/serial/main.py
r8300 r8303 13 13 import os 14 14 import time 15 from anuga.utilities import system_tools 15 from anuga.utilities import system_tools, log 16 16 from anuga.abstract_2d_finite_volumes.util import add_directories 17 18 17 #------------------------------------------------------------------------------ 19 18 # Setup computational domain … … 23 22 24 23 home = os.getenv('INUNDATIONHOME') 24 25 25 26 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 26 27 "serial"]) 28 file = 'ex1.csv' 27 29 30 log.log_filename = os.path.join(scenariodir, 'log.txt') 28 31 29 file = 'ex1.csv'30 32 file_path = os.path.join(scenariodir, file) 31 print "file_path",file_path33 #print "file_path",file_path 32 34 33 35 spamWriter = csv.writer(open(file_path, 'wb')) -
trunk/anuga_work/development/mem_time_tests/triangles/serial/runcairns.py
r8300 r8303 25 25 # Related major packages 26 26 import anuga 27 from anuga.abstract_2d_finite_volumes.util import add_directories 27 28 29 home = os.getenv('INUNDATIONHOME') 30 scenariodir = add_directories(home, ["data","mem_time_test", "triangles", 31 "serial"]) 32 33 34 file = 'CAIRNS.sww' 35 file_path = os.path.join(scenariodir, file) 36 37 h = 'CAIRNS.msh' 38 file_pathh = os.path.join(scenariodir, h) 28 39 29 40 def runex(l,a): … … 40 51 'left': [3]}, 41 52 maximum_triangle_area=a, 42 mesh_filename= 'cairnsmesh.msh'53 mesh_filename=file_pathh 43 54 #,interior_regions=INTERIORREGIONS#, 44 55 #use_cache=True, … … 52 63 # Setup parameters of computational domain 53 64 #------------------------------------------------------------------------------ 54 domain.set_name('CAIRNS ') # Name of sww file55 domain.set_datadir( '.') # Store sww output here65 domain.set_name('CAIRNS.sww') # Name of sww file 66 domain.set_datadir(scenariodir) # Store sww output here 56 67 #------------------------------------------------------------------------------ 57 68 # Setup initial conditions
Note: See TracChangeset
for help on using the changeset viewer.