Class BaseDeviceMemoryBuffer

java.lang.Object
ai.rapids.cudf.MemoryBuffer
ai.rapids.cudf.BaseDeviceMemoryBuffer
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
CudaMemoryBuffer, CuFileBuffer, DeviceMemoryBuffer, DeviceMemoryBufferView

public abstract class BaseDeviceMemoryBuffer extends MemoryBuffer
Base class for all MemoryBuffers that are in device memory.
  • Constructor Details

    • BaseDeviceMemoryBuffer

      protected BaseDeviceMemoryBuffer(long address, long length, MemoryBuffer parent)
    • BaseDeviceMemoryBuffer

      protected BaseDeviceMemoryBuffer(long address, long length, MemoryBuffer.MemoryBufferCleaner cleaner)
  • Method Details

    • copyFromHostBuffer

      public final void copyFromHostBuffer(long destOffset, HostMemoryBuffer src, long srcOffset, long length)
      Copy a subset of src to this buffer starting at destOffset.
      Parameters:
      destOffset - the offset in this to start copying from.
      src - what to copy from
      srcOffset - offset into src to start out
      length - how many bytes to copy
    • copyFromHostBuffer

      public final void copyFromHostBuffer(long destOffset, HostMemoryBuffer src, long srcOffset, long length, Cuda.Stream stream)
      Copy a subset of src to this buffer starting at destOffset using the specified CUDA stream. The copy has completed when this returns, but the memory copy could overlap with operations occurring on other streams.
      Parameters:
      destOffset - the offset in this to start copying from.
      src - what to copy from
      srcOffset - offset into src to start out
      length - how many bytes to copy
      stream - CUDA stream to use
    • copyFromHostBufferAsync

      public final void copyFromHostBufferAsync(long destOffset, HostMemoryBuffer src, long srcOffset, long length, Cuda.Stream stream)
      Copy a subset of src to this buffer starting at destOffset using the specified CUDA stream. The copy is async and may not have completed when this returns.
      Parameters:
      destOffset - the offset in this to start copying from.
      src - what to copy from
      srcOffset - offset into src to start out
      length - how many bytes to copy
      stream - CUDA stream to use
    • copyFromDeviceBufferAsync

      public final void copyFromDeviceBufferAsync(long destOffset, BaseDeviceMemoryBuffer src, long srcOffset, long length, Cuda.Stream stream)
      Copy a subset of src to this buffer starting at destOffset using the specified CUDA stream. The copy is async and may not have completed when this returns.
      Parameters:
      destOffset - the offset in this to start copying from.
      src - what to copy from
      srcOffset - offset into src to start out
      length - how many bytes to copy
      stream - CUDA stream to use
    • copyFromHostBuffer

      public final void copyFromHostBuffer(HostMemoryBuffer src, long srcOffset, long length)
      Copy a subset of src to this buffer starting at the beginning of this.
      Parameters:
      src - what to copy from
      srcOffset - offset into src to start out
      length - how many bytes to copy
    • copyFromHostBuffer

      public final void copyFromHostBuffer(HostMemoryBuffer src)
      Copy everything from src to this buffer starting at the beginning of this buffer.
      Parameters:
      src - - Buffer to copy data from
    • copyFromHostBuffer

      public final void copyFromHostBuffer(HostMemoryBuffer src, Cuda.Stream stream)
      Copy entire host buffer starting at the beginning of this buffer using a CUDA stream. The copy has completed when this returns, but the memory copy could overlap with operations occurring on other streams.
      Parameters:
      src - host buffer to copy from
      stream - CUDA stream to use
    • copyFromHostBufferAsync

      public final void copyFromHostBufferAsync(HostMemoryBuffer src, Cuda.Stream stream)
      Copy entire host buffer starting at the beginning of this buffer using a CUDA stream. The copy is async and may not have completed when this returns.
      Parameters:
      src - host buffer to copy from
      stream - CUDA stream to use
    • sliceWithCopy

      public final DeviceMemoryBuffer sliceWithCopy(long offset, long len)
      Slice off a part of the device buffer, copying it instead of reference counting it.
      Parameters:
      offset - where to start the slice at.
      len - how many bytes to slice
      Returns:
      a device buffer that will need to be closed independently from this buffer.