Class ImmutableDevice
java.lang.Object
net.bmahe.genetics4j.gpu.opencl.model.ImmutableDevice
- All Implemented Interfaces:
Device
@Generated(from="Device",
generator="Immutables")
@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().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.jocl.cl_device_idprivate final Set<DeviceType> private final Stringprivate final Stringprivate final booleanprivate final intprivate final intprivate final longprivate final intprivate final long[]private final Stringprivate final intprivate final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableDevice(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 Summary
Modifier and TypeMethodDescriptionstatic ImmutableDevice.Builderbuilder()Creates a builder forDevice.Returns the set of built-in kernel names available on this device.static DeviceCreates an immutable copy of aDevicevalue.private static <T> List<T> createSafeList(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls) createUnmodifiableEnumSet(Iterable<? extends T> iterable) private static <T> Set<T> createUnmodifiableSet(List<? extends T> list) Unmodifiable set constructed from list to avoid rehashing.org.jocl.cl_device_iddeviceId()Returns the native OpenCL device identifier.Returns the set of device types that classify this device.Returns the OpenCL version supported by this device.Returns the device driver version.booleanThis instance is equal to all instances ofImmutableDevicethat have equal attribute values.private booleanequalsByValue(ImmutableDevice another) inthashCode()Computes a hash code from attributes:deviceId,name,vendor,deviceVersion,driverVersion,maxClockFrequency,deviceType,builtInKernels,maxComputeUnits,maxWorkItemDimensions,maxWorkGroupSize,maxWorkItemSizes,imageSupport,preferredVectorWidthFloat.booleanReturns whether the device supports image objects in kernels.intReturns the maximum configured clock frequency of the device compute units in MHz.intReturns the number of parallel compute units on the device.longReturns the maximum number of work-items in a work group for kernel execution.intReturns the maximum number of work-item dimensions supported by the device.long[]Returns the maximum number of work-items in each dimension of a work group.name()Returns the device name provided by the vendor.intReturns the preferred vector width for float operations.toString()Prints the immutable valueDevicewith attribute values.vendor()Returns the device vendor name.final ImmutableDevicewithBuiltInKernels(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofbuiltInKernels.final ImmutableDevicewithBuiltInKernels(String... elements) Copy the current immutable object with elements that replace the content ofbuiltInKernels.final ImmutableDevicewithDeviceId(org.jocl.cl_device_id value) Copy the current immutable object by setting a value for thedeviceIdattribute.final ImmutableDevicewithDeviceType(Iterable<DeviceType> elements) Copy the current immutable object with elements that replace the content ofdeviceType.final ImmutableDevicewithDeviceType(DeviceType... elements) Copy the current immutable object with elements that replace the content ofdeviceType.final ImmutableDevicewithDeviceVersion(String value) Copy the current immutable object by setting a value for thedeviceVersionattribute.final ImmutableDevicewithDriverVersion(String value) Copy the current immutable object by setting a value for thedriverVersionattribute.final ImmutableDevicewithImageSupport(boolean value) Copy the current immutable object by setting a value for theimageSupportattribute.final ImmutableDevicewithMaxClockFrequency(int value) Copy the current immutable object by setting a value for themaxClockFrequencyattribute.final ImmutableDevicewithMaxComputeUnits(int value) Copy the current immutable object by setting a value for themaxComputeUnitsattribute.final ImmutableDevicewithMaxWorkGroupSize(long value) Copy the current immutable object by setting a value for themaxWorkGroupSizeattribute.final ImmutableDevicewithMaxWorkItemDimensions(int value) Copy the current immutable object by setting a value for themaxWorkItemDimensionsattribute.final ImmutableDevicewithMaxWorkItemSizes(long... elements) Copy the current immutable object with elements that replace the content ofmaxWorkItemSizes.final ImmutableDeviceCopy the current immutable object by setting a value for thenameattribute.final ImmutableDevicewithPreferredVectorWidthFloat(int value) Copy the current immutable object by setting a value for thepreferredVectorWidthFloatattribute.final ImmutableDevicewithVendor(String value) Copy the current immutable object by setting a value for thevendorattribute.
-
Field Details
-
deviceId
private final org.jocl.cl_device_id deviceId -
name
-
vendor
-
deviceVersion
-
driverVersion
-
maxClockFrequency
private final int maxClockFrequency -
deviceType
-
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. -
name
Returns the device name provided by the vendor. -
vendor
Returns the device vendor name. -
deviceVersion
Returns the OpenCL version supported by this device.- Specified by:
deviceVersionin interfaceDevice- Returns:
- the device OpenCL version string (e.g., "OpenCL 2.1")
-
driverVersion
Returns the device driver version.- Specified by:
driverVersionin interfaceDevice- 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:
maxClockFrequencyin interfaceDevice- Returns:
- the maximum clock frequency in megahertz
-
deviceType
Returns the set of device types that classify this device.- Specified by:
deviceTypein interfaceDevice- Returns:
- set of device types (e.g., GPU, CPU, ACCELERATOR)
-
builtInKernels
Returns the set of built-in kernel names available on this device.- Specified by:
builtInKernelsin interfaceDevice- 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:
maxComputeUnitsin interfaceDevice- 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:
maxWorkItemDimensionsin interfaceDevice- 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:
maxWorkGroupSizein interfaceDevice- 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:
maxWorkItemSizesin interfaceDevice- Returns:
- array of maximum work-item counts per dimension
-
imageSupport
public boolean imageSupport()Returns whether the device supports image objects in kernels.- Specified by:
imageSupportin interfaceDevice- 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:
preferredVectorWidthFloatin interfaceDevice- Returns:
- the preferred vector width for float operations
-
withDeviceId
Copy the current immutable object by setting a value for thedeviceIdattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for deviceId- Returns:
- A modified copy or the
thisobject
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy or the
thisobject
-
withVendor
Copy the current immutable object by setting a value for thevendorattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for vendor- Returns:
- A modified copy or the
thisobject
-
withDeviceVersion
Copy the current immutable object by setting a value for thedeviceVersionattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for deviceVersion- Returns:
- A modified copy or the
thisobject
-
withDriverVersion
Copy the current immutable object by setting a value for thedriverVersionattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for driverVersion- Returns:
- A modified copy or the
thisobject
-
withMaxClockFrequency
Copy the current immutable object by setting a value for themaxClockFrequencyattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for maxClockFrequency- Returns:
- A modified copy or the
thisobject
-
withDeviceType
Copy the current immutable object with elements that replace the content ofdeviceType.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withDeviceType
Copy the current immutable object with elements that replace the content ofdeviceType. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of deviceType elements to set- Returns:
- A modified copy or
thisif not changed
-
withBuiltInKernels
Copy the current immutable object with elements that replace the content ofbuiltInKernels.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withBuiltInKernels
Copy the current immutable object with elements that replace the content ofbuiltInKernels. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of builtInKernels elements to set- Returns:
- A modified copy or
thisif not changed
-
withMaxComputeUnits
Copy the current immutable object by setting a value for themaxComputeUnitsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for maxComputeUnits- Returns:
- A modified copy or the
thisobject
-
withMaxWorkItemDimensions
Copy the current immutable object by setting a value for themaxWorkItemDimensionsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for maxWorkItemDimensions- Returns:
- A modified copy or the
thisobject
-
withMaxWorkGroupSize
Copy the current immutable object by setting a value for themaxWorkGroupSizeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for maxWorkGroupSize- Returns:
- A modified copy or the
thisobject
-
withMaxWorkItemSizes
Copy the current immutable object with elements that replace the content ofmaxWorkItemSizes. The array is cloned before being saved as attribute values.- Parameters:
elements- The elements for maxWorkItemSizes- Returns:
- A modified copy of
thisobject
-
withImageSupport
Copy the current immutable object by setting a value for theimageSupportattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for imageSupport- Returns:
- A modified copy or the
thisobject
-
withPreferredVectorWidthFloat
Copy the current immutable object by setting a value for thepreferredVectorWidthFloatattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for preferredVectorWidthFloat- Returns:
- A modified copy or the
thisobject
-
equals
This instance is equal to all instances ofImmutableDevicethat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:deviceId,name,vendor,deviceVersion,driverVersion,maxClockFrequency,deviceType,builtInKernels,maxComputeUnits,maxWorkItemDimensions,maxWorkGroupSize,maxWorkItemSizes,imageSupport,preferredVectorWidthFloat. -
toString
Prints the immutable valueDevicewith attribute values. -
copyOf
Creates an immutable copy of aDevicevalue. 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
Creates a builder forDevice.ImmutableDevice.builder() .deviceId(org.jocl.cl_device_id) // requireddeviceId.name(String) // requiredname.vendor(String) // requiredvendor.deviceVersion(String) // requireddeviceVersion.driverVersion(String) // requireddriverVersion.maxClockFrequency(int) // requiredmaxClockFrequency.addDeviceType|addAllDeviceType(net.bmahe.genetics4j.gpu.opencl.model.DeviceType) //deviceTypeelements .addBuiltInKernels|addAllBuiltInKernels(String) //builtInKernelselements .maxComputeUnits(int) // requiredmaxComputeUnits.maxWorkItemDimensions(int) // requiredmaxWorkItemDimensions.maxWorkGroupSize(long) // requiredmaxWorkGroupSize.maxWorkItemSizes(long[]) // requiredmaxWorkItemSizes.imageSupport(boolean) // requiredimageSupport.preferredVectorWidthFloat(int) // requiredpreferredVectorWidthFloat.build();- Returns:
- A new Device builder
-
createSafeList
-
createUnmodifiableSet
Unmodifiable set constructed from list to avoid rehashing. -
createUnmodifiableEnumSet
-