def copy(a, order='K'):
    """Creates a copy of a given array on the current device.

    This function allocates the new array on the current device. If the given
    array is allocated on the different device, then this function tries to
    copy the contents over the devices.

    Args:
        a (clpy.ndarray): The source array.
        order ({'C', 'F', 'A', 'K'}): Row-major (C-style) or column-major
            (Fortran-style) order.
            When `order` is 'A', it uses 'F' if `a` is column-major and
            uses `C` otherwise.
            And when `order` is 'K', it keeps strides as closely as
            possible.

    Returns:
        clpy.ndarray: The copy of ``a`` on the current device.

    See: :func:`numpy.copy`, :meth:`clpy.ndarray.copy`

    """
    # If the current device is different from the device of ``a``, then this
    # function allocates a new array on the current device, and copies the
    # contents over the devices.
    return a.copy(order=order)