Exemplo n.º 1
0
def test_numba():

    @autojit
    def fill(x):
        for i in range(25):
            x[i] = i

    h = Heap()
    addr, block = allocate_numpy(h, np.dtype('int'), (25, ))
    fill(block)

    finalize(h)
Exemplo n.º 2
0
def test_iopro():
    # this is kind of stupid right now because it does a copy,
    # but Tight IOPro integration will be a priority...

    h = Heap()

    s = StringIO(','.join(letters))

    data = iopro.genfromtxt(s, dtype='c', delimiter=",")

    addr, block = allocate_numpy(h, data.dtype, data.shape)
    block[:] = data[:]

    assert not block.flags['OWNDATA']
    assert block.ctypes.data == addr

    assert len(h._arenas) == 1
    assert block.nbytes < h._lengths[0]

    finalize(h)
Exemplo n.º 3
0
def test_iopro():
    # this is kind of stupid right now because it does a copy,
    # but Tight IOPro integration will be a priority...

    h = Heap()

    s = StringIO(','.join(letters))

    data = iopro.genfromtxt(s, dtype='c', delimiter=",")

    addr, block = allocate_numpy(h, data.dtype, data.shape)
    block[:] = data[:]

    assert not block.flags['OWNDATA']
    assert block.ctypes.data == addr

    assert len(h._arenas) == 1
    assert block.nbytes < h._lengths[0]

    finalize(h)