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.6 required=5.0 tests=BAYES_00,FROM_WORDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cd86d70d109cd9b1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Chip Orange" Newsgroups: comp.lang.ada References: <459192a7$1@news.hcs.net> Subject: Re: multicore-multithreading benchmarks Date: Wed, 27 Dec 2006 12:53:28 -0500 Organization: FPSC X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 207.156.28.7 Message-ID: <4592aabf$1@news.hcs.net> X-Trace: news.hcs.net 1167239871 207.156.28.7 (27 Dec 2006 12:17:51 -0500) Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!bigfeed3.bellsouth.net!bigfeed!bigfeed2.bellsouth.net!news.bellsouth.net!news.hcs.net!not-for-mail Xref: g2news2.google.com comp.lang.ada:8025 Date: 2006-12-27T12:53:28-05:00 List-Id: wrote in message news:TOCdnecag8P5qA_YnZ2dnUVZ_qunnZ2d@comcast.com... > >wondering how a programmer should go about determining the number of >>cores dynamicly in order to make the best guess as to how many tasks to >>break his problem into? Is there a standard Ada library that would give >>some system info on the number of cores, and/or, perhaps some info on how >>heavily loaded the system is (perhaps if it's already heavily loaded you >>wouldn't necessarily want to try to set a task going to each core?). > The Windows API call GetProcessAffinityMap tells how many CPUs/cores are > available. In this (sorting) case, one could give a lower priority to one > of the tasks, so if multiple cores are available, you would have > multitasking, while if only one core wasn't busy, it would run the tasks > sequentially - essentially the same as if they weren't multitasked. > The programmer of a library routine would ideally like to be able to ask > "what's the current cost of CPU cycles, RAM, and cache space" and then > decide how much multitasking to do, or dynamically how to make > compute/memory tradeoffs, and he'd like to write his routines to change > behavior when the relative costs/scarcities change. Pending that > desirable situation, I just throw up my hands, include a CPUs_To_Use > parameter to the sort routine, and let someone who knows more about the > particular application and its likely environment make that decision. Thank you for the reply, and for the Windows API call information. It sounds like you're telling me, because you gave me the Windows API, that there's no "standard" way in Ada to handle any of this? Does this seem like a lack in Ada to you as it does to me, or am I missing some bigger picture? With multicore/cpus being readily available, wouldn't you think any programmer should be rewriting his applications to take advantage of this, and so, would need this type of information to do so? Or should we, as a general rule, just break all programming tasks into threads, assuming that the OS will handle load balancing better than we could? Thanks. Chip