Interface DistributedContext

All Known Implementing Classes:
GrpcDistributedContext, LocalDistributedContext, MPIDistributedContext, RemoteDistributedContext, SparkDistributedContext

public interface DistributedContext
Defines the contract for distributed computing contexts.

Implementations can range from local thread pools to cluster-based systems like Spark, Hazelcast, or GridGain.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Priority levels for distributed tasks.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    allGather(ByteBuffer sendBuffer, ByteBuffer recvBuffer)
    Gathers data from all tasks using ByteBuffer.
    default void
    allGather(DoubleBuffer sendBuffer, DoubleBuffer recvBuffer)
    Gathers data from all tasks and distributes the combined data to all tasks.
    default void
    Synchronizes all processes.
    default void
    broadcast(ByteBuffer buffer, int root)
    Broadcasts data from a root node using ByteBuffer.
    default void
    broadcast(DoubleBuffer buffer, int root)
    Broadcasts data from a root node to all other nodes.
    default void
    Synchronizes RDMA operations.
    default void
    get(ByteBuffer target, int sourceRank, long offset)
    Initiates a one-sided data transfer from a remote node (RDMA Get) using ByteBuffer.
    default void
    get(DoubleBuffer target, int sourceRank, long offset)
    Initiates a one-sided data transfer from a remote node (RDMA Get).
    int
    Returns the number of available processing nodes or cores.
    <T extends Serializable>
    List<Future<T>>
    invokeAll(List<Callable<T>> tasks)
    Submits a collection of tasks for execution.
    default void
    put(ByteBuffer source, int targetRank, long offset)
    Initiates a one-sided data transfer to a remote node (RDMA Put) using ByteBuffer.
    default void
    put(DoubleBuffer source, int targetRank, long offset)
    Initiates a one-sided data transfer to a remote node (RDMA Put).
    void
    Shuts down the context.
    <T extends Serializable>
    Future<T>
    submit(Callable<T> task)
    Submits a task for execution with NORMAL priority.
    default <T extends Serializable>
    Future<T>
    Submits a task for execution with a specific priority.
  • Method Details

    • submit

      <T extends Serializable> Future<T> submit(Callable<T> task)
      Submits a task for execution with NORMAL priority.
      Type Parameters:
      T - Result type
      Parameters:
      task - Task to execute
      Returns:
      Future representing the result
    • submit

      default <T extends Serializable> Future<T> submit(Callable<T> task, DistributedContext.Priority priority)
      Submits a task for execution with a specific priority.
      Type Parameters:
      T - Result type
      Parameters:
      task - Task to execute
      priority - Priority level
      Returns:
      Future representing the result
    • invokeAll

      <T extends Serializable> List<Future<T>> invokeAll(List<Callable<T>> tasks)
      Submits a collection of tasks for execution.
      Type Parameters:
      T - Result type
      Parameters:
      tasks - List of tasks
      Returns:
      List of Futures
    • getParallelism

      int getParallelism()
      Returns the number of available processing nodes or cores.
    • shutdown

      void shutdown()
      Shuts down the context.
    • put

      default void put(DoubleBuffer source, int targetRank, long offset)
      Initiates a one-sided data transfer to a remote node (RDMA Put).
      Parameters:
      source - Data to send
      targetRank - Target node ID
      offset - Remote offset
    • get

      default void get(DoubleBuffer target, int sourceRank, long offset)
      Initiates a one-sided data transfer from a remote node (RDMA Get).
      Parameters:
      target - Buffer to receive data
      sourceRank - Source node ID
      offset - Remote offset
    • put

      default void put(ByteBuffer source, int targetRank, long offset)
      Initiates a one-sided data transfer to a remote node (RDMA Put) using ByteBuffer.
    • get

      default void get(ByteBuffer target, int sourceRank, long offset)
      Initiates a one-sided data transfer from a remote node (RDMA Get) using ByteBuffer.
    • fence

      default void fence()
      Synchronizes RDMA operations.
    • broadcast

      default void broadcast(DoubleBuffer buffer, int root)
      Broadcasts data from a root node to all other nodes.
      Parameters:
      buffer - The buffer containing data to broadcast. On root, this contains the source data. On other nodes, this buffer will be filled with the received data.
      root - The rank of the root node broadcasting the data.
    • allGather

      default void allGather(DoubleBuffer sendBuffer, DoubleBuffer recvBuffer)
      Gathers data from all tasks and distributes the combined data to all tasks.
      Parameters:
      sendBuffer - The buffer containing the data to be sent by this task.
      recvBuffer - The buffer where the gathered data from all tasks will be stored.
    • broadcast

      default void broadcast(ByteBuffer buffer, int root)
      Broadcasts data from a root node using ByteBuffer.
    • allGather

      default void allGather(ByteBuffer sendBuffer, ByteBuffer recvBuffer)
      Gathers data from all tasks using ByteBuffer.
    • barrier

      default void barrier()
      Synchronizes all processes. A process waits at this call until all processes have reached this barrier.