Changeset 3776


Ignore:
Timestamp:
Oct 13, 2006, 2:43:30 PM (18 years ago)
Author:
ole
Message:

Made parallel abstraction work on sequential machine without pypar.
Work on simple parallel example (plotting)

Location:
anuga_core/source/anuga_parallel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga_parallel/parallel_abstraction.py

    r3628 r3776  
    3636        return time.time()
    3737
    38     #def send(*args, **kwargs):
    39     #    pass
     38    def send(*args, **kwargs):
     39        pass
    4040
    41     #def receive(*args, **kwargs):
    42     #    pass   
     41    def receive(*args, **kwargs):
     42        pass   
    4343
     44    pypar_available = False
    4445else:
    4546    from pypar import *
     47    pypar_available = True   
  • anuga_core/source/anuga_parallel/parallel_api.py

    r3635 r3776  
    55
    66# Parallelism
    7 # The Python-MPI interface
    8 from pypar import size, rank, get_processor_name, finalize, send, receive
    9 #from anuga_parallel.parallel_abstraction import size, rank, get_processor_name, finalize #,send, receive
     7
     8# The abstract Python-MPI interface
     9from anuga_parallel.parallel_abstraction import size, rank, get_processor_name
     10from anuga_parallel.parallel_abstraction import finalize, send, receive
     11from anuga_parallel.parallel_abstraction import pypar_available
     12
     13# Mesh partitioning
    1014from anuga_parallel.pmesh_divide  import pmesh_divide_metis
    1115from anuga_parallel.build_submesh import build_submesh
    1216from anuga_parallel.build_local   import build_local_mesh
    13 from anuga_parallel.build_commun  import send_submesh, rec_submesh, extract_hostmesh
    14 from anuga_parallel.parallel_shallow_water import Parallel_Domain
     17
     18# ANUGA parallel engine (only load if pypar can)
     19if pypar_available:
     20    from anuga_parallel.build_commun  import send_submesh
     21    from anuga_parallel.build_commun  import rec_submesh
     22    from anuga_parallel.build_commun  import extract_hostmesh
     23    from anuga_parallel.parallel_shallow_water import Parallel_Domain
    1524
    1625
     
    3039    """ Distribute the domain to all processes
    3140    """
     41
     42    if not pypar_available: return domain # Bypass
    3243
    3344    # For some obscure reason this communication must happen prior to
  • anuga_core/source/anuga_parallel/test_parallel_sw_runup.py

    r3775 r3776  
    9292print time
    9393print
    94 for i, _ in enumerate(interpolation_points):
     94for i, (x,y) in enumerate(interpolation_points):
    9595    print i, gauge_values[i]
    9696    print
    9797
    9898       
     99    try:
     100        from pylab import *
     101    except:
     102        pass
     103    else:
     104        ion()
     105        hold(False)
     106        plot(time, gauge_values[i], 'r.-')
     107        #time, predicted_gauge_values[i], 'k-')
     108       
     109        title('Gauge %d (%f,%f)' %(i,x,y))
     110        xlabel('time(s)')
     111        ylabel('stage (m)')   
     112        #legend(('Observed', 'Modelled'), shadow=True, loc='upper left')
     113        #savefig('Gauge_%d.png' %i, dpi = 300)
     114   
     115        raw_input('Next')
     116       
     117
     118
Note: See TracChangeset for help on using the changeset viewer.