Class ParallelConfig.Builder
java.lang.Object
com.morphiqlabs.wavelet.extensions.parallel.ParallelConfig.Builder
- Enclosing class:
ParallelConfig
Builder for ParallelConfig.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadaptiveThreshold
(boolean adaptive) Enables or disables adaptive threshold selection.build()
Builds an immutableParallelConfig
with the configured options.chunkSize
(int size) Sets the chunk size used to partition work.enableAdaptiveTuning
(boolean enable) Enables or disables adaptive tuning (ML) feedback loop.enableGPU
(boolean enable) Enables or disables GPU acceleration when available.enableMetrics
(boolean enable) Enables or disables metric collection for diagnostics.enableParallelThresholding
(boolean enable) Enables or disables parallel thresholding in operations that support it.enableStructuredConcurrency
(boolean enable) Enables or disables structured concurrency patterns.Sets execution mode (CPU/GPU/ADAPTIVE).overheadFactor
(double factor) Sets an empirical overhead factor to tune parallel decisioning.parallelismLevel
(int level) Sets the desired CPU parallelism level.parallelThreshold
(int threshold) Sets the minimum input size threshold to trigger parallel execution.useVirtualThreads
(boolean use) Enables or disables virtual threads for I/O‑bound flows.
-
Constructor Details
-
Builder
public Builder()Creates a builder forParallelConfig
.
-
-
Method Details
-
parallelismLevel
Sets the desired CPU parallelism level.- Parameters:
level
- number of worker threads (>= 1)- Returns:
- this builder
- Throws:
IllegalArgumentException
- iflevel < 1
-
parallelThreshold
Sets the minimum input size threshold to trigger parallel execution.- Parameters:
threshold
- element count (>= 1)- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifthreshold < 1
-
useVirtualThreads
Enables or disables virtual threads for I/O‑bound flows.- Parameters:
use
- true to use virtual threads- Returns:
- this builder
-
enableGPU
Enables or disables GPU acceleration when available.- Parameters:
enable
- true to enable GPU usage- Returns:
- this builder
-
mode
Sets execution mode (CPU/GPU/ADAPTIVE).- Parameters:
mode
- execution mode- Returns:
- this builder
-
chunkSize
Sets the chunk size used to partition work. Defaults target L1 cache footprint; adjust for workload.- Parameters:
size
- elements per chunk (>= 1)- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifsize < 1
-
enableStructuredConcurrency
Enables or disables structured concurrency patterns.- Parameters:
enable
- true to enable structured concurrency- Returns:
- this builder
-
adaptiveThreshold
Enables or disables adaptive threshold selection.- Parameters:
adaptive
- true to adapt thresholds by level/complexity- Returns:
- this builder
-
overheadFactor
Sets an empirical overhead factor to tune parallel decisioning. Values > 1 increase the threshold for small tasks.- Parameters:
factor
- overhead multiplier (> 0)- Returns:
- this builder
- Throws:
IllegalArgumentException
- iffactor <= 0
-
enableParallelThresholding
Enables or disables parallel thresholding in operations that support it.- Parameters:
enable
- true to enable- Returns:
- this builder
-
enableMetrics
Enables or disables metric collection for diagnostics.- Parameters:
enable
- true to enable metrics- Returns:
- this builder
-
enableAdaptiveTuning
Enables or disables adaptive tuning (ML) feedback loop.- Parameters:
enable
- true to enable adaptive tuning- Returns:
- this builder
-
build
Builds an immutableParallelConfig
with the configured options.- Returns:
- new ParallelConfig instance
-