From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8060bed478dfa9cd X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.198.196 with SMTP id ep4mr11754270qab.3.1356587851506; Wed, 26 Dec 2012 21:57:31 -0800 (PST) Received: by 10.49.94.129 with SMTP id dc1mr4429321qeb.22.1356587851483; Wed, 26 Dec 2012 21:57:31 -0800 (PST) Path: k2ni3151qap.0!nntp.google.com!ee4no2485396qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 26 Dec 2012 21:57:31 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=216.244.16.210; posting-account=G2BOGAoAAABQ8nw7Yxnboy4xN0n3zUVV NNTP-Posting-Host: 216.244.16.210 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada 2012 automatic concurrency? From: charleshixsn@earthlink.net Injection-Date: Thu, 27 Dec 2012 05:57:31 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-12-26T21:57:31-08:00 List-Id: 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?