Beispiel #1
0
def run():
    max_ndim = 6
    for i in xrange(1,max_ndim+1):
        src = dnumpytest.random_list(range(2, i+2))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        Bd = np.array(src, dtype=float, dist=True)
        Bf = np.array(src, dtype=float, dist=False)
        Cd = Ad + Bd + 42 + Bd[-1]
        Cf = Af + Bf + 42 + Bf[-1]
        Cd = Cd[::2] + Cd[::2,...] + Cd[0,np.newaxis]
        Cf = Cf[::2] + Cf[::2,...] + Cf[0,np.newaxis]
        Dd = np.array(Cd, dtype=float, dist=True)
        Df = np.array(Cf, dtype=float, dist=False)
        Dd[1:] = Cd[:-1]
        Df[1:] = Cf[:-1]
        Cd = Dd + Bd[np.newaxis,-1]
        Cf = Df + Bf[np.newaxis,-1]
        Cd[1:] = Cd[:-1]
        Cf[1:] = Cf[:-1]
        if not dnumpytest.array_equal(Cd,Cf):
            raise Exception("Uncorrect result array\n")

    for i in xrange(3,max_ndim+3):
        src = dnumpytest.random_list([i,i,i])
        Ad = np.array(src, dist=True, dtype=float)
        Af = np.array(src, dist=False, dtype=float)
        Bd = np.array(src, dist=True, dtype=float)
        Bf = np.array(src, dist=False, dtype=float)
        Cd = Ad[::2, ::2, ::2] + Bd[::2, ::2, ::2] + Ad[::2,1,2]
        Cf = Af[::2, ::2, ::2] + Bf[::2, ::2, ::2] + Af[::2,1,2]
        if not dnumpytest.array_equal(Cd,Cf):
            raise Exception("Uncorrect result array\n")
Beispiel #2
0
def run():
    max_ndim = 6
    for i in xrange(1, max_ndim + 1):
        src = dnumpytest.random_list(range(2, i + 2))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        Bd = np.array(src, dtype=float, dist=True)
        Bf = np.array(src, dtype=float, dist=False)
        Cd = Ad + Bd + 42 + Bd[-1]
        Cf = Af + Bf + 42 + Bf[-1]
        Cd = Cd[::2] + Cd[::2, ...] + Cd[0, np.newaxis]
        Cf = Cf[::2] + Cf[::2, ...] + Cf[0, np.newaxis]
        Dd = np.array(Cd, dtype=float, dist=True)
        Df = np.array(Cf, dtype=float, dist=False)
        Dd[1:] = Cd[:-1]
        Df[1:] = Cf[:-1]
        Cd = Dd + Bd[np.newaxis, -1]
        Cf = Df + Bf[np.newaxis, -1]
        Cd[1:] = Cd[:-1]
        Cf[1:] = Cf[:-1]
        if not dnumpytest.array_equal(Cd, Cf):
            raise Exception("Uncorrect result array\n")

    for i in xrange(3, max_ndim + 3):
        src = dnumpytest.random_list([i, i, i])
        Ad = np.array(src, dist=True, dtype=float)
        Af = np.array(src, dist=False, dtype=float)
        Bd = np.array(src, dist=True, dtype=float)
        Bf = np.array(src, dist=False, dtype=float)
        Cd = Ad[::2, ::2, ::2] + Bd[::2, ::2, ::2] + Ad[::2, 1, 2]
        Cf = Af[::2, ::2, ::2] + Bf[::2, ::2, ::2] + Af[::2, 1, 2]
        if not dnumpytest.array_equal(Cd, Cf):
            raise Exception("Uncorrect result array\n")
