[GRASS-user] "Parallelization" of Python Script

Johannes Radinger johannesradinger at gmail.com
Tue Aug 7 01:08:10 PDT 2012


Hi,

for an example of grass.start_command() for parallelizing a bunch
> of r.cost runs, see v.surf.icw(.py) in grass7 addons:
>
>
> https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.surf.icw/v.surf.icw.py
>
> thank you for that example. I think it explains it very well how it works
to assign
multiple r.cost runs to single processes with grass.start_command.
I am just wondering how it is done when there are multiple consecutive
processes
in the for loop. In your example (v.surf.icw.py) for each step (e.g. r.cost
(line 271), r.mapcalc (298))
an separate for loop is started...Is there a way to combine the steps etc.
in a function (e.g. combination
of r.cost and mapcalc) and launch that function in a way like
grass.start_command in a single loop?
If possible that would probably save code lines and might be a little more
clear (at least to me).
I am just asking because one of my skripts which is still in "serial mode"
involves lots of steps inside the for loop.
This would create in parallel at least a dozen for loops which might appear
very unclear.

Anyway I think the parallelization can really save computation time of my
skripts... :)

/Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120807/80e0e5a5/attachment.html>


More information about the grass-user mailing list