From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Re: Ada and OpenMP
Date: Thu, 07 Mar 2013 17:22:03 -0500
Date: 2013-03-07T17:22:03-05:00 [thread overview]
Message-ID: <hr-dnULuncyRjqTM4p2dnAA@giganews.com> (raw)
In-Reply-To: <87k3pjht79.fsf@ludovic-brenta.org>
OpenMP is a different animal than Ada tasks. It provides fine grained
parallelism where, for example, it is possible to have the compiler
automatically parallelize a loop. In C:
#pragma omp parallel for
for( i = 0; i < MAX; ++i ) {
array[i]++;
}
The compiler automatically splits the loop iterations over an
"appropriate" number of threads (probably based on the number of cores).
In Ada one might write, perhaps
pragma OMP(Parallel_For)
for I in 1 .. MAX loop
A(I) := A(I) + 1
end loop;
Doing this with Ada tasks in such a way that it uses an optimal number
of threads on each execution (based on core count) would be much more
complicated, I should imagine. Please correct me if I'm wrong!
OpenMP has various other features, some of which could be done naturally
with tasks, but much of what OpenMP is about is semi-automatic fine
grained parallelization. It is to Ada tasking what Ada tasking is to the
explicit handling of locks, etc.
Peter
On 03/07/2013 03:04 PM, Ludovic Brenta wrote:
> Rego, P. writes on comp.lang.ada:
>> I'm trying some exercises of parallel computing using that pragmas
>> from OpenMP in C, but it would be good to use it also in Ada. Is it
>> possible to use that pragmas from OpenMP in Ada? And...does gnat gpl
>> supports it?
>
> Why would you use pragmas when Ada supports tasking directly in the
> language?
>
next prev parent reply other threads:[~2013-03-07 22:22 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 [this message]
2013-03-07 23:42 ` Randy Brukardt
2013-03-08 0:39 ` Peter C. Chapin
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