Computing Library › HPC & Compute
HPC & Compute

MPI Shared-Memory Windows

MPI-3 lets processes on the same node allocate a shared-memory window they can access with ordinary load and store instructions.

Shared memory inside MPI

With MPI_Win_allocate_shared, ranks that live on one physical node can allocate a block of memory that all of them map into their address spaces. Once mapped, a rank reads and writes the shared block with plain pointer operations, no messages required. This gives the convenience of shared memory within a node while keeping MPI as the model across nodes, the pattern often called MPI+MPI as an alternative to MPI+OpenMP.

How it is set up

Kronos motion — reactivity window

A program splits the world communicator into per-node sub-communicators using MPI_Comm_split_type with MPI_COMM_TYPE_SHARED. Ranks in that sub-communicator jointly call MPI_Win_allocate_shared. Each rank then calls MPI_Win_shared_query to obtain a pointer to any other rank's portion. From there, access is direct memory access, subject to the usual concerns about ordering and visibility.

The main payoff

Large read-only tables, such as material cross-sections or an equilibrium field, can be stored once per node instead of once per rank. On a node running dozens of ranks, this cuts memory footprint sharply and removes redundant broadcasts. It is a practical answer to memory pressure when core counts per node are high.

Consistency caveats

Shared-memory windows do not remove the need for synchronization. Writers and readers must coordinate with window synchronization calls or explicit memory fences so that updates are visible in the intended order. Treating the window as if it were automatically coherent across all accesses is a common source of subtle bugs.

For a Hyperion neutronics run, storing one node-local copy of a large cross-section library in a shared window lets every rank on the node query it directly, freeing memory for more particles in flight.