[GRASS-dev] grass.mapcalc() python wrapper using grass.start_command()

Glynn Clements glynn at gclements.plus.com
Mon Jun 25 04:51:00 PDT 2012


Hamish wrote:

> in making some of the python modules multithreaded, it would be
> useful to have a version of grass.mapcalc() which didn't wait
> until it was done, and returned the Popen object instead.
> 
> e.g. to process three r,g,b bands in parallel.
> 
> I just added an experimental grass.mapcalc_start() fn to trunk/
> lib/python/raster.py, any comments or better ideas how to do it?

The function looks okay, although using Python threads may be a better
approach in general.

Beyond that, bear in mind that running concurrent processes improves
latency at the expense of efficiency. Overall performance will
typically be improved if you're using cores which would otherwise be
idle, but be reduced if the system is under load. So I wouldn't
recommend forcing scripts to use concurrency.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list