Beispiel #3
0
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    #Non-view test - identical to the one in test_dot.py
    niter = 6
    for m in range(2,niter+2):
        for n in range(2,niter+2):
            for k in range(2,niter+2):
                Asrc = dnumpytest.random_list([k,m])
                Bsrc = dnumpytest.random_list([n,k])
                Ad = np.array(Asrc, dtype=float, dist=True)
                Af = np.array(Asrc, dtype=float, dist=False)
                Bd = np.array(Bsrc, dtype=float, dist=True)
                Bf = np.array(Bsrc, dtype=float, dist=False)
                Cd = pyHPC.summa(Ad,Bd)
                Cf = np.dot(Af,Bf)
                if not dnumpytest.array_equal(Cd,Cf):
                    raise Exception("Uncorrect result matrix\n")
    niter *= 2
    Asrc = dnumpytest.random_list([niter,niter])
    Bsrc = dnumpytest.random_list([niter,niter])
    Ad = np.array(Asrc, dtype=float, dist=True)
    Af = np.array(Asrc, dtype=float, dist=False)
    Bd = np.array(Bsrc, dtype=float, dist=True)
    Bf = np.array(Bsrc, dtype=float, dist=False)
    Cd = np.zeros((niter,niter),dtype=float, dist=True)
    BS = np.BLOCKSIZE
    for m in xrange(0,niter-BS, BS):
        for n in xrange(0,niter-BS,BS):
            for k in xrange(0,niter-BS,BS):
                tAd = Ad[m:,k:]
                tAf = Af[m:,k:]
                tBd = Bd[k:,n:]
                tBf = Bf[k:,n:]
                tCd = Cd[m:,n:]
                tCd = pyHPC.matmul(tAd,tBd)
                tCf = np.dot(tAf,tBf)
                if not dnumpytest.array_equal(tCd,tCf):
                    raise Exception("Uncorrect result matrix\n")
    for m in xrange(BS,niter+BS, BS):
        for n in xrange(BS,niter+BS,BS):
            for k in xrange(BS,niter+BS,BS):
                tAd = Ad[:m,:k]
                tAf = Af[:m,:k]
                tBd = Bd[:k,:n]
                tBf = Bf[:k,:n]
                tCd = Cd[:m,:n]
                tCd = pyHPC.matmul(tAd,tBd)
                tCf = np.dot(tAf,tBf)
                if not dnumpytest.array_equal(tCd,tCf):
                    raise Exception("Uncorrect result matrix\n")
Beispiel #4
0
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    #Non-view test - identical to the one in test_dot.py
    niter = 6
    for m in range(2, niter + 2):
        for n in range(2, niter + 2):
            for k in range(2, niter + 2):
                Asrc = dnumpytest.random_list([k, m])
                Bsrc = dnumpytest.random_list([n, k])
                Ad = np.array(Asrc, dtype=float, dist=True)
                Af = np.array(Asrc, dtype=float, dist=False)
                Bd = np.array(Bsrc, dtype=float, dist=True)
                Bf = np.array(Bsrc, dtype=float, dist=False)
                Cd = pyHPC.summa(Ad, Bd)
                Cf = np.dot(Af, Bf)
                if not dnumpytest.array_equal(Cd, Cf):
                    raise Exception("Uncorrect result matrix\n")
    niter *= 2
    Asrc = dnumpytest.random_list([niter, niter])
    Bsrc = dnumpytest.random_list([niter, niter])
    Ad = np.array(Asrc, dtype=float, dist=True)
    Af = np.array(Asrc, dtype=float, dist=False)
    Bd = np.array(Bsrc, dtype=float, dist=True)
    Bf = np.array(Bsrc, dtype=float, dist=False)
    Cd = np.zeros((niter, niter), dtype=float, dist=True)
    BS = np.BLOCKSIZE
    for m in xrange(0, niter - BS, BS):
        for n in xrange(0, niter - BS, BS):
            for k in xrange(0, niter - BS, BS):
                tAd = Ad[m:, k:]
                tAf = Af[m:, k:]
                tBd = Bd[k:, n:]
                tBf = Bf[k:, n:]
                tCd = Cd[m:, n:]
                tCd = pyHPC.matmul(tAd, tBd)
                tCf = np.dot(tAf, tBf)
                if not dnumpytest.array_equal(tCd, tCf):
                    raise Exception("Uncorrect result matrix\n")
    for m in xrange(BS, niter + BS, BS):
        for n in xrange(BS, niter + BS, BS):
            for k in xrange(BS, niter + BS, BS):
                tAd = Ad[:m, :k]
                tAf = Af[:m, :k]
                tBd = Bd[:k, :n]
                tBf = Bf[:k, :n]
                tCd = Cd[:m, :n]
                tCd = pyHPC.matmul(tAd, tBd)
                tCf = np.dot(tAf, tBf)
                if not dnumpytest.array_equal(tCd, tCf):
                    raise Exception("Uncorrect result matrix\n")
