Class ImmutableDevice.Builder

java.lang.Object
net.bmahe.genetics4j.gpu.opencl.model.ImmutableDevice.Builder
Enclosing class:
ImmutableDevice

public static final class ImmutableDevice.Builder extends Object
Builds instances of type ImmutableDevice. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Field Details

    • INIT_BIT_DEVICE_ID

      private static final long INIT_BIT_DEVICE_ID
      See Also:
    • INIT_BIT_NAME

      private static final long INIT_BIT_NAME
      See Also:
    • INIT_BIT_VENDOR

      private static final long INIT_BIT_VENDOR
      See Also:
    • INIT_BIT_DEVICE_VERSION

      private static final long INIT_BIT_DEVICE_VERSION
      See Also:
    • INIT_BIT_DRIVER_VERSION

      private static final long INIT_BIT_DRIVER_VERSION
      See Also:
    • INIT_BIT_MAX_CLOCK_FREQUENCY

      private static final long INIT_BIT_MAX_CLOCK_FREQUENCY
      See Also:
    • INIT_BIT_MAX_COMPUTE_UNITS

      private static final long INIT_BIT_MAX_COMPUTE_UNITS
      See Also:
    • INIT_BIT_MAX_WORK_ITEM_DIMENSIONS

      private static final long INIT_BIT_MAX_WORK_ITEM_DIMENSIONS
      See Also:
    • INIT_BIT_MAX_WORK_GROUP_SIZE

      private static final long INIT_BIT_MAX_WORK_GROUP_SIZE
      See Also:
    • INIT_BIT_MAX_WORK_ITEM_SIZES

      private static final long INIT_BIT_MAX_WORK_ITEM_SIZES
      See Also:
    • INIT_BIT_IMAGE_SUPPORT

      private static final long INIT_BIT_IMAGE_SUPPORT
      See Also:
    • INIT_BIT_PREFERRED_VECTOR_WIDTH_FLOAT

      private static final long INIT_BIT_PREFERRED_VECTOR_WIDTH_FLOAT
      See Also:
    • initBits

      private long initBits
    • deviceId

      private org.jocl.cl_device_id deviceId
    • name

      private String name
    • vendor

      private String vendor
    • deviceVersion

      private String deviceVersion
    • driverVersion

      private String driverVersion
    • maxClockFrequency

      private int maxClockFrequency
    • deviceType

      private EnumSet<DeviceType> deviceType
    • builtInKernels

      private List<String> builtInKernels
    • maxComputeUnits

      private int maxComputeUnits
    • maxWorkItemDimensions

      private int maxWorkItemDimensions
    • maxWorkGroupSize

      private long maxWorkGroupSize
    • maxWorkItemSizes

      private long[] maxWorkItemSizes
    • imageSupport

      private boolean imageSupport
    • preferredVectorWidthFloat

      private int preferredVectorWidthFloat
  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • from

      public final ImmutableDevice.Builder from(Device instance)
      Fill a builder with attribute values from the provided Device instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • deviceId

      public final ImmutableDevice.Builder deviceId(org.jocl.cl_device_id deviceId)
      Initializes the value for the deviceId attribute.
      Parameters:
      deviceId - The value for deviceId
      Returns:
      this builder for use in a chained invocation
    • name

      public final ImmutableDevice.Builder name(String name)
      Initializes the value for the name attribute.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • vendor

      public final ImmutableDevice.Builder vendor(String vendor)
      Initializes the value for the vendor attribute.
      Parameters:
      vendor - The value for vendor
      Returns:
      this builder for use in a chained invocation
    • deviceVersion

      public final ImmutableDevice.Builder deviceVersion(String deviceVersion)
      Initializes the value for the deviceVersion attribute.
      Parameters:
      deviceVersion - The value for deviceVersion
      Returns:
      this builder for use in a chained invocation
    • driverVersion

      public final ImmutableDevice.Builder driverVersion(String driverVersion)
      Initializes the value for the driverVersion attribute.
      Parameters:
      driverVersion - The value for driverVersion
      Returns:
      this builder for use in a chained invocation
    • maxClockFrequency

      public final ImmutableDevice.Builder maxClockFrequency(int maxClockFrequency)
      Initializes the value for the maxClockFrequency attribute.
      Parameters:
      maxClockFrequency - The value for maxClockFrequency
      Returns:
      this builder for use in a chained invocation
    • addDeviceType

      public final ImmutableDevice.Builder addDeviceType(DeviceType element)
      Adds one element to deviceType set.
      Parameters:
      element - A deviceType element
      Returns:
      this builder for use in a chained invocation
    • addDeviceType

      public final ImmutableDevice.Builder addDeviceType(DeviceType... elements)
      Adds elements to deviceType set.
      Parameters:
      elements - An array of deviceType elements
      Returns:
      this builder for use in a chained invocation
    • deviceType

      public final ImmutableDevice.Builder deviceType(Iterable<DeviceType> elements)
      Sets or replaces all elements for deviceType set.
      Parameters:
      elements - An iterable of deviceType elements
      Returns:
      this builder for use in a chained invocation
    • addAllDeviceType

      public final ImmutableDevice.Builder addAllDeviceType(Iterable<DeviceType> elements)
      Adds elements to deviceType set.
      Parameters:
      elements - An iterable of deviceType elements
      Returns:
      this builder for use in a chained invocation
    • addBuiltInKernels

      public final ImmutableDevice.Builder addBuiltInKernels(String element)
      Adds one element to builtInKernels set.
      Parameters:
      element - A builtInKernels element
      Returns:
      this builder for use in a chained invocation
    • addBuiltInKernels

      public final ImmutableDevice.Builder addBuiltInKernels(String... elements)
      Adds elements to builtInKernels set.
      Parameters:
      elements - An array of builtInKernels elements
      Returns:
      this builder for use in a chained invocation
    • builtInKernels

      public final ImmutableDevice.Builder builtInKernels(Iterable<String> elements)
      Sets or replaces all elements for builtInKernels set.
      Parameters:
      elements - An iterable of builtInKernels elements
      Returns:
      this builder for use in a chained invocation
    • addAllBuiltInKernels

      public final ImmutableDevice.Builder addAllBuiltInKernels(Iterable<String> elements)
      Adds elements to builtInKernels set.
      Parameters:
      elements - An iterable of builtInKernels elements
      Returns:
      this builder for use in a chained invocation
    • maxComputeUnits

      public final ImmutableDevice.Builder maxComputeUnits(int maxComputeUnits)
      Initializes the value for the maxComputeUnits attribute.
      Parameters:
      maxComputeUnits - The value for maxComputeUnits
      Returns:
      this builder for use in a chained invocation
    • maxWorkItemDimensions

      public final ImmutableDevice.Builder maxWorkItemDimensions(int maxWorkItemDimensions)
      Initializes the value for the maxWorkItemDimensions attribute.
      Parameters:
      maxWorkItemDimensions - The value for maxWorkItemDimensions
      Returns:
      this builder for use in a chained invocation
    • maxWorkGroupSize

      public final ImmutableDevice.Builder maxWorkGroupSize(long maxWorkGroupSize)
      Initializes the value for the maxWorkGroupSize attribute.
      Parameters:
      maxWorkGroupSize - The value for maxWorkGroupSize
      Returns:
      this builder for use in a chained invocation
    • maxWorkItemSizes

      public final ImmutableDevice.Builder maxWorkItemSizes(long... maxWorkItemSizes)
      Initializes the value for the maxWorkItemSizes attribute.
      Parameters:
      maxWorkItemSizes - The elements for maxWorkItemSizes
      Returns:
      this builder for use in a chained invocation
    • imageSupport

      public final ImmutableDevice.Builder imageSupport(boolean imageSupport)
      Initializes the value for the imageSupport attribute.
      Parameters:
      imageSupport - The value for imageSupport
      Returns:
      this builder for use in a chained invocation
    • preferredVectorWidthFloat

      public final ImmutableDevice.Builder preferredVectorWidthFloat(int preferredVectorWidthFloat)
      Initializes the value for the preferredVectorWidthFloat attribute.
      Parameters:
      preferredVectorWidthFloat - The value for preferredVectorWidthFloat
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableDevice build()
      Builds a new ImmutableDevice.
      Returns:
      An immutable instance of Device
      Throws:
      IllegalStateException - if any required attributes are missing
    • formatRequiredAttributesMessage

      private String formatRequiredAttributesMessage()