Changeset 126 for pypar/pypar.py


Ignore:
Timestamp:
Jul 11, 2005, 6:07:06 PM (19 years ago)
Author:
ole
Message:

Added bypass to reduce and broadcast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pypar/pypar.py

    r123 r126  
    4747
    4848# Meta data
    49 __version__ = '1.9.1'
    50 __date__ = '15 December 2003'
     49__version__ = '1.9.2'
     50__date__ = '11 July 2005'
    5151__author__ = 'Ole M. Nielsen'
    5252
     
    208208
    209209
    210 def broadcast(buffer, root, vanilla=False):
     210def broadcast(buffer, root, vanilla=False, bypass=False):
    211211    """Wrapper for MPI bcast.
    212212
     
    221221       Setting vanilla = 1 forces vanilla mode for any type.
    222222
    223     """
     223       If bypass is True, all admin and error checks
     224       get bypassed to reduce the latency.
     225
     226    """
     227
     228    if bypass:
     229        broadcast_array(buffer, root)
     230        return
     231   
    224232
    225233    import types
     
    350358
    351359
    352 def reduce(x, op, root, buffer=None, vanilla=0):
     360def reduce(x, op, root, buffer=None, vanilla=0, bypass=False):
    353361    """Reduce elements in x to buffer (of the same size as x)
    354362       at root applying operation op elementwise.
    355     """
    356 
    357     import types
    358    
     363
     364       If bypass is True, all admin and error checks
     365       get bypassed to reduce the latency.
     366       The buffer must be specified explicitly in this case.
     367    """
     368
     369
     370
     371    if bypass:
     372        reduce_array(x, buffer, op, root)
     373        return
     374   
     375
     376    import types   
    359377    from mpiext import size
    360378    numproc = size()         #Needed to determine buffer size
Note: See TracChangeset for help on using the changeset viewer.