def perlin2(size, units=None, repeat=(10.,)*2, scale=None, shift=(0, 0)):
    """
        2d perlin noise
        either scale =(10.,10.) or units (5.,5.) have to be given....

        scale is the characteristic length in pixels
    Parameters
    ----------
    size:

    units
    repeat
    scale
    shift

    Returns
    -------

    """

    if scale:
        if np.isscalar(scale):
            scale = (scale,)*2
        repeat = scale
        units = (1.,)*2

    wx, wy = repeat
    dx, dy = units
    offset_x, offset_y = shift

    prog = OCLProgram(abspath("kernels/perlin.cl"))

    d = OCLArray.empty(size[::-1], np.float32)
    prog.run_kernel("perlin2d", d.shape[::-1], None,
                    d.data,
                    np.float32(dx), np.float32(dy),
                    np.float32(wx), np.float32(wy),
                    np.float32(offset_x), np.float32(offset_y),
                    )

    return d.get()