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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Alejandro R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Everything You Know Is Wrong Date: Mon, 4 Jan 2016 15:51:56 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 4 Jan 2016 14:49:17 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="1654d42d94197ce4c791bbd655806995"; logging-data="5313"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ilzBPsFW8emrfC5jZEdwK" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: Cancel-Lock: sha1:DGG0tUraxhFE0TrXzZpNioH3+Yk= Xref: news.eternal-september.org comp.lang.ada:29009 Date: 2016-01-04T15:51:56+01:00 List-Id: On 29/12/15 18:53, G.B. wrote: > On 29.12.15 18:36, Dmitry A. Kazakov wrote: >> On 2015-12-29 17:57, G.B. wrote: >> >>> The point is that, since order does not matter among these parallel >>> computations, and since parallel loops are not just fantasy, >>> the possibility of postponement follows from parallel loops. >> >> Ada does not have parallel loops. > > Ada is about to have parallel loops. Ada compilers already produce > code for parallel execution of loop bodies on today's processors. In this regard, just the other day I discovered Matlab's parfor, which as expected just parallelizes what would be a plain loop. It even emits some warnings about how the input data should be structured/used to minimize data transmission to the workers (which may be remote). I guess it would be interesting to look at how this and other languages do it. -Álex. > > >>> Consider F1 and F2 from a Pure package, X a variable of type T >>> and T without progenitors: >>> >>> declare >>> A : T := F1 (1,2,3); >>> B : T := F2 (X); >>> begin >>> G (A, B); >>> end; >>> >>> Is it impossible for a compiler to see that the initializing parts of >>> the declarations of A and B are independent? >> >> No, because initialization of T may have side effects. > > I assume you meant Yes, impossible. But, > if F1 and F2 are from a Pure package, is the compiler allowed to > ignore side effects because the programmer specified Pure? I think > that follows. > >> BTW, why do you believe that the same amount of computation performed >> consecutively should require less energy or (not quite same) less >> battery drain? > > Less energy at a certain point in time. Postpone calling sub if, say, > a photocell should first be given time to recharge a battery while > while regular operation continues, then call sub. > >