Changeset 8303


Ignore:
Timestamp:
Jan 18, 2012, 1:32:53 PM (13 years ago)
Author:
pittj
Message:

adding scripts for the memory and time experiments

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  
    77# Import standard shallow water domain and standard boundaries.
    88import anuga
    9 import random
    109import subprocess
    11 import run_parallel
    1210import csv
    1311import os
    1412import time
    15 import liststore
     13from anuga.utilities import system_tools, log
     14from anuga.abstract_2d_finite_volumes.util import add_directories
     15
    1616
    1717#------------------------------------------------------------------------------
     
    1919#------------------------------------------------------------------------------
    2020a = []
    21 n = 300
    22 spamWriter = csv.writer(open('ex1.csv', 'wb'))
     21#SpaceUsed = 0.0
     22#number = 0
     23spacelist = [0,0,0,0]
     24
     25home = os.getenv('INUNDATIONHOME')
     26scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"])
     27file = 'ex1.csv'
     28file_path = os.path.join(scenariodir, file)
     29storel ='storel.txt'
     30file_path_storel = os.path.join(scenariodir, storel)
     31storea ='storea.txt'
     32file_path_storea = os.path.join(scenariodir, storea)
     33store ='store.txt'
     34file_path_store = os.path.join(scenariodir, store)
     35storen ='storen.txt'
     36file_path_storen = os.path.join(scenariodir, storen)
     37
     38spamWriter = csv.writer(open(file_path, 'wb'))
    2339spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s'])
    2440
    2541
    26 while (n > 0):
    27     z = time.time()
    28     run_parallel.runex(4)
    29     n = n -1
    30     y = time.time()
     42def 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))
    3148
    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))
    3551
    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()
    3955
    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()
    4359
    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()
    4763
    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]
    4966
    50     liststore.spacelist = [0,0,0,0]
    51 print a
     67for m in range(1,100,10):
     68    rum(m)
    5269
     70print 'Done'
     71
  • trunk/anuga_work/development/mem_time_tests/triangles/area/runcairns.py

    r8300 r8303  
    1919import time
    2020import sys
    21 import random
     21import main
    2222
    2323# Related major packages
    2424import anuga
     25from anuga_parallel import distribute, myid
     26from anuga.abstract_2d_finite_volumes.util import add_directories
     27from anuga.utilities import system_tools, log
    2528
    26 from anuga_parallel import distribute, myid, numprocs, finalize, barrier
     29spacelist = [0,0,0,0]
    2730
    28 import PyVM
    29 import liststore
     31#home = os.getenv('INUNDATIONHOME')
     32scenariodir2 = add_directories(main.home, ["data", "mem_time_test", "triangles", "area"])
    3033
    31 length = random.random()*2000 + 1
    32 area = random.random()*100 + 1
     34h = 'CAIRNS.msh'
     35file_pathh = os.path.join(scenariodir2, h)
     36store ='store.txt'
     37file_path_store = os.path.join(scenariodir2, store)
     38storen ='storen.txt'
     39file_path_storen = os.path.join(scenariodir2, storen)
     40storel = 'storel.txt'
     41file_path_storel = os.path.join(scenariodir2, store)
     42storea = 'store.txt'
     43file_path_storea = os.path.join(scenariodir2, storea)
    3344
     45f = open(file_path_storel,'r+') # SQRT extent this is set
     46length = float(f.readline())
     47f.close()
    3448
    35 PyVM.MemoryUpdate()
     49f = open(file_path_storea,'r+') #maxarea this is set
     50area = float(f.readline())
     51f.close()
     52
     53system_tools.MemoryUpdate()
    3654#------------------------------------------------------------------------------
    3755# Create the triangular mesh and domain based on
     
    4664                                                   'left': [3]},
    4765                                    maximum_triangle_area=area,
    48                                     mesh_filename='cairnsmesh.msh'
     66                                    mesh_filename=file_pathh
    4967                                    #,interior_regions=INTERIORREGIONS#,
    5068                                    #use_cache=True,
     
    5270                                    )
    5371
    54     number=len(domain)
     72    n = len(domain)
    5573else:
    5674    domain = None
     
    6179# Setup parameters of computational domain
    6280#------------------------------------------------------------------------------
    63 domain.set_name('CAIRNS') # Name of sww file
    64 domain.set_datadir('.')                       # Store sww output here
     81domain.set_name('CAIRNS.sww') # Name of sww file
     82domain.set_datadir(scenariodir2)                       # Store sww output here
    6583
    6684#------------------------------------------------------------------------------
     
    93111                     'top': Br})
    94112
     113
    95114#------------------------------------------------------------------------------
    96115# Evolve system through time
     
    102121   
    103122
    104 liststore.spacelist[myid] = PyVM.MemoryUpdate()[0]
    105 a = sum(liststore.spacelist)
     123spacelist[myid] = system_tools.MemoryUpdate()[0]
     124a = sum(spacelist)
    106125
    107 f = open('store.txt', 'r+')
    108 f.write(str(a))
     126v = open(file_path_store, 'r+')
     127v.write(str(a))
    109128
    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))
     129i = open(file_path_storen, 'r+')
     130i.write(str(n))
    116131
     132
  • trunk/anuga_work/development/mem_time_tests/triangles/fromregions/main.py

    r8300 r8303  
    77# Import standard shallow water domain and standard boundaries.
    88import anuga
    9 import random
    109import subprocess
    1110import runcairns
    1211import csv
    1312import os
    14 import PyVM
    1513import time
    16 import liststore
     14from anuga.utilities import system_tools, log
     15from anuga.abstract_2d_finite_volumes.util import add_directories
    1716
    1817#------------------------------------------------------------------------------
     
    2019#------------------------------------------------------------------------------
    2120a = []
    22 m = 20
    23 spamWriter = csv.writer(open('ex1.csv', 'wb'))
     21
     22
     23home = os.getenv('INUNDATIONHOME')
     24scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
     25                                     "fromregions"])
     26log.log_filename = os.path.join(scenariodir, 'log.txt')
     27
     28file = 'ex1.csv'
     29file_path = os.path.join(scenariodir, file)
     30
     31spamWriter = csv.writer(open(file_path, 'wb'))
    2432spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s'])
    2533
     
    2735
    2836def 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()
    3339        z = time.time()
    34         h = runcairns.runex(c,r)
     40        h = runcairns.runex(n,r)
    3541        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)])
    3944
    40 while (m > 0):
    41     m = m -1
    42     d = random.random() * 100 +1
    43     d = 1.0
    44     runlist(d)
     45for m in range(1,100,10):
     46    runlist(m)
    4547
    4648print 'DONE'
  • trunk/anuga_work/development/mem_time_tests/triangles/fromregions/runcairns.py

    r8300 r8303  
    2424
    2525# Related major packages
     26
    2627import anuga
     28from anuga.abstract_2d_finite_volumes.util import add_directories
    2729
    28 import PyVM
    29 import liststore
     30
     31home = os.getenv('INUNDATIONHOME')
     32scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
     33                                     "fromregions"])
     34
     35
     36file = 'CAIRNS.sww'
     37file_path = os.path.join(scenariodir, file)
     38
     39h = 'CAIRNS.msh'
     40file_pathh = os.path.join(scenariodir, h)
    3041
    3142def runex(l,a):
    3243
    33     PyVM.MemoryUpdate()
    3444#------------------------------------------------------------------------------
    3545# Create the triangular mesh and domain based on
     
    4353                                                   'left': [3]},
    4454                                    maximum_triangle_area=a,
    45                                     mesh_filename='cairnsmesh.msh'
     55                                    mesh_filename=file_pathh
    4656                                    #,interior_regions=INTERIORREGIONS#,
    4757                                    #use_cache=True,
     
    5565# Setup parameters of computational domain
    5666#------------------------------------------------------------------------------
    57     domain.set_name('CAIRNS') # Name of sww file
    58     domain.set_datadir('.')                       # Store sww output here
     67    domain.set_name('CAIRNS.sww') # Name of sww file
     68    domain.set_datadir(scenariodir)                       # Store sww output here
    5969
    6070#------------------------------------------------------------------------------
  • trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/main.py

    r8300 r8303  
    77# Import standard shallow water domain and standard boundaries.
    88import anuga
    9 import random
    109import subprocess
    1110import runcairns
    1211import csv
    1312import os
    14 import PyVM
    1513import time
    16 import liststore
     14
     15from anuga.utilities import system_tools, log
     16from anuga.abstract_2d_finite_volumes.util import add_directories
     17
     18home = os.getenv('INUNDATIONHOME')
     19scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
     20                                     "rectanglecross"])
     21
     22log.log_filename = os.path.join(scenariodir, 'log.txt')
     23
     24file = 'ex1.csv'
     25file_path = os.path.join(scenariodir, file)
    1726
    1827#------------------------------------------------------------------------------
     
    2029#------------------------------------------------------------------------------
    2130a = []
    22 m = 20
    23 spamWriter = csv.writer(open('ex1.csv', 'wb'))
     31spamWriter = csv.writer(open(file_path, 'wb'))
    2432spamWriter.writerow(['Number Of Triangles' ,'MxM Rectangular Mesh', 'Extent', 'Space Used MB' , 'Time Taken s'])
    2533
     
    2735
    2836def 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()
    3339        z = time.time()
    34         h = runcairns.runex(c,r)
     40        h = runcairns.runex(n,r)
    3541        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)])
    3944
    40 while (m > 0):
    41     m = m -1
    42     d = random.random() * 100 +1
    43     d = 1.0
    44     runlist(d)
     45for m in range(1,100,10):
     46    runlist(m)
    4547
    4648print 'DONE'
  • trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/runcairns.py

    r8300 r8303  
    2525# Related major packages
    2626import anuga
     27from anuga.abstract_2d_finite_volumes.util import add_directories
    2728
    28 import PyVM
    29 import liststore
     29home = os.getenv('INUNDATIONHOME')
     30scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
     31                                     "rectanglecross"])
     32
     33
     34file = 'CAIRNS.sww'
     35file_path = os.path.join(scenariodir, file)
     36
     37h = 'CAIRNS.msh'
     38file_pathh = os.path.join(scenariodir, h)
     39
    3040
    3141def runex(l,a):
    3242
    33     PyVM.MemoryUpdate()
     43
    3444#------------------------------------------------------------------------------
    3545# Create the triangular mesh and domain based on
     
    4757# Setup parameters of computational domain
    4858#------------------------------------------------------------------------------
    49     domain.set_name('CAIRNS') # Name of sww file
    50     domain.set_datadir('.')                       # Store sww output here
     59    domain.set_name('CAIRNS.sww') # Name of sww file
     60    domain.set_datadir(scenariodir)                       # Store sww output here
    5161
    5262#------------------------------------------------------------------------------
  • trunk/anuga_work/development/mem_time_tests/triangles/serial/main.py

    r8300 r8303  
    1313import os
    1414import time
    15 from anuga.utilities import system_tools
     15from anuga.utilities import system_tools, log
    1616from anuga.abstract_2d_finite_volumes.util import add_directories
    17 
    1817#------------------------------------------------------------------------------
    1918# Setup computational domain
     
    2322
    2423home = os.getenv('INUNDATIONHOME')
     24
     25
    2526scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
    2627                                     "serial"])
     28file = 'ex1.csv'
    2729
     30log.log_filename = os.path.join(scenariodir, 'log.txt')
    2831
    29 file = 'ex1.csv'
    3032file_path = os.path.join(scenariodir, file)
    31 print "file_path",file_path
     33#print "file_path",file_path
    3234
    3335spamWriter = csv.writer(open(file_path, 'wb'))
  • trunk/anuga_work/development/mem_time_tests/triangles/serial/runcairns.py

    r8300 r8303  
    2525# Related major packages
    2626import anuga
     27from anuga.abstract_2d_finite_volumes.util import add_directories
    2728
     29home = os.getenv('INUNDATIONHOME')
     30scenariodir = add_directories(home, ["data","mem_time_test", "triangles",
     31                                     "serial"])
     32
     33
     34file = 'CAIRNS.sww'
     35file_path = os.path.join(scenariodir, file)
     36
     37h = 'CAIRNS.msh'
     38file_pathh = os.path.join(scenariodir, h)
    2839
    2940def runex(l,a):
     
    4051                                                   'left': [3]},
    4152                                    maximum_triangle_area=a,
    42                                     mesh_filename='cairnsmesh.msh'
     53                                    mesh_filename=file_pathh
    4354                                    #,interior_regions=INTERIORREGIONS#,
    4455                                    #use_cache=True,
     
    5263# Setup parameters of computational domain
    5364#------------------------------------------------------------------------------
    54     domain.set_name('CAIRNS') # Name of sww file
    55     domain.set_datadir('.')                       # Store sww output here
     65    domain.set_name('CAIRNS.sww') # Name of sww file
     66    domain.set_datadir(scenariodir)                       # Store sww output here
    5667#------------------------------------------------------------------------------
    5768# Setup initial conditions
Note: See TracChangeset for help on using the changeset viewer.