comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: Large number of tasks slows down my program (using debian) - any fix?
Date: Sat, 7 Apr 2018 09:28:23 -0700 (PDT)
Date: 2018-04-07T09:28:23-07:00	[thread overview]
Message-ID: <c41f508c-9b42-422c-9f58-f29c0f611416@googlegroups.com> (raw)
In-Reply-To: <pa9un7$b61$1@dont-email.me>

On Saturday, April 7, 2018 at 2:15:37 AM UTC-6, Jeffrey R. Carter wrote:
> On 04/07/2018 06:39 AM, Brad Moore wrote:
> > 
> > You are correct that technically the compiler would be right to complain here,
> > but I tried the code and compiled it exactly as presented on the website, and it compiles fine for me.
> > 
> > What version of compiler are you using?
> 
> Technically, it compiled with a warning that the call would raise Program_Error. 
> I got the warning with a wavefront of GNAT Pro 18 under Linux. Running the 
> program did result in the exception.
> 
> > I tried your version of the code with my version of the compiler, but the times for both versions were almost identical. It sounds like your compiler is quite different from the one I am using. I am running under Linux on an AMD quadcore system.
> 
> Interesting. I also tried my version with FSF GNAT 7.2.0 on a Core i7 with 4 
> virtual processors under Linux and got times about 6.6-9.6 s, depending on 
> options. Fastest seems to be my default set of options
> 
> -gnatan -gnato2 -O2 -fstack-check
> 
> and the slowest
> 
> -gnatp -gnat05
> 
> (compiler runs in Ada-12 mode by default).

Sorry, my two runs had identical times, because the sources were identical, I somehow copied the files incorrectly renaming yours to .old and mine to the new one in my test directory.

After fixing this, I do see a noticeable difference.

My version took 44.4 seconds with your suggested compiler options,
and your version took 11.1 seconds.

I notice also that I dont think there is a real need for 503 Ada tasks for this benchmark. There are conceptually 503 objects that "pass the baton" serially in a ring, each time the protected object is called.

So, I then thought, why not set the number of Ada worker tasks to 4 instead of 503, while keeping the number of baton passers at 503.

When I change that, the code improves to complete in 6.9 seconds.

Then I thought, why even have 4 workers. Why not just one? When I set the number of Ada tasks to 1, then there is even more improvement, the code completes in 1.6 seconds. With just 1 worker, why even have a protected object?
Why not just make it a procedure call? And so on..

After doing this though, I cannot help but think that somewhere along the way, I would have crossed the line of fairness and the intent of what the benchmark is attempting to test. I have also lost some of the demonstration of Ada tasking features. I liked the entry usage because waiting for an entry barrier to open seemed something like a runner waiting for the previous runner to pass him the baton. With a protected procedure, that handoff analogy seems to get lost.

If you think your version is a fair test though, it is an interesting comparison point, then I'd suggest you submit your version to the benchmark site, if you like. They are fairly picky in what they'd accept. There is a chance they'd reject it, but you never know.

Brad 

  reply	other threads:[~2018-04-07 16:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 18:06 Large number of tasks slows down my program (using debian) - any fix? reinert
2018-03-28 18:49 ` Dennis Lee Bieber
2018-03-28 19:06 ` Paul Rubin
2018-03-28 19:21 ` Dmitry A. Kazakov
2018-03-28 20:17   ` reinert
2018-03-29  8:46     ` reinert
2018-03-29  9:18       ` Dmitry A. Kazakov
2018-03-29 15:39       ` Jeffrey R. Carter
2018-04-15  5:20         ` reinert
2018-03-29 22:33 ` Shark8
2018-03-30  9:04   ` Dmitry A. Kazakov
2018-03-30 20:46     ` Paul Rubin
2018-03-31  0:09       ` Randy Brukardt
2018-03-31  6:00         ` Paul Rubin
2018-03-31  9:37           ` Jacob Sparre Andersen
2018-03-31 10:44             ` Dmitry A. Kazakov
2018-04-02  3:35           ` Randy Brukardt
2018-04-02  6:23     ` alby.gamper
2018-04-02  7:12       ` alby.gamper
2018-04-05 14:07       ` Brad Moore
2018-04-05 15:09         ` Dmitry A. Kazakov
2018-04-07  4:16           ` Brad Moore
2018-04-05 15:30         ` Jeffrey R. Carter
2018-04-05 19:33           ` Spiros Bousbouras
2018-04-05 19:44           ` Simon Wright
2018-04-05 20:25             ` Jeffrey R. Carter
2018-04-06  5:58         ` Benchmarks Game: Thread ring (Was: Large number of tasks slows down my program (using debian) - any fix?) Jacob Sparre Andersen
2018-04-07  4:28           ` Brad Moore
2018-04-06 15:48         ` Large number of tasks slows down my program (using debian) - any fix? Jeffrey R. Carter
2018-04-07  4:39           ` Brad Moore
2018-04-07  8:15             ` Jeffrey R. Carter
2018-04-07 16:28               ` Brad Moore [this message]
2018-04-07 18:41                 ` Jeffrey R. Carter
2018-04-08  0:29                   ` Brad Moore
2018-04-08  8:25                     ` Jeffrey R. Carter
2018-04-08  0:06                 ` Robert I. Eachus
2018-04-07 16:51               ` Brad Moore
2018-04-07 12:21         ` Simon Wright
2018-04-07 16:57           ` Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox