[GRASS-dev] [bug #5252] (grass) Multicore hardware and grass

this bug's URL: http://intevation.de/rt/webrt?serial_num=5252
-------------------------------------------------------------------------

Subject: Multicore hardware and grass

Platform: GNU/Linux/x86_64
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources

This time next year dual quad - core desktop systems should be readily available. What level of effort would it take for GRASS to be able to split the processing load between the multiple cores?

Doug Newcomb ( obviously not a C programmer :-))

-------------------------------------------- Managed by Request Tracker

Hi list,
Jason and I have been doing some limited tests,
it looks like some functions r.* get to be twice faster on a dual-core
than on a P4.
I guess Jason still has the numbers, could you please share them? I am
out of office right now...

However, it seems that it is not the same for all functions/modules...
cheers,
Yann

On 02/11/06, Request Tracker <grass-bugs@intevation.de> wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5252
-------------------------------------------------------------------------

Subject: Multicore hardware and grass

Platform: GNU/Linux/x86_64
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources

This time next year dual quad - core desktop systems should be readily available. What level of effort would it take for GRASS to be able to split the processing load between the multiple cores?

Doug Newcomb ( obviously not a C programmer :-))

-------------------------------------------- Managed by Request Tracker

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Some Google Working rules:
* Developers can switch teams and/or projects any time they want, no
questions asked; just say the word and the movers will show up the
next day to put you in your new office with your new team.
* There aren't very many meetings. I'd say an average developer
attends perhaps 3 meetings a week.
* Google has a philosophy of not ever telling developers what to work
on, and they take it pretty seriously.
* Google tends not to pre-announce. They really do understand that you
can't rush good cooking, you can't rush babies out, and you can't rush
software development.

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5252

This time next year dual quad - core desktop systems should be readily
available. What level of effort would it take for GRASS to be able to
split the processing load between the multiple cores?

Most of GRASS' processing is in the individual modules, so you would
have to re-write individual modules using multi-threaded algorithms.

It doesn't help that the core GRASS libraries aren't remotely
thread-safe, and can't readily be made so given the nature of the
existing API.

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

Hi,

I'm not an expert in this area, but as troll
(http://en.wikipedia.org/wiki/Internet_troll), I want to add my 0.02.

Glynn is right - GRASS is not monolite app, that could be tweaked to work in
paralell/threads. But individual modules could benefit from paralel
processing.

And here we come to political decision - how to paralelise it? It's realy
important, because GRASS should use one paralelisation mehanism (we don't
need one module that works with threads, second - Beowulfs and third works in
SSI systems) and there are more than one option. Do we need GRASS to run on
clusters? With modifications (like MPI for Beowulf) or by simply launching
mupltiple processes (openMosx and other SSI). Or using threads (POSIX or GNU
or ?) on slingle machine will be enough?

IMHO result of such discussion should be a note to GRASS programmers manual
like: "When You develop new module to work in paralel, You should use FOO to
make it work on/like BAR".

Maris.

PS. Some time a go there where efforts to make GRASS run on Beowulf clusters.
Is this subproject dead?

On Thursday 02 November 2006 05:23, Glynn Clements wrote:

Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=5252
>
> This time next year dual quad - core desktop systems should be readily
> available. What level of effort would it take for GRASS to be able to
> split the processing load between the multiple cores?

Most of GRASS' processing is in the individual modules, so you would
have to re-write individual modules using multi-threaded algorithms.

It doesn't help that the core GRASS libraries aren't remotely
thread-safe, and can't readily be made so given the nature of the
existing API.

Hi,
there was a discussion on IRC how to parallelize grass to run on multicore computers.
We came to the same conclusion as Glynn.
The design of the GRASS core libs
is not thread safe. And to port the core of grass to run in parallel on Beowulf clusters or SSI clusters is not practical.

But GRASS can work in parallel already. :slight_smile:
Just start several modules on several maps and hope the disk IO is
not the limiting factor. And this works on SSI clusters as well.

I think we should think more simple. Since gcc version 4.2, OpenMP is available for normal C/C++/Fortran developers without access to commercial compilers.
Individual modules can be parallelized for multicore systems with OpenMP (http://www.openmp.org).
And i think to work with OpenMP is much easier than posix threads, MPI, BSP or SunGrid and stuff.

But the main issues with GRASS and OpenMP are:

1.) You need some parallel programming experience or your programs will
     become slower in the end with OpenMP
2.) To debug multi threaded software is much harder than single thread
     software.
3.) The core libs are not thread safe, so you have to careful choose the
     library functions which are to use in parallel
4.) The data access to the harddisk dont scale in parallel on a single
     disk/conroler system, you will only benfit from OpenMP if you load
     the data to process completely in the memory
5.) ...

So there are only a few modules which will benefit from simple parallelizing with OpenMP.
To change this, the core of grass have to be implemented in
a new and different way.

But i think the grass developers have to think about to parallelize
grass. Because the future computer generations will work with multiple
cores (2 - 128?) and the users will expect that programms like grass
will use the multicore power to work. This is not an easy task and needs
a lot of programming knowledge ... well this can be added to the wish
section for grass version 10? :slight_smile:

Just my two cent
Soeren

Māris Nartišs schrieb:

Hi,

I'm not an expert in this area, but as troll (http://en.wikipedia.org/wiki/Internet_troll), I want to add my 0.02.

