comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Re: Ada and OpenMP
Date: Thu, 07 Mar 2013 19:39:10 -0500
Date: 2013-03-07T19:39:10-05:00	[thread overview]
Message-ID: <za6dnTU03LGyrqTM4p2dnAA@giganews.com> (raw)
In-Reply-To: <khb8m6$933$1@munin.nbi.dk>


On 03/07/2013 06:42 PM, Randy Brukardt wrote:

> Isn't OpenMP aimed at SIMD-type machines (as in video processors), as
> opposed to generalized cores as in typical Intel and ARM designs?
> Fine-grained parallelism doesn't make much sense on the latter, because
> cache coherence and core scheduling issues will eat up gains in almost all
> circumstances. Ada tasks are a much better model.

Well, I used OpenMP for a program targeting x64 architectures and it 
worked well in my case. It was easy to use: my program became 8x faster 
by the addition of a single line of source text. It even computed the 
right answer. My program was very well suited to the OpenMP model of 
computation, however, so I wouldn't expect such a dramatic result in all 
cases of course.

> Well, this doesn't make much sense. If the pragma doesn't change the
> semantics of the loop, then its not necessary at all (the compiler can and
> ought to do the optimization when it makes sense, possibly under the control
> of global flags). Programmers are lousy at determining where and how the
> best of use of machine resources can be made.

I only used the pragma above to follow the mindset of OpenMP under C. I 
agree it might not be the best way to do it in Ada.

I'm a little uncertain, though, about how well the compiler can be 
expected to find this sort of parallelization... at least with current 
technology. The compiler I was using for the program above, and it 
wasn't an ancient one, certainly had no idea how to do such things on 
its own.

In a high performance application nested loops are common and often the 
body of a loop calls a subprogram implemented in a library that itself 
has loops. I don't want all of these nested loops parallelized because 
that would create huge overheads. Yet without detailed semantic 
information about what the library subprograms do, I'm not sure how the 
compiler can know it's safe to parallelize the top level loop.

I'm not an expert in writing parallelizing compilers for sure, but it 
seemed to me, when I was experimenting with OpenMP, that it did a nice 
job of taking care of the grunt work while still allow me to apply my 
broad knowledge of the application to find good places to parallelize.

I certainly could have written my earlier program with tasks. In fact I 
had a version that used threads before I tried OpenMP. It worked but it 
was ugly and a bit flaky. Doing the job with one line was certainly a 
lot nicer and proved to be more reliable (and faster running too, in my 
case).

Peter



  reply	other threads:[~2013-03-08  0:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 18:04 Ada and OpenMP Rego, P.
2013-03-07 20:04 ` Ludovic Brenta
2013-03-07 22:22   ` Peter C. Chapin
2013-03-07 23:42     ` Randy Brukardt
2013-03-08  0:39       ` Peter C. Chapin [this message]
2013-03-08  3:31         ` Randy Brukardt
2013-03-08  7:17           ` Simon Wright
2013-03-08 23:40             ` Randy Brukardt
2013-03-08 12:07           ` Peter C. Chapin
2013-03-08 14:40         ` Rego, P.
2013-03-08  1:15       ` Shark8
2013-03-08  3:42         ` Randy Brukardt
2013-03-08 14:53           ` Rego, P.
2013-03-08 15:47             ` Georg Bauhaus
2013-03-08 23:40             ` Randy Brukardt
2013-03-08 16:52           ` Shark8
2013-03-08 23:36             ` Randy Brukardt
2013-03-09  4:13               ` Brad Moore
2013-03-10  4:24                 ` Randy Brukardt
2013-03-08  7:37       ` Simon Wright
2013-03-10 18:00       ` Waldek Hebisch
2013-03-07 23:43     ` Georg Bauhaus
2013-03-08 10:18       ` Georg Bauhaus
2013-03-08 14:24     ` Rego, P.
2013-03-07 22:52 ` Simon Wright
2013-03-08 21:37   ` Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox