Class ImmutableDevice

java.lang.Object
net.bmahe.genetics4j.gpu.opencl.model.ImmutableDevice
All Implemented Interfaces:
Device

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableDevice extends Object implements Device
Immutable implementation of Device.

Use the builder to create immutable instances: ImmutableDevice.builder().

  • Field Details

    • deviceId

      private final org.jocl.cl_device_id deviceId
    • name

      private final String name
    • vendor

      private final String vendor
    • deviceVersion

      private final String deviceVersion
    • driverVersion

      private final String driverVersion
    • maxClockFrequency

      private final int maxClockFrequency
    • deviceType

      private final Set<DeviceType> deviceType
    • builtInKernels

      private final Set<String> builtInKernels
    • maxComputeUnits

      private final int maxComputeUnits
    • maxWorkItemDimensions

      private final int maxWorkItemDimensions
    • maxWorkGroupSize

      private final long maxWorkGroupSize
    • maxWorkItemSizes

      private final long[] maxWorkItemSizes
    • imageSupport

      private final boolean imageSupport
    • preferredVectorWidthFloat

      private final int preferredVectorWidthFloat
  • Constructor Details

    • ImmutableDevice

      private ImmutableDevice(org.jocl.cl_device_id deviceId, String name, String vendor, String deviceVersion, String driverVersion, int maxClockFrequency, Set<DeviceType> deviceType, Set<String> builtInKernels, int maxComputeUnits, int maxWorkItemDimensions, long maxWorkGroupSize, long[] maxWorkItemSizes, boolean imageSupport, int preferredVectorWidthFloat)
  • Method Details

    • deviceId

      public org.jocl.cl_device_id deviceId()
      Returns the native OpenCL device identifier.
      Specified by:
      deviceId in interface Device
      Returns:
      the OpenCL device ID for low-level operations
    • name

      public String name()
      Returns the device name provided by the vendor.
      Specified by:
      name in interface Device
      Returns:
      the human-readable device name (e.g., "GeForce RTX 3080", "Intel Core i7")
    • vendor

      public String vendor()
      Returns the device vendor name.
      Specified by:
      vendor in interface Device
      Returns:
      the vendor name (e.g., "NVIDIA Corporation", "Intel", "AMD")
    • deviceVersion

      public String deviceVersion()
      Returns the OpenCL version supported by this device.
      Specified by:
      deviceVersion in interface Device
      Returns:
      the device OpenCL version string (e.g., "OpenCL 2.1")
    • driverVersion

      public String driverVersion()
      Returns the device driver version.
      Specified by:
      driverVersion in interface Device
      Returns:
      the driver version string provided by the vendor
    • maxClockFrequency

      public int maxClockFrequency()
      Returns the maximum configured clock frequency of the device compute units in MHz.
      Specified by:
      maxClockFrequency in interface Device
      Returns:
      the maximum clock frequency in megahertz
    • deviceType

      public Set<DeviceType> deviceType()
      Returns the set of device types that classify this device.
      Specified by:
      deviceType in interface Device
      Returns:
      set of device types (e.g., GPU, CPU, ACCELERATOR)
    • builtInKernels

      public Set<String> builtInKernels()
      Returns the set of built-in kernel names available on this device.
      Specified by:
      builtInKernels in interface Device
      Returns:
      set of built-in kernel names provided by the device
    • maxComputeUnits

      public int maxComputeUnits()
      Returns the number of parallel compute units on the device.

      Compute units represent the primary parallel processing elements and directly impact the device's ability to execute work groups concurrently.

      Specified by:
      maxComputeUnits in interface Device
      Returns:
      the number of parallel compute units available
    • maxWorkItemDimensions

      public int maxWorkItemDimensions()
      Returns the maximum number of work-item dimensions supported by the device.
      Specified by:
      maxWorkItemDimensions in interface Device
      Returns:
      the maximum number of dimensions for work-item indexing
    • maxWorkGroupSize

      public long maxWorkGroupSize()
      Returns the maximum number of work-items in a work group for kernel execution.

      This limit constrains the local work group size that can be used when launching kernels on this device. Larger work groups can improve memory locality and reduce synchronization overhead.

      Specified by:
      maxWorkGroupSize in interface Device
      Returns:
      the maximum work group size for kernel execution
    • maxWorkItemSizes

      public long[] maxWorkItemSizes()
      Returns the maximum number of work-items in each dimension of a work group.

      The array contains the maximum work-item count for each dimension, providing more granular control over work group configuration than the overall maxWorkGroupSize() limit.

      Specified by:
      maxWorkItemSizes in interface Device
      Returns:
      array of maximum work-item counts per dimension
    • imageSupport

      public boolean imageSupport()
      Returns whether the device supports image objects in kernels.
      Specified by:
      imageSupport in interface Device
      Returns:
      true if the device supports image processing operations
    • preferredVectorWidthFloat

      public int preferredVectorWidthFloat()
      Returns the preferred vector width for float operations.

      This indicates the optimal vector width for floating-point operations on this device, which can be used to optimize numerical computations in fitness evaluation kernels.

      Specified by:
      preferredVectorWidthFloat in interface Device
      Returns:
      the preferred vector width for float operations
    • withDeviceId

      public final ImmutableDevice withDeviceId(org.jocl.cl_device_id value)
      Copy the current immutable object by setting a value for the deviceId attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for deviceId
      Returns:
      A modified copy of the this object
    • withName

      public final ImmutableDevice withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withVendor

      public final ImmutableDevice withVendor(String value)
      Copy the current immutable object by setting a value for the vendor attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for vendor
      Returns:
      A modified copy of the this object
    • withDeviceVersion

      public final ImmutableDevice withDeviceVersion(String value)
      Copy the current immutable object by setting a value for the deviceVersion attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for deviceVersion
      Returns:
      A modified copy of the this object
    • withDriverVersion

      public final ImmutableDevice withDriverVersion(String value)
      Copy the current immutable object by setting a value for the driverVersion attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for driverVersion
      Returns:
      A modified copy of the this object
    • withMaxClockFrequency

      public final ImmutableDevice withMaxClockFrequency(int value)
      Copy the current immutable object by setting a value for the maxClockFrequency attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxClockFrequency
      Returns:
      A modified copy of the this object
    • withDeviceType

      public final ImmutableDevice withDeviceType(DeviceType... elements)
      Copy the current immutable object with elements that replace the content of deviceType.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withDeviceType

      public final ImmutableDevice withDeviceType(Iterable<DeviceType> elements)
      Copy the current immutable object with elements that replace the content of deviceType. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of deviceType elements to set
      Returns:
      A modified copy of this object
    • withBuiltInKernels

      public final ImmutableDevice withBuiltInKernels(String... elements)
      Copy the current immutable object with elements that replace the content of builtInKernels.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withBuiltInKernels

      public final ImmutableDevice withBuiltInKernels(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of builtInKernels. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of builtInKernels elements to set
      Returns:
      A modified copy of this object
    • withMaxComputeUnits

      public final ImmutableDevice withMaxComputeUnits(int value)
      Copy the current immutable object by setting a value for the maxComputeUnits attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxComputeUnits
      Returns:
      A modified copy of the this object
    • withMaxWorkItemDimensions

      public final ImmutableDevice withMaxWorkItemDimensions(int value)
      Copy the current immutable object by setting a value for the maxWorkItemDimensions attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxWorkItemDimensions
      Returns:
      A modified copy of the this object
    • withMaxWorkGroupSize

      public final ImmutableDevice withMaxWorkGroupSize(long value)
      Copy the current immutable object by setting a value for the maxWorkGroupSize attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxWorkGroupSize
      Returns:
      A modified copy of the this object
    • withMaxWorkItemSizes

      public final ImmutableDevice withMaxWorkItemSizes(long... elements)
      Copy the current immutable object with elements that replace the content of maxWorkItemSizes. The array is cloned before being saved as attribute values.
      Parameters:
      elements - The non-null elements for maxWorkItemSizes
      Returns:
      A modified copy of this object
    • withImageSupport

      public final ImmutableDevice withImageSupport(boolean value)
      Copy the current immutable object by setting a value for the imageSupport attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for imageSupport
      Returns:
      A modified copy of the this object
    • withPreferredVectorWidthFloat

      public final ImmutableDevice withPreferredVectorWidthFloat(int value)
      Copy the current immutable object by setting a value for the preferredVectorWidthFloat attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for preferredVectorWidthFloat
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableDevice that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableDevice another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: deviceId, name, vendor, deviceVersion, driverVersion, maxClockFrequency, deviceType, builtInKernels, maxComputeUnits, maxWorkItemDimensions, maxWorkGroupSize, maxWorkItemSizes, imageSupport, preferredVectorWidthFloat.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Device with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableDevice copyOf(Device instance)
      Creates an immutable copy of a Device value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Device instance
    • builder

      public static ImmutableDevice.Builder builder()
      Creates a builder for ImmutableDevice.
       ImmutableDevice.builder()
          .deviceId(org.jocl.cl_device_id) // required deviceId
          .name(String) // required name
          .vendor(String) // required vendor
          .deviceVersion(String) // required deviceVersion
          .driverVersion(String) // required driverVersion
          .maxClockFrequency(int) // required maxClockFrequency
          .addDeviceType|addAllDeviceType(net.bmahe.genetics4j.gpu.opencl.model.DeviceType) // deviceType elements
          .addBuiltInKernels|addAllBuiltInKernels(String) // builtInKernels elements
          .maxComputeUnits(int) // required maxComputeUnits
          .maxWorkItemDimensions(int) // required maxWorkItemDimensions
          .maxWorkGroupSize(long) // required maxWorkGroupSize
          .maxWorkItemSizes(long) // required maxWorkItemSizes
          .imageSupport(boolean) // required imageSupport
          .preferredVectorWidthFloat(int) // required preferredVectorWidthFloat
          .build();
       
      Returns:
      A new ImmutableDevice builder
    • createSafeList

      private static <T> List<T> createSafeList(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls)
    • createUnmodifiableSet

      private static <T> Set<T> createUnmodifiableSet(List<T> list)
      Unmodifiable set constructed from list to avoid rehashing.
    • createUnmodifiableEnumSet

      private static <T extends Enum<T>> Set<T> createUnmodifiableEnumSet(Iterable<T> iterable)