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!feeder.eternal-september.org!news.fcku.it!peer04.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fx46.am4.POSTED!not-for-mail Subject: Re: Poor performance after upgrate to xubuntu 17.10 Newsgroups: comp.lang.ada References: <498648ad-7a60-4847-b272-772383d197d0@googlegroups.com> From: Chris M Moore User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <498648ad-7a60-4847-b272-772383d197d0@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Message-ID: <6GNGB.8746$pB6.5265@fx46.am4> X-Complaints-To: http://netreport.virginmedia.com NNTP-Posting-Date: Sat, 21 Oct 2017 19:58:58 UTC Organization: virginmedia.com Date: Sat, 21 Oct 2017 20:58:59 +0100 X-Received-Bytes: 3549 X-Received-Body-CRC: 2885550500 Xref: news.eternal-september.org comp.lang.ada:48557 Date: 2017-10-21T20:58:59+01:00 List-Id: On 21/10/2017 11:41, Charly wrote: > Hi, > > some months ago I started a new thread about performance for the new gnat-gpl-2017 compiler and a got some usefull helps so I will try it again. > > When I upgrate to new Software/Hardware I use a litte performance test program > that solves Rubics Tangle (https://www.jaapsch.net/puzzles/tangle.htm) with an > ada program, using a requested nubmer of tasks or no task at all. > The source code can be found here: https://github.com/CharlyGH/tangle. > > Today I upgrated from xubuntu 17.04 to 17.10 an got the folling problem: > > Let Tn be the runtime for using n tasks, T0 for no tasks. > For all previous versions I got the expected result > Tn = T0/n for all 1 <= n <= min(number of cores, 100) > The limit of 100 occures, because each task uses another tile/orientation > to start with and there are 25 tiles and 4 orientations so 100 combinations > to start with. But this limit lies in distant future :-). > > Now after switching to xubuntu 17.10 I got the following strange results: > > > $ for n in 0 1 2 4 8 ; do ./tangle -t $n; echo "----------------"; done > using: 0 tasks > duration 2569 ms > ---------------- > using: 1 tasks > duration 2571 ms > ---------------- > using: 2 tasks > duration 2229 ms > ---------------- > using: 4 tasks > duration 3101 ms > ---------------- > using: 8 tasks > duration 2545 ms > ---------------- > $ > > The time is almost constant with a maximum for n = 4. > This strange result including the maximum at 4 is reproducible. > > The value for n = 0 or 1 is the almost same as for the previous version of xubuntu. > > When the program is running, n cores are busy at 100 %, as expected. > > Booting the old Linux Kernel 4.10 had no effect. > > My Hardware > AMD FX(tm)-8350 Eight-Core Processor > > > Sincerly > Charly > I had a little look at your code. The main part is declare Worker : Ta_Parallel.Processes (1 .. Ta_Types_Pkg.Proc_Id_Type(Task_Count)); begin Ta_Parallel.Initialize(Verbose_Level); for Idx in Worker'Range loop Worker (Idx).Start (Idx); end loop; for Idx in Worker'Range loop Worker (Idx).Wait (Res); end loop; end; The problem here is the Wait line. After you start the tasks you then wait for each one to complete *in order*. So you are at the mercy of the scheduling algorithm in how it schedules the first task. Maybe when N=4 it starts 1, 2 3, 4 but completes 4, 3, 2, 1! When you exit the block all tasks will have completed so you don't really need the Wait. Chris -- sig pending (since 1995)