Beispiel #5
0
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    max_ndim = 3
    for i in xrange(4, max_ndim + 4):
        SIZE = i * np.BLOCKSIZE
        src = dnumpytest.random_list(
            range(np.BLOCKSIZE * 2, SIZE, np.BLOCKSIZE))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)

        slice = [((1, Ad.shape[0] / np.BLOCKSIZE))]
        for d in xrange(Ad.ndim - 1):
            slice.append((0, Ad.shape[d + 1] / np.BLOCKSIZE))

        for a in Ad.blocks(slice):
            a += 100.0

        Af[np.BLOCKSIZE:] += 100.0

        if not dnumpytest.array_equal(Ad, Af):
            raise Exception("Uncorrect result array\n")

    max_ndim = 3
    for i in xrange(4, max_ndim + 4):
        SIZE = i * np.BLOCKSIZE
        src = dnumpytest.random_list(
            range(np.BLOCKSIZE * 2, SIZE, np.BLOCKSIZE))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)

        slice = [((0, (Ad.shape[0] / np.BLOCKSIZE) - 1))]
        for d in xrange(Ad.ndim - 1):
            slice.append((0, Ad.shape[d + 1] / np.BLOCKSIZE))

        for a in Ad.blocks(slice):
            a += 100.0

        Af[:-np.BLOCKSIZE] += 100.0

        if not dnumpytest.array_equal(Ad, Af):
            raise Exception("Uncorrect result array\n")
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    max_ndim = 3
    for i in xrange(4, max_ndim+4):
        SIZE = i*np.BLOCKSIZE
        src = dnumpytest.random_list(range(np.BLOCKSIZE*2, SIZE, np.BLOCKSIZE))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)

        slice = [((1,Ad.shape[0]/np.BLOCKSIZE))]
        for d in xrange(Ad.ndim-1):
            slice.append((0,Ad.shape[d+1]/np.BLOCKSIZE))

        for a in Ad.blocks(slice):
            a += 100.0

        Af[np.BLOCKSIZE:] += 100.0

        if not dnumpytest.array_equal(Ad,Af):
            raise Exception("Uncorrect result array\n")

    max_ndim = 3
    for i in xrange(4, max_ndim+4):
        SIZE = i*np.BLOCKSIZE
        src = dnumpytest.random_list(range(np.BLOCKSIZE*2, SIZE, np.BLOCKSIZE))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)

        slice = [((0,(Ad.shape[0]/np.BLOCKSIZE)-1))]
        for d in xrange(Ad.ndim-1):
            slice.append((0,Ad.shape[d+1]/np.BLOCKSIZE))

        for a in Ad.blocks(slice):
            a += 100.0

        Af[:-np.BLOCKSIZE] += 100.0

        if not dnumpytest.array_equal(Ad,Af):
            raise Exception("Uncorrect result array\n")
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    niter = 5
    for m in range(np.BLOCKSIZE,niter*np.BLOCKSIZE, np.BLOCKSIZE):
        for n in range(np.BLOCKSIZE,niter*np.BLOCKSIZE, np.BLOCKSIZE):
            for k in range(np.BLOCKSIZE,niter*np.BLOCKSIZE, np.BLOCKSIZE):
                for axis in permutations(xrange(3)):
                    Asrc = dnumpytest.random_list([m,n,k])
                    Ad = np.array(Asrc, dtype=float, dist=True)
                    Af = np.array(Asrc, dtype=float, dist=False)
                    Bd = pyHPC.transpose(Ad, axis)
                    Bf = np.transpose(Af, axis)
                    if not dnumpytest.array_equal(Bd,Bf):
                        raise Exception("Uncorrect result matrix\n")
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    niter = 5
    for m in range(np.BLOCKSIZE, niter * np.BLOCKSIZE, np.BLOCKSIZE):
        for n in range(np.BLOCKSIZE, niter * np.BLOCKSIZE, np.BLOCKSIZE):
            for k in range(np.BLOCKSIZE, niter * np.BLOCKSIZE, np.BLOCKSIZE):
                for axis in permutations(xrange(3)):
                    Asrc = dnumpytest.random_list([m, n, k])
                    Ad = np.array(Asrc, dtype=float, dist=True)
                    Af = np.array(Asrc, dtype=float, dist=False)
                    Bd = pyHPC.transpose(Ad, axis)
                    Bf = np.transpose(Af, axis)
                    if not dnumpytest.array_equal(Bd, Bf):
                        raise Exception("Uncorrect result matrix\n")
Beispiel #9
0
def run():
    A = load("%sJacobi_Amatrix.npy"%dnumpytest.DataSetDir, dist=True)
    B = load("%sJacobi_Bvector.npy"%dnumpytest.DataSetDir, dist=True)
    C = load("%sJacobi_Cvector.npy"%dnumpytest.DataSetDir, dist=True)
    result = jacobi(A,B)

    if not dnumpytest.array_equal(C,result):
        raise Exception("Uncorrect result vector\n")
Beispiel #10
0
def run():
    db_length = 100
    ndims = 64
    src = dnumpytest.random_list((db_length, ndims))
    Seq = kNN(src, False)
    Par = kNN(src, True)

    if not dnumpytest.array_equal(Seq,Par):
        raise Exception("Uncorrect result matrix\n")
