Changeset 8272


Ignore:
Timestamp:
Dec 7, 2011, 5:01:16 PM (12 years ago)
Author:
steve
Message:

added sww_merge to parallel_domain functions

Location:
trunk/anuga_core/source/anuga_parallel
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga_parallel/INSTALL-README

    r8225 r8272  
    11
    2 =========================
    3 INSTALLING anuga_parallel
    4 =========================
    5 
    6 anuga_parallel
    7 ==============
    8 
    9 Well first you need to get the anuga_parallel code. You can get this from
    10 our svn repository with userid anonymous (blank password)
    11 
    12 The location is
    13 
    14 https://anuga.anu.edu.au/svn/anuga/trunk/anuga_core/source/anuga_parallel
    15 
    16 (By the way, the most recent version of the development code of anuga
    17 is available at
    18 
    19 https://anuga.anu.edu.au/svn/anuga/trunk/anuga_core/source/anuga
    20 )
    21 
    22 Setup your PYTHONPATH to point to location of the source directory
    23 
    24 For instance I havethe following line in my .bashrc file
    25 
    26 export PYTHONPATH=/home/steve/anuga/anuga_core/source
    27 
    28 
    29 
    30 MPI
    31 ===
    32 
    33 Now you need to install MPI on your system. OPENMPI and MPICH2
    34 are supported by pypar (see below) so both should be ok.
    35 
    36 Make sure mpi works. You should be able to run a program in parallel.
    37 
    38 Try something as simple as
    39 
    40 mpirun -np 4 pwd
    41 
    42 should produce the output of pwd 4 times.
    43 
    44 PYPAR
    45 ======
    46 
    47 We use pypar as the interface between mpi and python. The most recent
    48 version of PYPAR is available from
    49 
    50 http://code.google.com/p/pypar/
    51 
    52 (There is an old version on sourceforge
    53 http://sourceforge.net/projects/pypar/ don't use that)
    54 
    55 Install pypar following the instructions in the download. Should be able
    56 use standard command
    57 
    58 python setup.py install
    59 
    60 or maybe
    61 
    62 sudo python setup.py install
    63 
    64 
    65 Make sure the pypar examples work
    66 
    67 
    68 PYMETIS
    69 =======
    70 
    71 In the anuga_parallel directory there is a subdirectory pymetis.
    72 
    73 Follow the instructions in README to install. Essentially just run make.
    74 
    75 If you have a 64 bit machine run
    76 
    77 make COPTIONS="-fPIC"
    78 
    79 From the pymetis directory, test using test_all.py, ie
    80 
    81 python test_all.py
    82 
    83 ANUGA_PARALLEL
    84 ==============
    85 
    86 Should now be ready to run some parallel anuga code.
    87 
    88 Go back to the anuga_parallel directory and run test_all.py
    89 
    90 Hopefully that all works.
    91 
    92 Run run_parallel_sw_merimbula.py
    93 
    94 First just run it as a sequential program, via
    95 
    96 python run_parallel_sw_merimbula.py
    97 
    98 Then try a parallel run using a command like
    99 
    100 mpirun -np 4 python run_parallel_sw_merimbula.py
    101 
    102 That should run on 4 processors
    103 
    104 You should look at the code in  run_parallel_sw_merimbula.py
    105 
    106 Essentially a fairly standard example, with the extra command
    107 
    108 domain = distribute(domain)
    109 
    110 which sets up all the parallel stuff.
    111 
    112 Also for efficiency reasons we only setup the original full sequential mesh
    113 on processor 0, hence the statement
    114 
    115 if myid == 0:
    116      domain = create_domain_from_file(mesh_filename)
    117      domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
    118 else:
    119      domain = None
    120 
    121 The output will be an sww file associated to each
    122 processor.
    123 
    124 There is a script anuga/utilities/sww_merge.py which provides
    125 a function to merge sww files into one sww file for viewing
    126 with the anuga viewer.
     2Read http://anuga.anu.edu.au/wiki/AnugaParallel
     3 
  • trunk/anuga_core/source/anuga_parallel/parallel_api.py

    r8260 r8272  
    4040    """
    4141
     42    barrier()
    4243
    4344    # FIXME: Dummy assignment (until boundaries are refactored to
  • trunk/anuga_core/source/anuga_parallel/parallel_shallow_water.py

    r8262 r8272  
    6363        setup_buffers(self)
    6464
     65        self.global_name = 'domain'
    6566        self.tri_map = tri_map
    6667        self.inv_tri_map = inv_tri_map
     
    7475            name = name[:-4]
    7576
     77        self.global_name = name
     78
    7679        # Call parents method with processor number attached.
    7780        Domain.set_name(self, name + '_P%d_%d' %(self.processor, self.numproc))
     81
     82
     83    def get_global_name(self):
     84
     85        return self.global_name
    7886
    7987
     
    104112
    105113        self.update_ghosts()
     114
     115
     116
     117    def sww_merge(self, verbose=False):
     118
     119        if self.processor == 0 and self.numproc > 1:
     120            import anuga.utilities.sww_merge as merge
     121           
     122            merge.sww_merge(self.get_global_name(),self.numproc,verbose)
     123
    106124
    107125# =======================================================================
     
    202220            pypar.send(vertices[ghost_mask,0], 0)
    203221            pypar.send(vertices[ghost_mask,1], 0)
    204 
     222           
     223
  • trunk/anuga_core/source/anuga_parallel/run_parallel_sw_merimbula.py

    r8191 r8272  
    4545#mesh_filename = "merimbula_43200.tsh"   ; x0 = 756000.0 ; x1 = 756500.0
    4646#mesh_filename = "test-100.tsh" ; x0 = 0.25 ; x1 = 0.5
    47 yieldstep = 5
    48 finaltime = 200
     47yieldstep = 20
     48finaltime = 500
    4949verbose = True
    5050
     
    7878
    7979if myid == 0 and verbose: print 'DISTRIBUTING DOMAIN'
    80 domain = distribute(domain)
     80domain = distribute(domain,verbose=True)
    8181
    8282#domain.smooth = False
     
    116116
    117117
     118#--------------------------------------------------
     119# Merge the individual sww files into one file
     120#--------------------------------------------------
     121domain.sww_merge(verbose=True)
     122
    118123finalize()
    119124
Note: See TracChangeset for help on using the changeset viewer.