Glynn is right - GRASS is not monolite app, that could be tweaked to work in paralell/threads. But individual modules could benefit from paralel processing.

And here we come to political decision - how to paralelise it? It's realy important, because GRASS should use one paralelisation mehanism (we don't need one module that works with threads, second - Beowulfs and third works in SSI systems) and there are more than one option. Do we need GRASS to run on clusters? With modifications (like MPI for Beowulf) or by simply launching mupltiple processes (openMosx and other SSI). Or using threads (POSIX or GNU or ?) on slingle machine will be enough?

IMHO result of such discussion should be a note to GRASS programmers manual like: "When You develop new module to work in paralel, You should use FOO to make it work on/like BAR".

Maris.

PS. Some time a go there where efforts to make GRASS run on Beowulf clusters. Is this subproject dead?

On Thursday 02 November 2006 05:23, Glynn Clements wrote:

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5252

This time next year dual quad - core desktop systems should be readily
available. What level of effort would it take for GRASS to be able to
split the processing load between the multiple cores?

Most of GRASS' processing is in the individual modules, so you would
have to re-write individual modules using multi-threaded algorithms.

It doesn't help that the core GRASS libraries aren't remotely
thread-safe, and can't readily be made so given the nature of the
existing API.

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

But i think the grass developers have to think about to parallelize
grass. Because the future computer generations will work with multiple
cores (2 - 128?) and the users will expect that programms like grass
will use the multicore power to work. This is not an easy task and needs
a lot of programming knowledge ... well this can be added to the wish
section for grass version 10? :slight_smile:

I'd like to work on that for version 10+ of GRASS (i'll have to learn
a lot, but ready to!)
Yep, i also think that users will expect such thing from GRASS/any GIS software.

Sören Gebbert wrote:

there was a discussion on IRC how to parallelize grass to run on
multicore computers.
We came to the same conclusion as Glynn.
The design of the GRASS core libs
is not thread safe. And to port the core of grass to run in parallel on
Beowulf clusters or SSI clusters is not practical.

But GRASS can work in parallel already. :slight_smile:
Just start several modules on several maps and hope the disk IO is
not the limiting factor.

... and hope that the modules don't try to modify shared data (e.g.
the WIND file, $GISRC, etc) concurrently.

Certainly, multiple concurrent processes is the easiest way to take
advantage of multiple cores. This is easier to do for server
environments (e.g. web applications) than for "desktop" use.

And this works on SSI clusters as well.

I think we should think more simple. Since gcc version 4.2, OpenMP is
available for normal C/C++/Fortran developers without access to
commercial compilers.
Individual modules can be parallelized for multicore systems with OpenMP
(http://www.openmp.org).
And i think to work with OpenMP is much easier than posix threads, MPI,
BSP or SunGrid and stuff.

But the main issues with GRASS and OpenMP are:

1.) You need some parallel programming experience or your programs will
     become slower in the end with OpenMP

2.) To debug multi threaded software is much harder than single thread
     software.

Not to mention writing it in the first place.

Personally, I would rule out writing multi-threading modules simply on
the basis that most GRASS developers don't have enough experience in
concurrent programming.

[Programming experience in general is a relatively limited commodity
around here. Most GRASS developers are geoscientists with the kind and
level of programming experience normally acquired in scientific
disciplines.]

Writing (reliable) concurrent code is hard. Worse still, most testing
methodologies are poor at detecting concurrency-related bugs. Asking
relatively inexperienced programmers to write concurrent code is a
recipe for software which passes the test suite then regularly suffers
from intermittent (and usually non-repeatable) failures in actual use.

3.) The core libs are not thread safe, so you have to careful choose the
     library functions which are to use in parallel

IOW, you have to restrict the use of GRASS to one thread, with other
threads being used for "pure" computation. Unfortunately, most GRASS
code doesn't readily fit into that kind of model.

It would be more viable for certain computationally intensive modules,
particularly those which read an entire map into memory, do a lot of
processing, then write out results at the end.

Reading entire maps into memory is something we normally try to avoid,
and only use where the algorithm inherently requires random access (so
can't readily be adapted to a sequential-I/O strategy).

4.) The data access to the harddisk dont scale in parallel on a single
     disk/conroler system, you will only benfit from OpenMP if you load
     the data to process completely in the memory
5.) ...

So there are only a few modules which will benefit from simple
parallelizing with OpenMP.
To change this, the core of grass have to be implemented in
a new and different way.

But i think the grass developers have to think about to parallelize
grass. Because the future computer generations will work with multiple
cores (2 - 128?) and the users will expect that programms like grass
will use the multicore power to work. This is not an easy task and needs
a lot of programming knowledge ... well this can be added to the wish
section for grass version 10? :slight_smile:

:wink: Version 10 sounds about right.

A lot of the problem is that:

1. The libraries can't readily be parallelised without changing the API.
2. Changing the API means re-writing modules which use it.
3. Much of GRASS' value is in the modules, so re-writing the modules
equates to re-writing most of GRASS.

There might be some specific cases which are amenable to
parallelisation. E.g. it might be possible to re-write the core raster
I/O to use threads in a producer-consumer model, so that
get-row/put-row operations essentially take no time (i.e. the module
runs entirely in the main thread, while a separate thread performs the
raster I/O). That might give a 2x speed-up on a dual-core system, but
still wouldn't scale to larger numbers of cores (i.e. you would still
only get a 2x speed-up on a 16-core system).

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