Class ImmutableDevice.Builder
java.lang.Object
net.bmahe.genetics4j.gpu.opencl.model.ImmutableDevice.Builder
- Enclosing class:
ImmutableDevice
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 Summary
Modifier and TypeFieldDescriptionprivate org.jocl.cl_device_id
private EnumSet
<DeviceType> private String
private String
private boolean
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private static final long
private long
private int
private int
private long
private int
private long[]
private String
private int
private String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal ImmutableDevice.Builder
addAllBuiltInKernels
(Iterable<String> elements) Adds elements tobuiltInKernels
set.final ImmutableDevice.Builder
addAllDeviceType
(Iterable<DeviceType> elements) Adds elements todeviceType
set.final ImmutableDevice.Builder
addBuiltInKernels
(String element) Adds one element tobuiltInKernels
set.final ImmutableDevice.Builder
addBuiltInKernels
(String... elements) Adds elements tobuiltInKernels
set.final ImmutableDevice.Builder
addDeviceType
(DeviceType element) Adds one element todeviceType
set.final ImmutableDevice.Builder
addDeviceType
(DeviceType... elements) Adds elements todeviceType
set.build()
Builds a newImmutableDevice
.final ImmutableDevice.Builder
builtInKernels
(Iterable<String> elements) Sets or replaces all elements forbuiltInKernels
set.final ImmutableDevice.Builder
deviceId
(org.jocl.cl_device_id deviceId) Initializes the value for thedeviceId
attribute.final ImmutableDevice.Builder
deviceType
(Iterable<DeviceType> elements) Sets or replaces all elements fordeviceType
set.final ImmutableDevice.Builder
deviceVersion
(String deviceVersion) Initializes the value for thedeviceVersion
attribute.final ImmutableDevice.Builder
driverVersion
(String driverVersion) Initializes the value for thedriverVersion
attribute.private String
final ImmutableDevice.Builder
Fill a builder with attribute values from the providedDevice
instance.final ImmutableDevice.Builder
imageSupport
(boolean imageSupport) Initializes the value for theimageSupport
attribute.final ImmutableDevice.Builder
maxClockFrequency
(int maxClockFrequency) Initializes the value for themaxClockFrequency
attribute.final ImmutableDevice.Builder
maxComputeUnits
(int maxComputeUnits) Initializes the value for themaxComputeUnits
attribute.final ImmutableDevice.Builder
maxWorkGroupSize
(long maxWorkGroupSize) Initializes the value for themaxWorkGroupSize
attribute.final ImmutableDevice.Builder
maxWorkItemDimensions
(int maxWorkItemDimensions) Initializes the value for themaxWorkItemDimensions
attribute.final ImmutableDevice.Builder
maxWorkItemSizes
(long... maxWorkItemSizes) Initializes the value for themaxWorkItemSizes
attribute.final ImmutableDevice.Builder
Initializes the value for thename
attribute.final ImmutableDevice.Builder
preferredVectorWidthFloat
(int preferredVectorWidthFloat) Initializes the value for thepreferredVectorWidthFloat
attribute.final ImmutableDevice.Builder
Initializes the value for thevendor
attribute.
-
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
-
vendor
-
deviceVersion
-
driverVersion
-
maxClockFrequency
private int maxClockFrequency -
deviceType
-
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
Fill a builder with attribute values from the providedDevice
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
Initializes the value for thedeviceId
attribute.- Parameters:
deviceId
- The value for deviceId- Returns:
this
builder for use in a chained invocation
-
name
Initializes the value for thename
attribute.- Parameters:
name
- The value for name- Returns:
this
builder for use in a chained invocation
-
vendor
Initializes the value for thevendor
attribute.- Parameters:
vendor
- The value for vendor- Returns:
this
builder for use in a chained invocation
-
deviceVersion
Initializes the value for thedeviceVersion
attribute.- Parameters:
deviceVersion
- The value for deviceVersion- Returns:
this
builder for use in a chained invocation
-
driverVersion
Initializes the value for thedriverVersion
attribute.- Parameters:
driverVersion
- The value for driverVersion- Returns:
this
builder for use in a chained invocation
-
maxClockFrequency
Initializes the value for themaxClockFrequency
attribute.- Parameters:
maxClockFrequency
- The value for maxClockFrequency- Returns:
this
builder for use in a chained invocation
-
addDeviceType
Adds one element todeviceType
set.- Parameters:
element
- A deviceType element- Returns:
this
builder for use in a chained invocation
-
addDeviceType
Adds elements todeviceType
set.- Parameters:
elements
- An array of deviceType elements- Returns:
this
builder for use in a chained invocation
-
deviceType
Sets or replaces all elements fordeviceType
set.- Parameters:
elements
- An iterable of deviceType elements- Returns:
this
builder for use in a chained invocation
-
addAllDeviceType
Adds elements todeviceType
set.- Parameters:
elements
- An iterable of deviceType elements- Returns:
this
builder for use in a chained invocation
-
addBuiltInKernels
Adds one element tobuiltInKernels
set.- Parameters:
element
- A builtInKernels element- Returns:
this
builder for use in a chained invocation
-
addBuiltInKernels
Adds elements tobuiltInKernels
set.- Parameters:
elements
- An array of builtInKernels elements- Returns:
this
builder for use in a chained invocation
-
builtInKernels
Sets or replaces all elements forbuiltInKernels
set.- Parameters:
elements
- An iterable of builtInKernels elements- Returns:
this
builder for use in a chained invocation
-
addAllBuiltInKernels
Adds elements tobuiltInKernels
set.- Parameters:
elements
- An iterable of builtInKernels elements- Returns:
this
builder for use in a chained invocation
-
maxComputeUnits
Initializes the value for themaxComputeUnits
attribute.- Parameters:
maxComputeUnits
- The value for maxComputeUnits- Returns:
this
builder for use in a chained invocation
-
maxWorkItemDimensions
Initializes the value for themaxWorkItemDimensions
attribute.- Parameters:
maxWorkItemDimensions
- The value for maxWorkItemDimensions- Returns:
this
builder for use in a chained invocation
-
maxWorkGroupSize
Initializes the value for themaxWorkGroupSize
attribute.- Parameters:
maxWorkGroupSize
- The value for maxWorkGroupSize- Returns:
this
builder for use in a chained invocation
-
maxWorkItemSizes
Initializes the value for themaxWorkItemSizes
attribute.- Parameters:
maxWorkItemSizes
- The elements for maxWorkItemSizes- Returns:
this
builder for use in a chained invocation
-
imageSupport
Initializes the value for theimageSupport
attribute.- Parameters:
imageSupport
- The value for imageSupport- Returns:
this
builder for use in a chained invocation
-
preferredVectorWidthFloat
Initializes the value for thepreferredVectorWidthFloat
attribute.- Parameters:
preferredVectorWidthFloat
- The value for preferredVectorWidthFloat- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableDevice
.- Returns:
- An immutable instance of Device
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-