Esempio n. 1
0
    def copy_from_host_async(self, mem, size, stream):
        """Copies a memory sequence from the host memory asynchronously.

        Args:
            src (ctypes.c_void_p): Source memory pointer. It must be a pinned
                memory.
            size (int): Size of the sequence in bytes.

        """
        if size > 0:
            runtime.memcpyAsync(self.ptr, mem, size, stream,
                                runtime.memcpyHostToDevice)
Esempio n. 2
0
    def copy_from_device_async(self, src, size, stream):
        """Copies a memory sequence from the same device asynchronously.

        Args:
            src (cupy.cuda.MemoryPointer): Source memory pointer.
            size (int): Size of the sequence in bytes.
            stream (cupy.cuda.Stream): CUDA stream.

        """
        if size > 0:
            runtime.memcpyAsync(self.ptr, src.ptr, size, stream,
                                runtime.memcpyDeviceToDevice)
Esempio n. 3
0
    def copy_to_host_async(self, mem, size, stream):
        """Copies a memory sequence to the host memory asynchronously.

        Args:
            mem (ctypes.c_void_p): Target memory pointer. It must be a pinned
                memory.
            size (int): Size of the sequence in bytes.
            stream (cupy.cuda.Stream): CUDA stream.

        """
        if size > 0:
            runtime.memcpyAsync(mem, self.ptr, size, stream,
                                runtime.memcpyDeviceToHost)