comp.lang.ada
 help / color / mirror / Atom feed
From: jtg <jtg77@poczta.onet.pl>
Subject: Re: puzzled re hyperthreaded performance
Date: Thu, 15 Sep 2005 08:08:26 +0200
Date: 2005-09-15T08:08:26+02:00	[thread overview]
Message-ID: <dgb2sj$krc$1@news.task.gda.pl> (raw)
In-Reply-To: <yqGdnQID8rvOn7TeRVn-jA@comcast.com>

tmoran@acm.org wrote:
>   I have a multitasking program that runs faster if I insert a "delay d;"
> statement to prevent some of the multitasking overlap.
>   This is a version of the Shootout k-nucleotide program, which involves
> a series of create/fill/lookup in hash tables, using the Ada 95 version
> of Ada.Containers.Indefinite_Hashed_Maps  I let the operations run in
> two tasks, each with their own hash table.  Memory requirement are minor.
>     Alt_Task.Start;
>     delay d;
>     Compute;
>     Alt_Task.Finish;
> Alt_Task performs the same computations as Compute, reading the same
> String, but sharing no other data.  There are no obvious task interactions,
> and I don't see any in Ada.Containers
>   For every additional 1.0 seconds of "d", the sequence runs about 1.5
> seconds faster.  This is Gnat 3.15p on W2k on a hyperthreaded Pentium
> (two virtual CPUs).
>   Any suggestions what's going on?

For every second of parallel processing 1.5 second is lost.
So parallel processing slows the computations 2.5 times!
There may be several reasons, more or less obvious.
I guess the most important may be inefficient cache usage.
You may try to perform both operations in sequence, or make them
share the same hash table (if they perform the same computations on
the same data), or split the computations in other way (one
task with hash table and one for calculations only).
Other factor may be task switching, but I can't believe it can
slow the processing so hard!

By the way, when you have "proper" multiprocessor environment, where each
processor has its own cache, in certain circumstances you may observe the
opposite phenomenon: for example problem solving on two processors can run
MORE than two times faster.

I suggest you run a test in some "proper" multiprocessor environment,
i.e. two processors or a true multicore processor (with separate caches),
but not virtual MP.

One more thing: ensure Alt_Task is not terminated on Finish, but
the computations are completed.



  reply	other threads:[~2005-09-15  6:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15  5:10 puzzled re hyperthreaded performance tmoran
2005-09-15  6:08 ` jtg [this message]
2005-09-15 12:13   ` keld_nielsen_4nulspam
2005-09-15 20:44     ` tmoran
2005-09-15 21:43       ` tmoran
2005-09-19 20:21 ` Wiljan Derks
2005-09-20  0:26   ` tmoran
replies disabled

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