def run():
    if np.SPMD_MODE:  #SPMD mode is not support since we use random values.
        print "[rank %d] Warning - ignored in SPMD mode\n" % (np.RANK),
        return
    random_state = random.getstate()
    Seq = gameoflife(100, 100, 5, False, random_state)
    Par = gameoflife(100, 100, 5, True, random_state)
    if not dnumpytest.array_equal(Seq, Par):
        raise Exception("Uncorrect result matrix\n")
def run():
    if np.SPMD_MODE: #SPMD mode is not support since we use random values.
        print "[rank %d] Warning - ignored in SPMD mode\n"%(np.RANK),
        return
    random_state = random.getstate()
    Seq = gameoflife(100,100,5,False,random_state)
    Par = gameoflife(100,100,5,True,random_state)
    if not dnumpytest.array_equal(Seq,Par):
        raise Exception("Uncorrect result matrix\n")
Beispiel #13
0
def run():
    db_length = 100
    ndims = 64
    src = dnumpytest.random_list((db_length, ndims))
    Seq = kNN(src, False)
    Par = kNN(src, True)

    if not dnumpytest.array_equal(Seq, Par):
        raise Exception("Uncorrect result matrix\n")
Beispiel #14
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")
Beispiel #15
0
def run():
    niters = 10
    for i in xrange(niters):
        for j in xrange(niters):
            src = dnumpytest.random_list([i+1,j+1])
            Ad = np.array(src, dtype=float, dist=True)
            Af = np.array(src, dtype=float, dist=False)
            Cd = Ad.diagonal()
            Cf = Af.diagonal()
            if not dnumpytest.array_equal(Cd,Cf):
                raise Exception("Uncorrect result matrix\n")
Beispiel #16
0
def run():
    max_ndim = 6
    for i in range(1,max_ndim+1):
        src = dnumpytest.random_list(range(2, i+2))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        for j in range(len(Ad.shape)):
            Cd = np.add.reduce(Ad,j)
            Cf = np.add.reduce(Af,j)
            if not dnumpytest.array_equal(Cd,Cf):
                raise Exception("Uncorrect result array\n")
    return (False, "")
Beispiel #17
0
def run():
    max_ndim = 6
    for i in range(1, max_ndim + 1):
        src = dnumpytest.random_list(range(2, i + 2))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        for j in range(len(Ad.shape)):
            Cd = np.add.reduce(Ad, j)
            Cf = np.add.reduce(Af, j)
            if not dnumpytest.array_equal(Cd, Cf):
                raise Exception("Uncorrect result array\n")
    return (False, "")
