fdsrun

Multiple meshes and MPI in FDS: how to speed up a run

fdsrun editorial team · · 6 min read

Why one big mesh is slow, how to split a model into meshes, balance MPI processes and where extra cores stop paying off.

An FDS model on a single mesh runs on one processor core, even if the computer has sixteen. To use more cores you have to split the domain into several meshes (&MESH) and run FDS with MPI, so that each process computes its own part of the model. A good split cuts run time several or a dozen times; a bad one achieves almost nothing.

Rule 1: equal cells per process

MPI processes compute in parallel, but in every time step they exchange data at mesh interfaces and wait for each other. If one process has twice as many cells as the others, the rest sit idle half the time. The NIST documentation is explicit: for MPI to work well, each process needs a comparable number of cells — and even then two processes will not finish in half the time, because of communication and extra boundary cells (FDS User Guide, sections 6.3.3 and 3.3.1).

A simple test: divide the total cell count by the number of processes and compare it with the largest mesh. If the largest mesh is much bigger than the average, it sets the pace.

Rule 2: several small meshes can share a process

The MPI_PROCESS parameter on &MESH assigns several meshes to one process. This makes sense when meshes differ in size: small meshes are grouped so that every process gets a similar total. Neighbouring meshes on the same process exchange data directly, without MPI communication. Process numbers must be consecutive and ascending, starting from 0.

fdsrun does this automatically: before the run it assigns meshes to processes so that the busiest process has as few cells as possible, and shows how the forecast time changes with the number of processes.

Rule 3: mesh interfaces

How many processes make sense

Each additional process gains less: communication and boundary cells grow. In our calibration runs on a single cloud server (FDS 6.10.1) the speed-up stopped growing at around 16 processes, and servers with dedicated cores were not faster than shared ones at several times the price. For typical building models, 8–16 well-balanced processes usually give the best time-to-cost ratio.

According to NIST, OpenMP (threads within one process) speeds a calculation up by at most about a factor of two; it is usually better to divide the domain into more meshes and run one thread per process.

Example

A hall of 60 × 40 × 10 m with 20 cm cells: 300 × 200 × 50 = 3,000,000 cells.

  • 1 mesh, 1 process: about 3,000,000 × 3.5 µs ≈ 10.5 s per step;
  • 12 meshes of 250,000 cells (for example 4 × 3 in plan), 12 processes: ≈ 0.9 s per step;
  • with ~20,000 steps that is about 58 h versus about 5 h.

Checklist before the run

The free tool below checks all of these points — together with the forecast time for the best number of processes.

More guides

Sources: FDS User Guide (NIST SP 1019), chapter 3 and sections 6.3.3, 6.3.4, 21.1; fdsrun measurements. FDS and Smokeview are software of the National Institute of Standards and Technology; NIST is not affiliated with fdsrun.

Are you sure?