Class LocalDistributedContext

java.lang.Object
org.episteme.core.distributed.LocalDistributedContext
All Implemented Interfaces:
DistributedContext

public class LocalDistributedContext extends Object implements DistributedContext
Local implementation of DistributedContext using ForkJoinPool.

This serves as the default "distributed" context, running tasks in parallel on the local machine.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • LocalDistributedContext

      public LocalDistributedContext()
    • LocalDistributedContext

      public LocalDistributedContext(int parallelism)
  • Method Details

    • submit

      public <T extends Serializable> Future<T> submit(Callable<T> task)
      Description copied from interface: DistributedContext
      Submits a task for execution with NORMAL priority.
      Specified by:
      submit in interface DistributedContext
      Type Parameters:
      T - Result type
      Parameters:
      task - Task to execute
      Returns:
      Future representing the result
    • invokeAll

      public <T extends Serializable> List<Future<T>> invokeAll(List<Callable<T>> tasks)
      Description copied from interface: DistributedContext
      Submits a collection of tasks for execution.
      Specified by:
      invokeAll in interface DistributedContext
      Type Parameters:
      T - Result type
      Parameters:
      tasks - List of tasks
      Returns:
      List of Futures
    • getParallelism

      public int getParallelism()
      Description copied from interface: DistributedContext
      Returns the number of available processing nodes or cores.
      Specified by:
      getParallelism in interface DistributedContext
    • shutdown

      public void shutdown()
      Description copied from interface: DistributedContext
      Shuts down the context.
      Specified by:
      shutdown in interface DistributedContext
    • put

      public void put(DoubleBuffer source, int targetRank, long offset)
      Description copied from interface: DistributedContext
      Initiates a one-sided data transfer to a remote node (RDMA Put).
      Specified by:
      put in interface DistributedContext
      Parameters:
      source - Data to send
      targetRank - Target node ID
      offset - Remote offset
    • get

      public void get(DoubleBuffer target, int sourceRank, long offset)
      Description copied from interface: DistributedContext
      Initiates a one-sided data transfer from a remote node (RDMA Get).
      Specified by:
      get in interface DistributedContext
      Parameters:
      target - Buffer to receive data
      sourceRank - Source node ID
      offset - Remote offset
    • put

      public void put(ByteBuffer source, int targetRank, long offset)
      Description copied from interface: DistributedContext
      Initiates a one-sided data transfer to a remote node (RDMA Put) using ByteBuffer.
      Specified by:
      put in interface DistributedContext
    • get

      public void get(ByteBuffer target, int sourceRank, long offset)
      Description copied from interface: DistributedContext
      Initiates a one-sided data transfer from a remote node (RDMA Get) using ByteBuffer.
      Specified by:
      get in interface DistributedContext
    • fence

      public void fence()
      Description copied from interface: DistributedContext
      Synchronizes RDMA operations.
      Specified by:
      fence in interface DistributedContext
    • broadcast

      public void broadcast(DoubleBuffer buffer, int root)
      Description copied from interface: DistributedContext
      Broadcasts data from a root node to all other nodes.
      Specified by:
      broadcast in interface DistributedContext
      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.
    • broadcast

      public void broadcast(ByteBuffer buffer, int root)
      Description copied from interface: DistributedContext
      Broadcasts data from a root node using ByteBuffer.
      Specified by:
      broadcast in interface DistributedContext
    • allGather

      public void allGather(DoubleBuffer sendBuffer, DoubleBuffer recvBuffer)
      Description copied from interface: DistributedContext
      Gathers data from all tasks and distributes the combined data to all tasks.
      Specified by:
      allGather in interface DistributedContext
      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.
    • allGather

      public void allGather(ByteBuffer sendBuffer, ByteBuffer recvBuffer)
      Description copied from interface: DistributedContext
      Gathers data from all tasks using ByteBuffer.
      Specified by:
      allGather in interface DistributedContext
    • barrier

      public void barrier()
      Description copied from interface: DistributedContext
      Synchronizes all processes. A process waits at this call until all processes have reached this barrier.
      Specified by:
      barrier in interface DistributedContext