Class

cogx.platform.cpumemory

AbstractFieldMemory

Related Doc: package cpumemory

Permalink

abstract class AbstractFieldMemory extends FieldMemoryLayout with cpumemory.readerwriter.FieldReader

CPU container for a tensor field, including methods for reading and writing it. This implemented using direct, NIO buffers for efficiency.

This organizes the data within the buffer so that memory accesses by the GPU are efficient. This also provides a uniform representation of fields that's consistent on both CPU and GPU.

See the FieldMemoryLayout class for description of the physical layout.

Linear Supertypes
readerwriter.FieldReader, FieldMemoryLayout, FieldParameters, FieldLimits, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. AbstractFieldMemory
  2. FieldReader
  3. FieldMemoryLayout
  4. FieldParameters
  5. FieldLimits
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AbstractFieldMemory(fieldType: types.FieldType, bufferType: BufferType)

    Permalink

Abstract Value Members

  1. abstract def compareLinf(that: readerwriter.FieldReader): Float

    Permalink

    Compute the L-infinity norm on the difference of this and that.

    Compute the L-infinity norm on the difference of this and that.

    that

    AbstractFieldMemory to compare to this

    returns

    L-infinity error

    Definition Classes
    FieldReader
  2. abstract def directBuffer: Buffer

    Permalink

    The direct buffer for this memory.

    The direct buffer for this memory. This is always a view of _byteBuffer, but upcast to the appropriate subclass of Buffer using, for example, ByteBuffer.asFloatBuffer. The view calls are somewhat dangerous because they create a view with proper endianness for Java (which uses the native endianness internally) but they can also change the endianness of _byteBuffer. This is subtle, so read the Java documentation carefully if you need to change this.

  3. abstract def print(): Unit

    Permalink

    Print out the field for debugging.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val MaxFieldDimensions: Int

    Permalink

    Maximum number of dimensions in tensor fields.

    Maximum number of dimensions in tensor fields.

    Definition Classes
    FieldLimits
  5. val MaxTensorOrder: Int

    Permalink

    Maximum supported tensor order for tensors in field.

    Maximum supported tensor order for tensors in field.

    Definition Classes
    FieldLimits
  6. val PixelSize: Int

    Permalink
    Definition Classes
    FieldMemoryLayout
  7. var _byteBuffer: ByteBuffer

    Permalink

    The actual memory for the field.

    The actual memory for the field.

    Attributes
    protected
  8. var _directBuffer: Buffer

    Permalink
    Attributes
    protected
  9. def allocateDirectByteBuffer(bytes: Int): ByteBuffer

    Permalink

    Allocates a direct ByteBuffer with native ordering.

    Allocates a direct ByteBuffer with native ordering.

    bytes

    Number of bytes in the buffer

    returns

    A direct byte buffer.

    Attributes
    protected
  10. def allocateIndirectByteBuffer(bytes: Int): ByteBuffer

    Permalink

    Allocates an indirect ByteBuffer with native ordering.

    Allocates an indirect ByteBuffer with native ordering.

    bytes

    Number of bytes in the buffer

    returns

    An indirect byte buffer.

    Attributes
    protected
  11. def allocatePinnedDirectByteBuffer(bytes: Int, commandQueue: OpenCLParallelCommandQueue): ByteBuffer

    Permalink

    Allocates a pinned, direct ByteBuffer with native (?) ordering.

    Allocates a pinned, direct ByteBuffer with native (?) ordering.

    There is no way in OpenCL to create a pinned buffer, but the "NVIDIA OpenCL Best Practices Guide" suggests that this has the highest probability of success.

    bytes

    Number of bytes in the buffer

    commandQueue

    Command queue needed for mapping allocated buffer to a direct buffer.

    returns

    A pinned, direct byte buffer.

    Attributes
    protected
  12. def approxEquals(that: readerwriter.FieldReader, maxError: Float = 0.001f): Boolean

    Permalink

    Test for approximate equality between this and that using L-infinity norm.

    Test for approximate equality between this and that using L-infinity norm.

    that

    AbstractFieldMemory to compare to this

    maxError

    Maximum L-infinity error value to consider equal

    returns

    true if L_inf(this, that) <= maxError

    Definition Classes
    FieldReader
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. val bufferType: BufferType

    Permalink
  15. val bytesPerNumber: Int

    Permalink

    Number of bytes in each "number" of the element.

    Number of bytes in each "number" of the element.

    Definition Classes
    FieldMemoryLayout
  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. val columns: Int

    Permalink

    "Columns" in the field.

    "Columns" in the field. See class description for meaning of columns.

    Definition Classes
    FieldParameters
  18. def copyTo(that: AbstractFieldMemory): Unit

    Permalink

    Copy the data in this to another field memory.

    Copy the data in this to another field memory.

    that

    Field memory to receive a copy of the data in this.

  19. def destroyed: Boolean

    Permalink
  20. val dimensions: Int

    Permalink

    Dimensions of the field.

    Dimensions of the field.

    Definition Classes
    FieldParameters
  21. val elementType: types.ElementTypes.ElementType

    Permalink

    The type of scalar that populates the tensor.

    The type of scalar that populates the tensor.

    Definition Classes
    FieldMemoryLayout
  22. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. def equals(that: readerwriter.FieldReader): Boolean

    Permalink

    Test for exact equality between this and that.

    Test for exact equality between this and that.

    that

    AbstractFieldMemory to compare to this

    returns

    true if every value in this and that is exactly equal

    Definition Classes
    FieldReader
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. val fieldRowStride: Int

    Permalink

    Stride from beginning of one row to the next.

    Stride from beginning of one row to the next.

    Definition Classes
    FieldMemoryLayout
  26. val fieldShape: cogmath.geometry.Shape

    Permalink

    Shape of the field.

    Shape of the field.

    Definition Classes
    FieldParameters
  27. val fieldType: types.FieldType

    Permalink

    Field type from which to extract parameters.

    Field type from which to extract parameters.

    Definition Classes
    FieldMemoryLayout → FieldParameters
  28. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  29. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  30. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. val layers: Int

    Permalink

    "Layers" in the field.

    "Layers" in the field. See class description for meaning of layers.

    Definition Classes
    FieldParameters
  33. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  36. val numbersInTensor: Int

    Permalink

    Number of "numbers" in each tensor in the field.

    Number of "numbers" in each tensor in the field.

    Definition Classes
    FieldMemoryLayout
  37. val paddedColumns: Int

    Permalink

    Columns rounded up for memory alignment when necessary.

    Columns rounded up for memory alignment when necessary. Note that images do not have alignment requirements.

    Update: Padding of columns has been removed! Motivation:

    1. With caches now common in GPUs, this had no measurable performance benefit. 2. The native runtime exposes the layout to the user apps, and no notion of padding was described. 3. The padding introduced corner-cases where the footprint of certain fields grows dramatically, which affects buffer transfer times between GPUs and makes the GPU caches less effective.

    Definition Classes
    FieldMemoryLayout
  38. val pageSize: Int

    Permalink

    Number of elements required to represent a single tensor element in a field, including whatever padding is needed for I/O efficiency.

    Number of elements required to represent a single tensor element in a field, including whatever padding is needed for I/O efficiency.

    Definition Classes
    FieldMemoryLayout
  39. val partStride: Int

    Permalink

    Stride from beginning of one part of a multi-component tensor element (e.g.

    Stride from beginning of one part of a multi-component tensor element (e.g. a complex) to the next part.

    Definition Classes
    FieldMemoryLayout
  40. val rows: Int

    Permalink

    "Rows" in the field.

    "Rows" in the field. See class description for meaning of rows.

    Definition Classes
    FieldParameters
  41. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  42. val tensorOrder: Int

    Permalink

    Order of the tensors in the field.

    Order of the tensors in the field.

    Definition Classes
    FieldParameters
  43. val tensorShape: cogmath.geometry.Shape

    Permalink

    Shape of the tensors in the field.

    Shape of the tensors in the field.

    Definition Classes
    FieldParameters
  44. val tensorStride: Int

    Permalink

    Stride from beginning of one tensor element to the next.

    Stride from beginning of one tensor element to the next.

    Definition Classes
    FieldMemoryLayout
  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from readerwriter.FieldReader

Inherited from FieldMemoryLayout

Inherited from FieldParameters

Inherited from FieldLimits

Inherited from AnyRef

Inherited from Any

Ungrouped