Skip to main content
. 2023 Oct 23;19(10):e1010768. doi: 10.1371/journal.pcbi.1010768

Fig 4. Conceptual diagram of space discretization and task-based parallelism.

Fig 4

Space is discretized into subdomains called “cells” (shown here for N subdomains), and particles (listed as “PX”) are stored in memory by which cell contains them. For each simulation step, a set of threads, called “runners” (shown here for M runners) perform a pre-defined set of tasks. The “Sort” task builds ordered lists of particle indices according to proximity to neighboring cells for efficient pruning of inter-cell interactions between particle pairs outside of the cutoff distance. The “Force Self” task calculates interactions between particles of the same cell. The “Force Pair” task calculates interactions between particles of different cells using results from the Sort task. Task scheduling enforces task dependency. After all forces are calculated, particle positions are updated and particles that move into a neighboring cell are appropriately moved in memory, as demonstrated for particles P247 (from cell N to cell 1) and P233 (from cell 1 to cell 2).