Class MPIDistributedContext
java.lang.Object
org.episteme.core.distributed.MPIDistributedContext
- All Implemented Interfaces:
DistributedContext
MPI-based implementation of DistributedContext.
This class provides integration with Message Passing Interface (MPI) for high-performance cluster computing.
Requirements:
- An MPI implementation (e.g., OpenMPI, MPICH) installed on the system.
- Java bindings for MPI (e.g., mpj-express or openmpi-java) on the classpath.
Simulation Mode: If MPI classes are not found, this context transparently falls back to
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Nested Class Summary
Nested classes/interfaces inherited from interface DistributedContext
DistributedContext.Priority -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of available processing nodes or cores.intgetRank()Returns the rank of the current node in the MPI world.intgetSize()Returns the total size of the MPI world.<T extends Serializable>
List<Future<T>> Submits a collection of tasks for execution.booleanChecks if the context is utilizing a real MPI environment.voidshutdown()Shuts down the context.<T extends Serializable>
Future<T> Submits a task for execution with NORMAL priority.
-
Constructor Details
-
MPIDistributedContext
Creates a new MPI Distributed Context.Attempts to initialize the MPI environment with the provided arguments. If MPI is not available or initialization fails, it falls back to a local simulation mode.
- Parameters:
args- Command line arguments for MPI initialization
-
-
Method Details
-
getRank
public int getRank()Returns the rank of the current node in the MPI world.- Returns:
- the rank (0 if local or master)
-
getSize
public int getSize()Returns the total size of the MPI world.- Returns:
- the size (1 if local)
-
submit
Description copied from interface:DistributedContextSubmits a task for execution with NORMAL priority.- Specified by:
submitin interfaceDistributedContext- Type Parameters:
T- Result type- Parameters:
task- Task to execute- Returns:
- Future representing the result
-
invokeAll
Description copied from interface:DistributedContextSubmits a collection of tasks for execution.- Specified by:
invokeAllin interfaceDistributedContext- Type Parameters:
T- Result type- Parameters:
tasks- List of tasks- Returns:
- List of Futures
-
getParallelism
public int getParallelism()Description copied from interface:DistributedContextReturns the number of available processing nodes or cores.- Specified by:
getParallelismin interfaceDistributedContext
-
shutdown
public void shutdown()Description copied from interface:DistributedContextShuts down the context.- Specified by:
shutdownin interfaceDistributedContext
-
isMpiAvailable
public boolean isMpiAvailable()Checks if the context is utilizing a real MPI environment.- Returns:
- true if MPI is loaded and connected, false if running in local fallback mode.
-