Exemple #1
0
def run():
    #Make sure we have one non-distributed dimension.
    np.datalayout([(2,1,1),(3,1,1)])
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\n"%(np.RANK),
        return
    try:#This test requires the scipy module
        from scipy import linalg
    except:
        print "[rank %d] Warning - ignored scipy not found\n"%(np.RANK),
        return
    try:#This test requires the pyHPC module
        import pyHPC
    except:
        print "[rank %d] Warning - ignored pyHPC not found\n"%(np.RANK),
        return
    if np.BLOCKSIZE > 10:
        print "[rank %d] Warning - ignored np.BLOCKSIZE too high\n"%(np.RANK),
        return

    #2D FFT
    for SIZE1 in xrange(np.BLOCKSIZE,np.BLOCKSIZE*8,np.BLOCKSIZE):
        for SIZE2 in xrange(np.BLOCKSIZE,np.BLOCKSIZE*8,np.BLOCKSIZE):
            src = dnumpytest.random_list([SIZE1,SIZE2])
            Ad = np.array(src, dtype=np.complex, dist=True)
            Af = np.array(src, dtype=np.complex, dist=False)
            Bd = pyHPC.fft2d(Ad)
            Bf = np.fft.fft2(Af)

            if not dnumpytest.array_equal(Bf,Bd,maxerror=1e-6):
                raise Exception("Uncorrect result array\n")

    #3D FFT
    for SIZE1 in xrange(np.BLOCKSIZE,np.BLOCKSIZE*4,np.BLOCKSIZE):
        for SIZE2 in xrange(np.BLOCKSIZE,np.BLOCKSIZE*4,np.BLOCKSIZE):
            for SIZE3 in xrange(np.BLOCKSIZE,np.BLOCKSIZE*4,np.BLOCKSIZE):
                src = dnumpytest.random_list([SIZE1,SIZE2,SIZE3])
                Ad = np.array(src, dtype=np.complex, dist=True)
                Af = np.array(src, dtype=np.complex, dist=False)
                Bd = pyHPC.fft3d(Ad)
                Bf = np.fft.fftn(Af)

        if not dnumpytest.array_equal(Bd,Bf,maxerror=1e-6):
            raise Exception("Uncorrect result array\n")
Exemple #2
0
import time
import numpy as np
import pyHPC
import util

np.datalayout([(3, 1, 1)])

parser = util.Parsing()
DIST = parser.dist
SIZE = int(parser.argv[0])
A = np.empty((SIZE, SIZE, SIZE), dtype=np.complex, dist=DIST)

if DIST:
    f = pyHPC.fft3d
else:
    f = np.fft.fftn

np.timer_reset()
f(A)
timing = np.timer_getdict()

if np.RANK == 0:
    print 'fft3d - size:,', np.shape(A)

parser.pprint(timing)
parser.write_dict(timing)
Exemple #3
0
import time
import numpy as np
import pyHPC
import util

np.datalayout([(2, 1, 1)])

parser = util.Parsing()
DIST = parser.dist
SIZE1 = int(parser.argv[0])
SIZE2 = int(parser.argv[1])
A = np.empty((SIZE1, SIZE2), dtype=np.complex, dist=DIST)

if DIST:
    f = pyHPC.fft2d
else:
    f = np.fft.fft2

np.timer_reset()
f(A)
timing = np.timer_getdict()

if np.RANK == 0:
    print 'fft2d - size:,', np.shape(A)

parser.pprint(timing)
parser.write_dict(timing)
Exemple #4
0
import time
import numpy as np
import pyHPC
import util

np.datalayout([(2, 1, 1)])

parser = util.Parsing()
DIST = parser.dist
SIZE1 = int(parser.argv[0])
SIZE2 = int(parser.argv[1])
A = np.empty((SIZE1, SIZE2), dtype=np.complex, dist=DIST)

if DIST:
    f = pyHPC.fft2d
else:
    f = np.fft.fft2

np.timer_reset()
f(A)
timing = np.timer_getdict()

if np.RANK == 0:
    print "fft2d - size:,", np.shape(A)

parser.pprint(timing)
parser.write_dict(timing)
Exemple #5
0
    if len(script_list) == 0:
        script_list = os.listdir(\
                      os.path.dirname(os.path.abspath(__file__)))

    if np.RANK == 0:
        print "*"*100
        print "*"*31, "Testing Distributed Numerical Python", "*"*31
    np.evalflush(barrier=True)
    for i in xrange(len(script_list)):
        f = script_list[i]
        if f.startswith("test_") and f.endswith("py")\
           and f not in exclude_list:
            m = f[:-3]#Remove ".py"
            m = __import__(m)
            np.datalayout(None)
            np.evalflush(barrier=True)
            if np.RANK == 0:
                print "*"*100
                print "Testing %s"%f
            np.evalflush(barrier=True)
            err = False
            msg = ""
            r1 = 0; r2 = 0
            if pydebug:
                r1 = sys.gettotalrefcount()
            try:
                np.evalflush(barrier=True)
                m.run()
                np.evalflush(barrier=True)
            except:
Exemple #6
0
import time
import numpy as np
import pyHPC
import util

np.datalayout([(3,1,1)])

parser = util.Parsing()
DIST = parser.dist
SIZE = int(parser.argv[0])
A = np.empty((SIZE,SIZE,SIZE), dtype=np.complex, dist=DIST)

if DIST:
    f = pyHPC.fft3d
else:
    f = np.fft.fftn

np.timer_reset()
f(A)
timing = np.timer_getdict()

if np.RANK == 0:
    print 'fft3d - size:,',np.shape(A)

parser.pprint(timing)
parser.write_dict(timing)