Skip to content

Commit 5bb7b02

Browse files
authored
r.mapcalc.simple: Add nprocs for r.mapcalc (#6584)
With r.mapcalc being parallel (#5742) and the default nprocs in C (for r.mapcalc) being all cores (#5731), it both makes sense and is necessary to have a pass-through nprocs in r.mapcalc.simple. This gives users access to the parallelization options (regardless of the default), and it allows users to avoid oversubscription (with the default being all cores). This depends on #6580 for the nprocs parameter in the gs.mapcalc function.
1 parent 1bcf99a commit 5bb7b02

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/r.mapcalc.simple/r.mapcalc.simple.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
# % description: Seed for rand() function
7676
# % guisection: Random
7777
# %end
78+
# %option G_OPT_M_NPROCS
79+
# %end
7880
# %flag
7981
# % key: s
8082
# % description: Generate random seed (result is non-deterministic)
@@ -139,7 +141,7 @@ def main():
139141

140142
expr = "{lhs} = {rhs}".format(lhs=output, rhs=expr)
141143
gs.verbose(_("Expression: {}").format(expr))
142-
gs.mapcalc(expr, seed=seed)
144+
gs.mapcalc(expr, seed=seed, nprocs=options["nprocs"])
143145
# g.message -e "Calculating $GIS_OPT_OUTFILE. Try expert mode."
144146

145147
return 0

0 commit comments

Comments
 (0)