Changeset 9116


Ignore:
Timestamp:
May 15, 2014, 2:16:21 PM (11 years ago)
Author:
steve
Message:

Fixed test_pypar_ext.py

Location:
trunk/anuga_core/source/anuga_parallel/pypar_extras
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga_parallel/pypar_extras/pypar_ext.py

    r8514 r9116  
    230230
    231231    import types
    232     from mpiext import size
     232    from pypar import size
    233233    numproc = size()         # Needed to determine buffer size
    234234
  • trunk/anuga_core/source/anuga_parallel/pypar_extras/test_pypar_ext.py

    r8514 r9116  
    2020#print "Importing pypar"
    2121import pypar
     22import pypar_ext as par_exts
     23#import pypar as par_exts
     24par_exts_methods = dir(par_exts)
     25assert 'allreduce' in par_exts_methods
    2226methods = dir(pypar)
    2327assert 'abort' in methods
     
    902906  X = numpy.zeros(N, 'i') # Buffer for results
    903907
    904   pypar.allreduce(testArray, pypar.SUM, buffer=X)
     908  par_exts.allreduce(testArray, pypar.SUM, buffer=X)
    905909
    906910  if myid == 0:
     
    911915    print 'Buffered allreduce using pypar.SUM OK'
    912916
    913   pypar.allreduce(testArray, pypar.MAX, buffer=X)
     917  par_exts.allreduce(testArray, pypar.MAX, buffer=X)
    914918  if myid == 0:
    915919    Y = numpy.array(range(N))*numproc
     
    917921    print 'Buffered allreduce using pypar.MAX OK'
    918922
    919   pypar.allreduce(testArray, pypar.MIN, buffer=X)
     923  par_exts.allreduce(testArray, pypar.MIN, buffer=X)
    920924  if myid == 0:
    921925    Y = numpy.array(range(N))
     
    927931    X_float = X.astype('f')
    928932
    929     pypar.allreduce(testArray_float, pypar.PROD, buffer=X_float)
     933    par_exts.allreduce(testArray_float, pypar.PROD, buffer=X_float)
    930934    if myid == 0:
    931935      Y = numpy.ones(N).astype('f')
     
    940944      print "Skipping product-allreduce - try again with numproc < 20"
    941945
    942   pypar.allreduce(testArray, pypar.LAND, buffer=X)
     946  par_exts.allreduce(testArray, pypar.LAND, buffer=X)
    943947  if myid == 0:
    944948    Y = numpy.ones(N).astype('i')
     
    948952    print 'Buffered allreduce using pypar.LAND OK'
    949953
    950   pypar.allreduce(testArray, pypar.BAND, buffer=X)
     954  par_exts.allreduce(testArray, pypar.BAND, buffer=X)
    951955  if myid == 0:
    952956    Y = numpy.ones(N).astype('i')*255  #Neutral element for &
     
    956960    print 'Buffered allreduce using pypar.BAND OK'
    957961
    958   pypar.allreduce(testArray, pypar.LOR, buffer=X)
     962  par_exts.allreduce(testArray, pypar.LOR, buffer=X)
    959963  if myid == 0:
    960964    Y = numpy.zeros(N).astype('i')
     
    964968    print 'Buffered allreduce using pypar.LOR OK'
    965969
    966   pypar.allreduce(testArray, pypar.BOR, buffer=X)
     970  par_exts.allreduce(testArray, pypar.BOR, buffer=X)
    967971  if myid == 0:
    968972    Y = numpy.zeros(N).astype('i')   #Neutral element for |
     
    972976    print 'Buffered allreduce using pypar.BOR OK'
    973977
    974   pypar.allreduce(testArray, pypar.LXOR, buffer=X)
     978  par_exts.allreduce(testArray, pypar.LXOR, buffer=X)
    975979  if myid == 0:
    976980    Y = numpy.zeros(N).astype('i')
     
    980984    print 'Buffered allreduce using pypar.LXOR OK'
    981985
    982   pypar.allreduce(testArray, pypar.BXOR, buffer=X)
     986  par_exts.allreduce(testArray, pypar.BXOR, buffer=X)
    983987  if myid == 0:
    984988    Y = numpy.zeros(N).astype('i')   #Neutral element for xor ?
Note: See TracChangeset for help on using the changeset viewer.