Class ImmutableKernelExecutionContext.Builder
java.lang.Object
net.bmahe.genetics4j.gpu.spec.fitness.kernelcontext.ImmutableKernelExecutionContext.Builder
- Direct Known Subclasses:
KernelExecutionContext.Builder
- Enclosing class:
ImmutableKernelExecutionContext
Builds instances of type
ImmutableKernelExecutionContext
.
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 long[]
private static final long
private long
private long[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableKernelExecutionContext
.private String
from
(KernelExecutionContext instance) Fill a builder with attribute values from the providedKernelExecutionContext
instance.globalWorkSize
(long... globalWorkSize) Initializes the value for theglobalWorkSize
attribute.workGroupSize
(long[] workGroupSize) Initializes the optional valueworkGroupSize
to workGroupSize.workGroupSize
(Optional<? extends long[]> workGroupSize) Initializes the optional valueworkGroupSize
to workGroupSize.
-
Field Details
-
INIT_BIT_GLOBAL_WORK_SIZE
private static final long INIT_BIT_GLOBAL_WORK_SIZE- See Also:
-
initBits
private long initBits -
globalWorkSize
private long[] globalWorkSize -
workGroupSize
private long[] workGroupSize
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forImmutableKernelExecutionContext
instances.new KernelExecutionContext.Builder() .globalWorkSize(long) // required
globalWorkSize
.workGroupSize(long[]) // optionalworkGroupSize
.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedKernelExecutionContext
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
globalWorkSize
Initializes the value for theglobalWorkSize
attribute.- Parameters:
globalWorkSize
- The elements for globalWorkSize- Returns:
this
builder for use in a chained invocation
-
workGroupSize
Initializes the optional valueworkGroupSize
to workGroupSize.- Parameters:
workGroupSize
- The value for workGroupSize- Returns:
this
builder for chained invocation
-
workGroupSize
Initializes the optional valueworkGroupSize
to workGroupSize.- Parameters:
workGroupSize
- The value for workGroupSize- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableKernelExecutionContext
.- Returns:
- An immutable instance of KernelExecutionContext
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-