source: trunk/anuga_work/development/mem_time_tests/hardware/cairns/main.py @ 8326

Last change on this file since 8326 was 8326, checked in by pittj, 12 years ago

formatted the experiment scripts

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1"""Simple water flow example using ANUGA
2Water flowing down a channel
3"""
4#------------------------------------------------------------------------------
5# Import necessary modules
6#------------------------------------------------------------------------------
7import anuga
8import subprocess
9import csv
10import os
11import time
12from anuga.abstract_2d_finite_volumes.util import add_directories
13from anuga.utilities.log_analyser import analyse_log
14
15#--------------------------------------------------------------------------------------
16# Set up variables for the correct directories to store the output
17#--------------------------------------------------------------------------------------
18host = os.getenv('HOST')
19home = os.getenv('INUNDATIONHOME')
20scenariodir = add_directories(home, ["data","mem_time_test", "parallel","cairns"])
21file1 = 'ex1.csv'
22file_path = os.path.join(scenariodir, file1)
23
24spamWriter = csv.writer(open(file_path, 'wb'))
25spamWriter.writerow(['Number Of Processors' , 'Space Used MB' , 'Time Taken s'])
26
27
28# main loop that runs macpus - 1 times
29maxcpus = 18
30
31for n in range(1,maxcpus,1):
32    z = time.time() # time it
33
34    #the necessary ways to run this script in parallel on the different hosts we use
35    if (host == 'cyclone.agso.gov.au'):
36        subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_cyclone', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) 
37    if (host == 'tornado.agso.gov.au'):
38        subprocess.call(['mpirun', '-np', str(n), '-hostfile' ,'~/machinefiles/test.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
39    if (host == 'vayu1'):
40        subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py']) 
41    if (host == 'rhe-compute1.ga.gov.au'):
42        subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.6', 'runcairns.py']) 
43    if (host == 'xe'):
44        subprocess.call(['mpirun', '-np', str(n), '-x','PYTHONPATH','-x','INUNDATIONHOME','python', 'runcairns.py'])
45
46    y = time.time()# time it
47    spamWriter.writerow([n,'x' ,(y-z)]) # write recorded results
48print 'DONE'
49
50analyse_log(scenariodir, 'metalog.csv') # interrogate log files for the memory usage information
Note: See TracBrowser for help on using the repository browser.