Interface TaskProvider<I extends Serializable, O extends Serializable>
- Type Parameters:
I- Input typeO- Output type
- All Known Implementing Classes:
MandelbrotTaskProvider
public interface TaskProvider<I extends Serializable, O extends Serializable>
Provider interface for creating distributed task instances.
TaskProvider enables the DOUBLE/Real abstraction. Each task type can have two implementations:
- DOUBLE: Uses raw double/float DOUBLEs. Fastest execution, but limited precision and no automatic GPU acceleration.
- Real: Uses the
RealAPI. Configurable precision (Float/Double/BigDecimal via MathContext) and automatic GPU offloading for supported operations.
Example implementation:
public class MandelbrotTaskProvider implements TaskProvider<int[], double[]> {
@Override
public DistributedTask<int[], double[]> createTask() {
return createTask(TaskRegistry.PrecisionMode.REAL); // Default to Real
}
@Override
public DistributedTask<int[], double[]> createTask(TaskRegistry.PrecisionMode mode) {
return mode == TaskRegistry.PrecisionMode.DOUBLE
? new DOUBLEMandelbrotTask()
: new RealMandelbrotTask();
}
}
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionCreates a task instance with default precision mode (typically REAL).Creates a task instance with the specified precision mode.default StringReturns a description of this task provider.Returns the task type identifier.default booleanIndicates whether GPU acceleration is supported.
-
Method Details
-
createTask
DistributedTask<I,O> createTask()Creates a task instance with default precision mode (typically REAL).- Returns:
- a new task instance
-
createTask
Creates a task instance with the specified precision mode.- Parameters:
mode- the precision mode (DOUBLE or REAL)- Returns:
- a new task instance
-
getTaskType
-
supportsGPU
default boolean supportsGPU()Indicates whether GPU acceleration is supported.GPU support is typically available only for REAL mode tasks.
- Returns:
- true if GPU is supported
-
getDescription
Returns a description of this task provider.- Returns:
- human-readable description
-