[GRASS-user] "Parallelization" of Python Script
Hamish
hamish_b at yahoo.com
Mon Aug 6 19:38:08 PDT 2012
Daniel wrote:
> One very simple trick would be to switch off using
> grass.run_command with grass.start_command.
> grass.start_command() spawns a child process that and continues
> on to the next line of code, so that you can have several
> processes going simultaneously. You just have to make sure that
> the processes play nice with each other and don't cause any
> problems. It's not the most elegant solution, but it's one that
> works for many things :)
(& when it works, it works pretty well)
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
maybe a bit more complicated than you need, but hopefully
enough to give you an idea. Other grass7 python scripts which
have been parallelized are listed in the grass wiki page.
e.g. r3.in.xyz.
Hamish
More information about the grass-user
mailing list