Ignore:
Timestamp:
Jan 31, 2012, 10:54:12 AM (12 years ago)
Author:
pittj
Message:

formatted the experiment scripts

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 ANUGA
    2 Water flowing down a channel
    3 """
    41#------------------------------------------------------------------------------
    52# Import necessary modules
    63#------------------------------------------------------------------------------
    7 # Import standard shallow water domain and standard boundaries.
    84import anuga
    95import subprocess
     
    128import time
    139import liststore
    14 from anuga.utilities import system_tools, log
    1510from anuga.abstract_2d_finite_volumes.util import add_directories
    16 
     11from anuga.utilities.log_analyser import analyse_log
    1712
    1813#------------------------------------------------------------------------------
    19 # Setup computational domain
     14# Set up variables for the correct directories to store the output
    2015#------------------------------------------------------------------------------
    21 a = []
    22 #SpaceUsed = 0.0
    23 #number = 0
    24 
    25 home1 = os.getenv('INUNDATIONHOME')
     16home = os.getenv('INUNDATIONHOME')
    2617host = os.getenv('HOST')
    27 scenariodir = add_directories(home1, ["data","mem_time_test", "triangles","area"])
     18scenariodir = add_directories(home, ["data","mem_time_test", "triangles","area"])
    2819file1 = 'ex1.csv'
    2920file_path = os.path.join(scenariodir, file1)
     
    3223storea ='storea.txt'
    3324file_path_storea = os.path.join(scenariodir, storea)
    34 store ='store.txt'
    35 file_path_store = os.path.join(scenariodir, store)
    3625storen ='storen.txt'
    3726file_path_storen = os.path.join(scenariodir, storen)
    3827
    39 log.log_filename = os.path.join(scenariodir, 'log.txt')
    40 
     28#create and set up the files
    4129spamWriter = csv.writer(open(file_path, 'wb'))
    4230spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s'])
    43 e = open(file_path_store,'a')
    44 e.close()
    4531e = open(file_path_storea,'a')
    4632e.close()
     
    5036e.close()
    5137
     38# this is the main loops that assigns the maximum triangle area (m) and the map side length(l)
    5239
     40n = 4 #number of processors to use
    5341for m in range(90,100,10):
    54      n = 4 #number of processors to use
    5542     for l in range(100,2000,100):
    5643       
     44        #write these values to file
    5745        g = open(file_path_storel,'r+')
    5846        g.write(str(l))
     47        h = open(file_path_storea,'r+')
     48        h.write(str(m))
     49       
     50        z = time.time()# time it
    5951
    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
    6453        if (host == 'cyclone.agso.gov.au'):
    65             subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.6', 'runcairns.py'])
     54            subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
    6655        if (host == 'tornado.agso.gov.au'):
    67             subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.6', 'runcairns.py'])
     56            subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
    6857        if (host == 'vayu1'):
    6958            subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
     
    7362            subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
    7463       
    75         y = time.time()
     64        y = time.time()# time it
    7665
    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
    8167        f = open(file_path_storen,'r+')
    8268        i = float(f.readline())
    8369        f.close()
    8470
    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
    8872
    8973print 'Done'
    9074
     75analyse_log(scenariodir, 'metalog.csv') #get the memory statistics from the log files
     76
Note: See TracChangeset for help on using the changeset viewer.