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

adding scripts for the memory and time experiments

File:
1 edited

Legend:

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