def test_free():
    #needs at least 3GB ram

    for i in range(100):
        A = gpu.empty((256*1024,#1kb
                      1024*1024))#total of 1GB memory
        del A
def test_free():
    #needs at least 3GB ram

    for i in range(100):
        A = gpu.empty((
            256 * 1024,  #1kb
            1024 * 1024))  #total of 1GB memory
        del A
def test_dot():
    A1 = np.float32(np.random.rand(2,4))
    A2 = np.float32(np.random.rand(4,2))
    B1 = gpu.array(A1)
    B2 = gpu.array(A2)
    B3 = gpu.dot(B1,B2)
    C = B3.tocpu()


    t.assert_array_almost_equal(np.dot(A1,A2),C,4,"array.tocpu not equal to init array!")
    B1 = gpu.array(A1)
    B2 = gpu.array(A2)
    B3 = gpu.empty((2,2))

    gpu.dot(B1,B2,B3)

    t.assert_array_almost_equal(np.dot(A1,A2),B3.tocpu(),4,"array.tocpu not equal to init array!")
def test_dot():
    A1 = np.float32(np.random.rand(2, 4))
    A2 = np.float32(np.random.rand(4, 2))
    B1 = gpu.array(A1)
    B2 = gpu.array(A2)
    B3 = gpu.dot(B1, B2)
    C = B3.tocpu()

    t.assert_array_almost_equal(np.dot(A1, A2), C, 4,
                                "array.tocpu not equal to init array!")
    B1 = gpu.array(A1)
    B2 = gpu.array(A2)
    B3 = gpu.empty((2, 2))

    gpu.dot(B1, B2, B3)

    t.assert_array_almost_equal(np.dot(A1, A2), B3.tocpu(), 4,
                                "array.tocpu not equal to init array!")