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 ClassesModifier and TypeInterfaceDescriptionstatic enumPriority levels for distributed tasks. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidallGather(ByteBuffer sendBuffer, ByteBuffer recvBuffer) Gathers data from all tasks using ByteBuffer.default voidallGather(DoubleBuffer sendBuffer, DoubleBuffer recvBuffer) Gathers data from all tasks and distributes the combined data to all tasks.default voidbarrier()Synchronizes all processes.default voidbroadcast(ByteBuffer buffer, int root) Broadcasts data from a root node using ByteBuffer.default voidbroadcast(DoubleBuffer buffer, int root) Broadcasts data from a root node to all other nodes.default voidfence()Synchronizes RDMA operations.default voidget(ByteBuffer target, int sourceRank, long offset) Initiates a one-sided data transfer from a remote node (RDMA Get) using ByteBuffer.default voidget(DoubleBuffer target, int sourceRank, long offset) Initiates a one-sided data transfer from a remote node (RDMA Get).intReturns the number of available processing nodes or cores.<T extends Serializable>
List<Future<T>> Submits a collection of tasks for execution.default voidput(ByteBuffer source, int targetRank, long offset) Initiates a one-sided data transfer to a remote node (RDMA Put) using ByteBuffer.default voidput(DoubleBuffer source, int targetRank, long offset) Initiates a one-sided data transfer to a remote node (RDMA Put).voidshutdown()Shuts down the context.<T extends Serializable>
Future<T> Submits a task for execution with NORMAL priority.default <T extends Serializable>
Future<T> submit(Callable<T> task, DistributedContext.Priority priority) Submits a task for execution with a specific priority.
-
Method Details
-
submit
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 executepriority- Priority level- Returns:
- Future representing the result
-
invokeAll
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
Initiates a one-sided data transfer to a remote node (RDMA Put).- Parameters:
source- Data to sendtargetRank- Target node IDoffset- Remote offset
-
get
Initiates a one-sided data transfer from a remote node (RDMA Get).- Parameters:
target- Buffer to receive datasourceRank- Source node IDoffset- Remote offset
-
put
Initiates a one-sided data transfer to a remote node (RDMA Put) using ByteBuffer. -
get
Initiates a one-sided data transfer from a remote node (RDMA Get) using ByteBuffer. -
fence
default void fence()Synchronizes RDMA operations. -
broadcast
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
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
Broadcasts data from a root node using ByteBuffer. -
allGather
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.
-