Beispiel #18
0
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    max_ndim = 4
    BS = np.BLOCKSIZE
    for i in xrange(2, max_ndim + 2):
        src = dnumpytest.random_list(range(BS, i * BS, BS))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        Bd = Ad[BS:, ...]
        Bf = Af[BS:, ...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 42.0
        Cf += 42.0
        Bd = Ad[BS * 2:, ...]
        Bf = Af[BS * 2:, ...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 4.0
        Cf += 4.0
        Bd = Ad[:BS, ...]
        Bf = Af[:BS, ...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 142.0
        Cf += 142.0
        Bd = Ad[:BS * 2, ...]
        Bf = Af[:BS * 2, ...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 143.0
        Cf += 143.0
        Bd = Ad[..., :BS]
        Bf = Af[..., :BS]
        Cd = Bd.local()
        Cf = Bf
        Cd += 1042.0
        Cf += 1042.0
        if not dnumpytest.array_equal(Ad, Af):
            raise Exception("Uncorrect result array\n")
Beispiel #19
0
def run():
    if not np.SPMD_MODE:
        print "[rank %d] Warning - ignored in non-SPMD mode\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

    max_ndim = 4
    BS = np.BLOCKSIZE
    for i in xrange(2, max_ndim+2):
        src = dnumpytest.random_list(range(BS, i*BS, BS))
        Ad = np.array(src, dtype=float, dist=True)
        Af = np.array(src, dtype=float, dist=False)
        Bd = Ad[BS:,...]
        Bf = Af[BS:,...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 42.0
        Cf += 42.0
        Bd = Ad[BS*2:,...]
        Bf = Af[BS*2:,...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 4.0
        Cf += 4.0
        Bd = Ad[:BS,...]
        Bf = Af[:BS,...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 142.0
        Cf += 142.0
        Bd = Ad[:BS*2,...]
        Bf = Af[:BS*2,...]
        Cd = Bd.local()
        Cf = Bf
        Cd += 143.0
        Cf += 143.0
        Bd = Ad[...,:BS]
        Bf = Af[...,:BS]
        Cd = Bd.local()
        Cf = Bf
        Cd += 1042.0
        Cf += 1042.0
        if not dnumpytest.array_equal(Ad,Af):
            raise Exception("Uncorrect result array\n")
Beispiel #20
0
def run():
    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

    for SIZE in xrange(np.BLOCKSIZE,np.BLOCKSIZE*10,np.BLOCKSIZE):
        (Ld, Ud) = pyHPC.lu(gen_matrix(SIZE,True))
        (P, Lf, Uf) = linalg.lu(gen_matrix(SIZE,False))

        #There seems to be a transpose bug in SciPy's LU
        Lf = Lf.T
        Uf = Uf.T

        if not (np.diag(P) == 1).all():#We do not support pivoting
            raise Exception("Pivoting was needed!")

        if not dnumpytest.array_equal(Ld,Lf,maxerror=1e-1):
            del Ld
            del Ud
            raise Exception("Uncorrect L matrix\n")

        if not dnumpytest.array_equal(Ud,Uf,maxerror=1e-1):
            del Ld
            del Ud
            raise Exception("Uncorrect U matrix\n")
Beispiel #21
0
def run():
    niter = 6
    for m in range(2, niter + 2):
        for n in range(2, niter + 2):
            for k in range(2, niter + 2):
                Asrc = dnumpytest.random_list([k, m])
                Bsrc = dnumpytest.random_list([m, k])
                Ad = np.array(Asrc, dtype=float, dist=True)
                Af = np.array(Asrc, dtype=float, dist=False)
                Bd = np.array(Bsrc, dtype=float, dist=True)
                Bf = np.array(Bsrc, dtype=float, dist=False)
                Cd = np.dot(Ad, Bd)
                Cf = np.dot(Af, Bf)
                if not dnumpytest.array_equal(Cd, Cf):
                    raise Exception("Uncorrect result matrix\n")
Beispiel #22
0
def run():
    niter = 6
    for m in range(2,niter+2):
        for n in range(2,niter+2):
            for k in range(2,niter+2):
                Asrc = dnumpytest.random_list([k,m])
                Bsrc = dnumpytest.random_list([m,k])
                Ad = np.array(Asrc, dtype=float, dist=True)
                Af = np.array(Asrc, dtype=float, dist=False)
                Bd = np.array(Bsrc, dtype=float, dist=True)
                Bf = np.array(Bsrc, dtype=float, dist=False)
                Cd = np.dot(Ad,Bd)
                Cf = np.dot(Af,Bf)
                if not dnumpytest.array_equal(Cd,Cf):
                    raise Exception("Uncorrect result matrix\n")
Beispiel #23
0
def run():
    if np.SPMD_MODE:
        print "[rank %d] Warning - ignored in SPMD mode\n" % (np.RANK),
        return

    try:  #This test requires zlib
        import zlib
    except:
        print "[rank %d] Warning - ignored zlib not found\n" % (np.RANK),
        return

    max_ndim = 6
    for i in xrange(1, max_ndim + 1):
        src = dnumpytest.random_list(random.sample(xrange(1, 10), i))
        A = np.array(src, dtype=float, dist=True)
        fname = "distnumpt_test_matrix.npy"
        np.save(fname, A)
        Bf = np.load(fname, dist=False)
        Bd = np.load(fname, dist=True)

        if not dnumpytest.array_equal(Bf, Bd):
            subprocess.check_call(('rm %s' % fname), shell=True)
            raise Exception("Uncorrect result array\n")
        subprocess.check_call(('rm %s' % fname), shell=True)
Beispiel #24
0
def run():
    Seq = SOR(10,10,False)
    Par = SOR(10,10,True)

    if not dnumpytest.array_equal(Seq,Par):
        raise Exception("Uncorrect result matrix\n")
def run():
    Seq = jacobi_sencil(5, 5, False)
    Par = jacobi_sencil(5, 5, True)

    if not dnumpytest.array_equal(Seq, Par):
        raise Exception("Uncorrect result matrix\n")
def run():
    Seq = jacobi_sencil(5,5,False)
    Par = jacobi_sencil(5,5,True)

    if not dnumpytest.array_equal(Seq,Par):
        raise Exception("Uncorrect result matrix\n")
Beispiel #27
0
def run():
    Seq = SOR(10, 10, False)
    Par = SOR(10, 10, True)

    if not dnumpytest.array_equal(Seq, Par):
        raise Exception("Uncorrect result matrix\n")