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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.188.66 with SMTP id m63mr8156448iof.65.1508957789440; Wed, 25 Oct 2017 11:56:29 -0700 (PDT) X-Received: by 10.157.94.7 with SMTP id d7mr118057oti.8.1508957789355; Wed, 25 Oct 2017 11:56:29 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!csiph.com!feeder.erje.net!2.us.feeder.erje.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!l196no5567834itl.0!news-out.google.com!193ni1415iti.0!nntp.google.com!l196no5567832itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 25 Oct 2017 11:56:29 -0700 (PDT) In-Reply-To: <2908c15e-0359-460e-824d-f832da32d196@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=217.226.43.121; posting-account=5zx--goAAAD06H29EnWQGKTO-gctuXHl NNTP-Posting-Host: 217.226.43.121 References: <498648ad-7a60-4847-b272-772383d197d0@googlegroups.com> <2908c15e-0359-460e-824d-f832da32d196@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Poor performance after upgrate to xubuntu 17.10 From: Charly Injection-Date: Wed, 25 Oct 2017 18:56:29 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:48592 Date: 2017-10-25T11:56:29-07:00 List-Id: Am Montag, 23. Oktober 2017 00:04:19 UTC+2 schrieb Robert Eachus: > On Saturday, October 21, 2017 at 6:41:59 AM UTC-4, Charly wrote:=20 > > My Hardware > > AMD FX(tm)-8350 Eight-Core Processor >=20 > Oh boy! Welcome to the wonderful world of modern tasking. Intel chips wi= th Hyperthreading and the new AMD Ryzens are different, but the issues come= out the same: sometimes not all cores can be treated equally. >=20 > The 8350 has four modules with two cores each. Each core has its own L1 i= nstruction and data cache. It shares a 2 MByte L2 cache with its partner i= n the module, and there is an 8 Meg L3 cache. I assume your program is sma= ll enough that the compute tasks' instructions and data fit into the L1 cac= hes. >=20 > If you are using any floating point instructions or registers, that opens= up more potential problems. I have some compute cores that work best on B= ulldozer family AMD chips and Intel chips with Hyperthreading by using ever= y other CPU number: 0,2,4,6 in your case. But I don't think this code runs= into that. >=20 > So far, so good. But it looks like you are getting tripped up by one or = more data cache lines being shared between compute engines. (Instruction ca= che lines? Sharing is fine.) It could be an actual value shared among task= s, or several different values that get allocated in close proximity. I ho= pe, and count on, task stacks not being adjacent, so this usually happens f= or (shared) variables in the parent of the tasks, or variables in the spec = of generic library packages. >=20 > If this happens, the cache management will result in just what you are se= eing. Owning that cache line will act like a ring token passed from task t= o task. Parallel and Ta_Types are the two packages I'd be suspicious of. Th= e detail here that may be biting you is that the variables in these package= s are on the main stack, not duplicated, if necessary, in each task stack. >=20 > Eventually you get to the point of paranoia where you make anything that = goes on the main stack a multiple of 64 or 128 bytes and insure that the co= mpiler follows your intent. You also have the worker tasks copy as constant= s any main program variables that are, in their view, constants. >=20 > Finally, just good task programming. If you expect to have each task on = its own CPU core or thread, use affinities to tie them to specific cores. = Why? Modern processors do not flush all caches when an interrupt is servic= ed. If you have an interrupt that doesn't, you want the same task back on = that CPU or thread. (In fact, some CPUs go further, and have ownership tags= on the cache lines. So some data in cache can belong to the OS, and the r= est of it to your task.) >=20 > Note that when setting affinities, CPU 0 becomes affinity 1, etc. For eac= h thread there is a bit vector of threads it can run on. On Windows, the a= rgument is a hex number that converts to a bit vector. On a Hyperthreaded = or Zen CPU, affinity 3 means run on either thread on CPU 0. In your case 3= would mean run on either of the processors in module 0, and so on. Settin= g affinity to 0 is not a good idea. > =20 > By the way, is the duplicate value 'X' in the declaration of Ta_Types.Chi= p_Name intentional? Certainly worth a comment if it is. Hi, thank you for your elaborate answer but I still don't see why I got this strange behaviour, after I upgrated to the new version. For the previous 8 ubuntu-versions that I used for this hareware I had a decreasing runtime and constant total CPU usage when I increased the number of tasks. But now the runtime almost constant the total CPU usage increas= es with the number of tasks. I assume it's caused by the interaction of gnat and the new glib/libpthread= libraries. B.t.w. the two 'X' in Chip_Name is not a typo. There are 24 permutations of the colors red, green, blue and yellow, but 25 tiles so one permutation must occure twice. Sincerly Charly