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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada lacks lighterweight-than-task parallelism Date: Sat, 30 Jun 2018 10:41:14 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <993f28de-6a64-480b-9c6e-d9714bcdef0d@googlegroups.com> <167bec10-2a52-4c79-958d-91faadad915b@googlegroups.com> <2d6a5ab7-812f-47a9-a958-44177a3cf203@googlegroups.com> <64a526cb-e6d5-44a6-b446-5b652ebe60ca@googlegroups.com> NNTP-Posting-Host: 3CrKQyqWAJZHy6zYVP/kUg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:53471 Date: 2018-06-30T10:41:14+02:00 List-Id: On 2018-06-30 00:47, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:ph6b2l$1cta$1@gioia.aioe.org... >> On 2018-06-30 00:01, Randy Brukardt wrote: > ... >>> "Parallel" is mainly a hint to >>> the compiler that parallelism can be used (there's almost no case today >>> where a compiler could automatically use parallel code, as there would be >>> a >>> substantial risk of that code being slower than sequential code would >>> be). >> >> Why does it need such hints? > > One reason is that a loop is defined to iterate operations in a specific > order. For instance, in > for I in 1..5 loop -- I takes on the values of 1, 2, 3, 4, and 5, in that > order. The ability of a compiler to parallelize in such a case then requires > determining all of the following: > (1) That there are enough iterations in order to make parallelizing > worthwhile; > (2) That there is enough code in each iteration in order to make > parallelizing worthwhile; > (3) That there is no interaction between iterations; > (4) That there is no use of global variables. > > With "parallel", the compiler knows that the programmer has requested > unordered, parallel iteration, so it only needs make safety checks and > create the appropriate implementation. There should be unordered types in the meaning that the compiler is allowed to choose any order. Like enumeration type which has no specific order. It must be a property of the type you iterate through, not a property of the loop. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de