[GRASS-git] [OSGeo/grass] 984389: r.sim: Simulate all walkers when running in parall...

Vaclav Petras noreply at github.com
Tue Sep 29 07:18:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 9843891c6aaa6bdabaf800ca1757317a29d39969
      https://github.com/OSGeo/grass/commit/9843891c6aaa6bdabaf800ca1757317a29d39969
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M raster/r.sim/simlib/hydro.c

  Log Message:
  -----------
  r.sim: Simulate all walkers when running in parallel (#7964)

Each thread computed its range of walkers from a chunk size rounded to
the nearest integer, steps = (int)(nwalk / nthreads + 0.5). When the
division rounded down, the walkers past the last range were never moved
and never added their water, up to (nthreads - 1) / 2 walkers in every
iteration, e.g., 1 of 2205 walkers with 4 threads, 7 of 1000007 with 16.

Round the chunk size up instead, so that the ranges cover all walkers.
The last range is cut at nwalk as before, and with fewer walkers than
threads, the last threads get empty ranges.

Single-threaded results do not change: the depth, discharge, sediment
flux and erosion/deposition maps computed from the nc_spm elevation are
byte-identical to those before this change.

Written with the help of Claude Code.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list