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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,59c52143b2a1463b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How many hardware threads? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4c3a65d7$0$2405$4d3efbfe@news.sover.net> Date: Mon, 12 Jul 2010 09:40:56 +0200 Message-ID: NNTP-Posting-Date: 12 Jul 2010 09:40:56 CEST NNTP-Posting-Host: dc1a3ad9.newsspool1.arcor-online.net X-Trace: DXC=XkEJmU9e[63;]cDoEWD6A4ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2d2OU1aaAFV4[6LHn;2LCV>7enW;^6ZC`4\`mfM[68DC3kU6=8Z@mHo> X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:12332 Date: 2010-07-12T09:40:56+02:00 List-Id: On Sun, 11 Jul 2010 20:47:41 -0400, Peter C. Chapin wrote: > I see a couple of difficulties with writing effective parallel programs > for "ordinary" applications (that is, applications that are not > embarrassingly parallel). One difficulty is load balancing: how can one > decompose a problem to keep all processors reasonably busy? The other > difficulty is scalability: how can one design a single program that can > use 2, 4, 16, 128, or more processors effectively without knowing ahead > of time exactly how many processors there will be? I'm not an expert in > Ada tasking but it seems like these questions are as big a problem for > Ada as they are for any other language environment. Back in 90's, during the era of transputers, concurrent algorithms were decomposed knowing in advance the number of processors and the topology of the network of. (Unlike to multi-cores the transputers didn't share memory, they communicate over serial links connected physically) That time the consensus was that the problem is not solvable in general. So you designed up front both the algorithm and the topology. > I'm not an expert in > Ada tasking but it seems like these questions are as big a problem for > Ada as they are for any other language environment. > I'm not looking for a solution to all tasking problems here. But there > is one feature that seems like a necessary prerequisite to such a > solution. The language (or its standard library) needs to provide a > portable way for the program to determine how many hardware threads are > available. Well, maybe, but I don't think it would bring much. Especially because normally cores support multi-tasking. It would be more important for the architectures with the cores that do not (GPU etc). BTW, "hardware thread" = core? processor? ALU + an independent memory channel? etc. It is quite difficult to define and the algorithm's performance may heavily depend on the subtleness. ARG would say, look, it does not make sense for all platforms, forget it. > I'm about to write a simple program that decomposes into parallel, > compute-bound tasks quite nicely. How many such tasks should I create? Back in time it was popular to make it adaptive. I.e. you monitor the performance and adjust the size of the working threads pool as you go. I remember some articles on this topic, but it was long long ago... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de