From: charleshixsn@earthlink.net
Subject: Re: Ada 2012 automatic concurrency?
Date: Wed, 26 Dec 2012 21:57:31 -0800 (PST)
Date: 2012-12-26T21:57:31-08:00 [thread overview]
Message-ID: <cdf1f6a2-8773-4aa4-95a6-29fb810167d1@googlegroups.com> (raw)
In-Reply-To: <ak1difFu5plU1@mid.individual.net>
On Wednesday, December 26, 2012 2:55:11 PM UTC-8, Niklas Holsti wrote:
> On 12-12-25 19:26 , charleshixsn@earthlink.net wrote:
>
> > In the RM I read (page 209): NOTES 1 Concurrent task ex...
>
>
> I believe that the second sentence in your quote has a more general
> meaning: that an Ada compiler is allowed to generate code that uses
> several processors or cores in parallel just to implement a logically
> sequential (single-task) computation. For example, if your program
> contains the two statements:
>
> x := a + b;
> y := a - b;
>
> and the target computer has two processors or cores capable of addition
> and subtraction, the Ada compiler may generate code that uses these two
> processors in parallel, one to compute a+b and the other to compute a-b.
> This is allowed, since the semantic effects are the same as when using
> one processor for both computations (assuming that none of these
> variables is declared "volatile").
>
> So I don't think that your use or non-use of protected types (or tasks)
> is relevant to this RM sentence.
>
The use of protected types would be to ensure that the sections were independent.
>
> > If so, does Gnat do this?
>
> I think not, but it might be a feature of the GCC back-end rather than
> the GNAT Ada front-end.
>
> However, many high-performance processors today have multiple
> "functional units" per core, and the processor core itself can issue or
> execute several instructions in parallel, from the same program, even if
> the compiler intends or assumes sequential execution when it generates
> the instruction sequence.
>
> This multi-issue feature of modern processors means that there is less
> interest and profit in doing such fine-grain parallelization at
> compile-time. At most, the compiler should sequence instructions
> according to the data dependencies, to let the processor run several
> consecutive data-independent instructions in parallel.
>
> For large-grain parallelization, you should use tasks. I don't know of
> any Ada compiler, including GNAT, that does automatic large-grain
> parallelization.
> --
>
> Niklas Holsti
>
> Tidorum Ltd
>
> niklas holsti tidorum fi
>
> . @ .
Thank you. That was the answer I was expecting, if not the one I was hoping for. Tasks it is.
IIUC, there shouldn't be more than about twice as many tasks as cores. Is this about right?
next prev parent reply other threads:[~2012-12-27 5:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-25 17:26 Ada 2012 automatic concurrency? charleshixsn
2012-12-26 22:02 ` John B. Matthews
2012-12-26 22:55 ` Niklas Holsti
2012-12-27 5:57 ` charleshixsn [this message]
2012-12-27 8:59 ` Dirk Heinrichs
2012-12-27 11:22 ` Brian Drummond
2012-12-27 22:13 ` Randy Brukardt
2012-12-27 14:27 ` Jeffrey Carter
2012-12-27 20:13 ` tmoran
2012-12-27 19:06 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox