Interface TaskProvider<I extends Serializable, O extends Serializable>

Type Parameters:
I - Input type
O - 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 Real API. 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 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

      String getTaskType()
      Returns the task type identifier.
      Returns:
      the task type (e.g., "MANDELBROT")
    • 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

      default String getDescription()
      Returns a description of this task provider.
      Returns:
      human-readable description