[GRASS-user] Multithreading in GRASS 6.4

Hamish hamish_b at yahoo.com
Tue Jan 11 01:16:20 EST 2011

Daniel wrote:
> I'm trying to use multithreading in GRASS 6.4 in OpenSUSE
> 64-bit installed from the community repository and am
> wondering what the best way would be to set my script. What
> I'm wanting to do is several r.sun analyses parallel to
> one another using a Python script.

I've not done it in python, but for shell scripting see the
"poor man's multithreading" trick for r.sun on the wiki:


as job control is very much the shell's domain & OS specific,
I personally don't feel much demand to rewrite that in python.

The above gets you going on a multicore linux or mac system when
you have lots of jobs to run.

One thing to look into is Seth's Google Summer of Code project
from last year where he's added OpenCL support to r.sun. That
way the raytracing stuff (?) is run in the GPU, which is orders
of magnitude faster for that sort of calculation than the generic
CPU. Also I think OpenCL gives you the opportunity to optionally
multithread to a multicore CPU instead of the graphics card (?)
for speeding up a single job. I am yet to merge that OpenCL code
+ the needed configure script/makefile support into GRASS 7.
(sorry for the long delay Seth..)

see  http://grass.osgeo.org/wiki/R.sun#OpenCL

You'd have to assemble and recompile from source for that one,
but the speedup can be enormous.

OpenMP: not really implemented yet, although a couple of us have
been playing with it. Yann and Soeren have probably gotten the
furthest with it AFAIR.

Glynn's added pthreads support to r.mapcalc in GRASS 7 too,
AIUI that splits the I/O into one thread, and the calculations
into another. Beyond that a fast RAID array is probably your
best hope to speed up an IO limited process like r.mapcalc.

> the last couple of questions I've posted on this list
> haven't been answered at all. I can see the posts online but
> I never get any answers back. Is this not getting sent out to
> the subscribed users or are my questions too stupid? I don't
> mean to sound annoyed or anything - I'm really truly just
> wondering.

I thought we had a mention of that "why no responses?" FAQ on
the wiki at http://grass.osgeo.org/wiki/Mailing_list_etiquette
but I guess not yet. As Maris suggested, maybe no one knows the
answer, or those that do are busy or happen to be away for a few
weeks. keep trying :)



More information about the grass-user mailing list