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,5164ccc41905b2d0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.95.97 with SMTP id dj1mr977519wib.4.1362889500826; Sat, 09 Mar 2013 20:25:00 -0800 (PST) MIME-Version: 1.0 Path: g1ni56838wig.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.130.MISMATCH!xlned.com!feeder1.xlned.com!news2.euro.net!feeds.phibee-telecom.net!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada and OpenMP Date: Sat, 9 Mar 2013 22:24:57 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <87k3pjht79.fsf@ludovic-brenta.org> <3e01ac49-4427-4f50-8577-8edab7e539a6@googlegroups.com> <9e0bbbdf-ccfa-4d4c-90af-2d56d46242b3@googlegroups.com> <513AB6D3.6030106@shaw.ca> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1362889500 11467 69.95.181.76 (10 Mar 2013 04:25:00 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 10 Mar 2013 04:25:00 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-03-09T22:24:57-06:00 List-Id: "Brad Moore" wrote in message news:513AB6D3.6030106@shaw.ca... > On 08/03/2013 4:36 PM, Randy Brukardt wrote: ... >> Take the OP's example, for example: >> >> for I in 1 .. MAX loop >> A(I) := A(I) + 1; -- Can raise Constraint_Error because of overflow >> or >> range checks. >> end loop; >> >> This can be done in parallel only if (A) there is no exception handler >> for >> Constraint_Error or others anywhere in the program; or > > I am working towards a new version of Paraffin to be released soon that > handles exceptions in such loops (as well as a number of other features). > > The technique though, is to have the workers catch any exception that > might have been raised in the users code, and then call > Ada.Exceptions.Save_Occurence to save the exception to be raised later. I'd expect this to work fine - it's how I'd implement it if I was doing that. The issue, though, is that this changes the semantics of the loop WRT to exceptions. Specifically, the parts of A that get modified would be unspecified, while that's not true for the sequential loop (the items that are modified have to be a contiguous group at the lower end of the array). That's fine for Paraffin, because no one will accidentally use it expecting deterministic behavior. It's not so clear when you actually write the loop syntax. Which is why a parallel loop syntax seems valuable, as it would make it explicit that parallelism is expected (and would also allow checking for dependencies between iterations, which usually can't be allowed). Of course, an alternative would be just to standardize a library like Paraffin for this purpose, possibly with some tie-in to the iterator syntax. (I know you proposed something on this line, but too late to include in Ada 2012.) Randy.