Deployable OpenMPI + gRPC worker for distributed epidemic simulation. Rank 0 serves gRPC; other ranks join the simulation and aggregate state with MPI_Allreduce. Designed to run on a separate machine from the middleware (see companion pandemic-sim orchestrator if you use the full stack).
- Docker Desktop (Windows/macOS) or Docker Engine + Compose (Linux)
- CMake 3.15+
- OpenMPI
- gRPC and Protobuf
- C++17 compiler
git clone https://github.com/diptomistry/standalone-mpi-worker.git
cd standalone-mpi-workerOptional .env (defaults listen on 0.0.0.0:50054 with 4 ranks):
WORKER_HOST=0.0.0.0
WORKER_PORT=50054
MPI_RANKS=4docker-compose build
docker-compose up -d
docker-compose logs -fExpected logs include rank initialization and Server listening on 0.0.0.0:50054.
On the machine running middleware:
middleware:
environment:
- WORKER_MPI=192.168.1.60:50054 # MPI worker host:portdocker-compose restart middleware- Container runs OpenMPI via
mpirun -np MPI_RANKS ./mpi_worker <host:port> - Ranks participate in the simulation; results are reduced with
MPI_Allreduce - Only rank 0 runs the gRPC server toward middleware
standalone-mpi-worker/
├── docker-compose.yml
├── Dockerfile
├── .env.example
├── CMakeLists.txt
├── proto/
│ ├── pandemic_sim.proto
│ └── CMakeLists.txt
└── workers/mpi/
├── CMakeLists.txt
└── main.cpp
- gRPC is without TLS (fine for local lab networks). Enable TLS for anything exposed beyond a trusted network.
- Restrict inbound TCP on
WORKER_PORTto the middleware host.