pystella/decomp.py
def remove_halos(self, queue, in_array, out_array):
        """
        Removes the halo padding from an array.

        The only restriction on the shapes of the three-dimensional input arrays
        is that the shape of ``in_array`` is larger than that of ``out_array``
        by ``2*halo_shape`` along each axis.

        :arg queue: The :class:`pyopencl.CommandQueue` to enqueue kernels and copies.

        :arg in_array: The subarray whose halos will be removed.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.

        :arg out_array: The output array.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.
        """

        dtype = out_array.dtype
        if in_array.dtype != dtype:
            raise ValueError("in_array and out_array have different dtypes")

        cl_in = isinstance(in_array, cla.Array)
        cl_out = isinstance(out_array, cla.Array)
        np_in = isinstance(in_array, np.ndarray)
        np_out = isinstance(out_array, np.ndarray)

        slc = tuple(slice(hi, -hi) if hi > 0 else slice(None)
                    for hi in self.halo_shape)

        if cl_in and np_out:
            # FIXME: de-pad in on GPU?
            out_array[:] = in_array.get()[slc]
        elif cl_in or cl_out:
            evt, _ = self.gather_knl(queue, subarr=in_array, arr=out_array)
            evt.wait()  # FIXME: unnecessary?
        elif np_in and np_out:
            out_array[:] = in_array[slc]

        Removes the halo padding from an array.

        The only restriction on the shapes of the three-dimensional input arrays
        is that the shape of ``in_array`` is larger than that of ``out_array``
        by ``2*halo_shape`` along each axis.

        :arg queue: The :class:`pyopencl.CommandQueue` to enqueue kernels and copies.

        :arg in_array: The subarray whose halos will be removed.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.

        :arg out_array: The output array.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.
        
Removes the halo padding from an array.
Removes the halo padding from an array .
def remove_halos(self, queue, in_array, out_array):
        dtype = out_array.dtype
        if in_array.dtype != dtype:
            raise ValueError("in_array and out_array have different dtypes")
        cl_in = isinstance(in_array, cla.Array)
        cl_out = isinstance(out_array, cla.Array)
        np_in = isinstance(in_array, np.ndarray)
        np_out = isinstance(out_array, np.ndarray)
        slc = tuple(slice(hi, -hi) if hi > 0 else slice(None)
                    for hi in self.halo_shape)
        if cl_in and np_out:
            out_array[:] = in_array.get()[slc]
        elif cl_in or cl_out:
            evt, _ = self.gather_knl(queue, subarr=in_array, arr=out_array)
            evt.wait()  
        elif np_in and np_out:
            out_array[:] = in_array[slc]
def remove_halos ( self , queue , in_array , out_array ) : dtype = out_array . dtype if in_array . dtype != dtype : raise ValueError ( "in_array and out_array have different dtypes" ) cl_in = isinstance ( in_array , cla . Array ) cl_out = isinstance ( out_array , cla . Array ) np_in = isinstance ( in_array , np . ndarray ) np_out = isinstance ( out_array , np . ndarray ) slc = tuple ( slice ( hi , - hi ) if hi > 0 else slice ( None ) for hi in self . halo_shape ) if cl_in and np_out : out_array [ : ] = in_array . get ( ) [ slc ] elif cl_in or cl_out : evt , _ = self . gather_knl ( queue , subarr = in_array , arr = out_array ) evt . wait ( ) elif np_in and np_out : out_array [ : ] = in_array [ slc ]
Removes the halo padding from an array.
Removes the halo padding from an array .
"""
        Removes the halo padding from an array.

        The only restriction on the shapes of the three-dimensional input arrays
        is that the shape of ``in_array`` is larger than that of ``out_array``
        by ``2*halo_shape`` along each axis.

        :arg queue: The :class:`pyopencl.CommandQueue` to enqueue kernels and copies.

        :arg in_array: The subarray whose halos will be removed.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.

        :arg out_array: The output array.
            May be either a :class:`pyopencl.array.Array` or a
            :class:`numpy.ndarray`.
        """ # FIXME: de-pad in on GPU?
 # FIXME: unnecessary?

self
queue
The :class:`pyopencl.CommandQueue` to enqueue kernels and copies.
The : class : ` pyopencl . CommandQueue ` to enqueue kernels and copies .
in_array
The subarray whose halos will be removed.
May be either a :class:`pyopencl.array.Array` or a
:class:`numpy.ndarray`.
The subarray whose halos will be removed . May be either a : class : ` pyopencl . array . Array ` or a : class : ` numpy . ndarray ` .
out_array
The output array.
May be either a :class:`pyopencl.array.Array` or a
:class:`numpy.ndarray`.
The output array . May be either a : class : ` pyopencl . array . Array ` or a : class : ` numpy . ndarray ` .