From: Friedrich on
Beliavsky a few minutes ago posted a link to one an interesting
article,
which reminded me of something that has been wondering my mind
for a while, but I had nowhere to ask.

So, in hope this may be the place, where people have hands on
experience with both, I was wondering if someone could explain
what is the difference between OpenMP and MPI ?

I've read the Wikipedia articles in whole, understood them in
segments, but am still pondering;
for a Fortran programmer who wishes one day to enter the world of
paralellism (just learning the basics of OpenMP now), what is the more
future-proof way to go ?


I would be grateful on all your comments,
Friedrich
From: Tim Prince on
On 7/2/2010 10:47 AM, Friedrich wrote:
> I was wondering if someone could explain
> what is the difference between OpenMP and MPI ?
>

> for a Fortran programmer who wishes one day to enter the world of
> paralellism (just learning the basics of OpenMP now), what is the more
> future-proof way to go ?
>
"hybrid" (OpenMP as the threading model for MPI_THREAD_FUNNELED) has been
in use for at least a decade, and continues to gain ground.


--
Tim Prince
From: Friedrich on
On Fri, 02 Jul 2010 12:18:54 -0400, Tim Prince <tprince(a)myrealbox.com>
wrote:

>On 7/2/2010 10:47 AM, Friedrich wrote:
>> I was wondering if someone could explain
>> what is the difference between OpenMP and MPI ?
>>
>
>> for a Fortran programmer who wishes one day to enter the world of
>> paralellism (just learning the basics of OpenMP now), what is the more
>> future-proof way to go ?
>>
>"hybrid" (OpenMP as the threading model for MPI_THREAD_FUNNELED) has been
>in use for at least a decade, and continues to gain ground.


Tim, thanks for your answer.

Unfortunatelly, I'm not sure what you ment (not sure whether there is
a part missing maybe here) - could you perhaps elaborate a little on
your meaning.

Friedrich
From: Tobias Burnus on
Friedrich wrote :
> Beliavsky a few minutes ago posted a link to one an interesting
> So, in hope this may be the place, where people have hands on
> experience with both, I was wondering if someone could explain
> what is the difference between OpenMP and MPI ?

Well, the following is very rough but should be okay for an overview:

OpenMP has a shared-memory model, i.e. all variables can be accessed,
unless they are explicitly marked as private. Additionally, the program
is run in serial (single thread) until a parallel section comes.
The consequence is that OpenMP is well suited for shared-memory systems,
i.e. multi-processors/multi-core systems. Additionally, you can slowly
start parallelizing by starting with the hot spots of the program.

MPI (and also coarrays, a Fortran 2008 feature, one will soon see in
more compilers) have a distributed-memory model: All data is private to
each process and the data has to be explicitly transferred to be
available to other processes.
The advantage is that this model works also well for distributed memory
systems (i.e. clusters of computers - linked with a fast connection
[Gigabitethernet, Infiniband etc.]). The disadvantage is that one
essentially needs to parallelize the whole program before it works - as
the processes cannot share memory.

Thus, if you want to parallelize the program for a few cores only,
OpenMP makes it much easier to do it step by step. If you plan to run it
on big machines, MPI (and coarrays) are better suited. Of course, one
can also run MPI on a single (multi-core) computer - and there was also
some compiler which supported OpenMP on distributed memory, but that's
roughly the difference.

Note: One can also combine both techniques in the same program.

Tobias
From: Colin Watters on


"Friedrich" <friedrich.schwartz(a)wahoo.with.a.y.com> wrote in message
news:ckur2618tag7buk10c8lngqpr2k4n94uec(a)4ax.com...
> Beliavsky a few minutes ago posted a link to one an interesting
> article,
> which reminded me of something that has been wondering my mind
> for a while, but I had nowhere to ask.
>
> So, in hope this may be the place, where people have hands on
> experience with both, I was wondering if someone could explain
> what is the difference between OpenMP and MPI ?
>
> I've read the Wikipedia articles in whole, understood them in
> segments, but am still pondering;
> for a Fortran programmer who wishes one day to enter the world of
> paralellism (just learning the basics of OpenMP now), what is the more
> future-proof way to go ?
>
>
> I would be grateful on all your comments,
> Friedrich

Caveat: I have no actual hands-on experience of either of these, just hopes
and wishes. However...

I think the "essential" difference is between the "shared-memory, multiple
threads in one process" model that OpenMP provides, and the "multiple
process, each with private memory" model of MPI.

OpenMP's single process means little or no communications overhead. But it
doesn't scale well after about 8 processors. Depending on the problem of
course.

MPI's multiple processes demand Inter Process Communication (IPC), which is
a big learning curve, and a lot of work up front. But once the IPC is in
place, MPI can be made to scale much better than OpenMP.

OpenMP is well suited to the recent crop of multi-core PCs, but is (little
or) no help with clusters.

And of course an awful lot depends on the problem you are trying to
simulate/solve.

Anyone with actual experience care to comment?

--
Qolin

Email: my qname at domain dot com
Domain: qomputing