Re: numerically intensive app doesn't benifit from multi threading



Based on this info i would guess yes. (you can go to the intel website to
verify this, but most chips ~ 3.0 GHz would not be dual core)

Assuming that you have a HT CPU, then the lack of speed improvment is only
to be expected since there are two logical CPUs but only 1 set of
computation resources physically in the silicocn.

"JC" <JC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1E3D3A27-835B-44EB-B9D1-94175C126F00@xxxxxxxxxxxxxxxx
Please also note that there is no hyper threading related logo on the PC.

"JC" wrote:

Here is the info from Dell:
PROCESSOR, 80547, PENTIUM 4 PRESCOTT DT, Pentium 4 Prescott DT, 3.0GHZ, 1
MEGB, 800FSB, SOCKET T, E0, MALE

Can you tell if it's hyberthreading?
Thx.

"JC" wrote:

How can you tell?

"m" wrote:

Are your 2 CPUs a singe hyperthreaded CPU?

"JC" <JC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0E9C29A6-F054-4E39-98E3-2FB506F27827@xxxxxxxxxxxxxxxx
This may be related to my another post in this group here "program
runs
almost twice as slow on 2 CPU machine when 1 CPU is used".

When I run single thread version of the program on 2 CPU
concurently, it's
almost twice as slow as when I run one instance only. When I run
multi
thread version of the program with 2 thread on 2 CPU, it's same as
running
single thread on 1 CPU.

"JC" wrote:

I have an numerically intensive app where there is a large loop.
I want
to
use multithreading to parallelize the loop. Say we have two
threads, the
1st
one will do 1st half the loop, the 2nd thread will do the other
half.
The
multithreaded loop look like:
for (i = indexBeginForThread; i < indexEndForThread; i++) {
do_numerical_stuff;
update_common_data;
}

The 1st part 'do_numerical_stuff', taking most of the time, and
requires
no
mutex to synchronize access to data. The 2nd part
'update_common_data'
takes
little time, and requires mutex to synchronize access to data.
You would
expect such a program will have a speed up of 40-50% when running
on 2
CPU.
But there is no speend up at all.

I am not sure what is causing no speed up at all.

I inserted 'clock()' function to time the time spend on
'do_numerical_stuff'
and 'update_common_data' in both threads. (I am not sure whether
this
works
as I don't know whether clock() is multithread safe). I found
that in
both
thead, the total time spent on 'do_numerical_stuff' is the same as
when
the
program is run in single thread mode. The total time spent on
'update_common_data' is tiny. So there shouldn't be a problem of
waiting
on
the mutex when doing 'update_common_data'.

Theoretically ''do_numerical_stuff' in both thread should use half
the
time
as in single thread mode.

The whole loop takes 2 seconds in a test run, and it should
benifit from
multi-threading.

Any insights?

Thanks a lot.





.



Relevant Pages

  • Re: numerically intensive app doesnt benifit from multi threading
    ... almost twice as slow on 2 CPU machine when 1 CPU is used". ... When I run single thread version of the program on 2 CPU concurently, ... one will do 1st half the loop, the 2nd thread will do the other half. ... and requires mutex to synchronize access to data. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Cost of calling a standard library function
    ... It accesses/reads memory using esi 4 ... > safly move it within the cache, without having to go via ebx. ... try it the same thing on a different earlier CPU, ... should check it out...for "tight inner loop" stuff, ...
    (alt.lang.asm)
  • Re: Polling, Interrupts, DMA, Synchronous, Asynchronous I/O Definitions
    ... the terminology is less useful than it might be. ... though a "message loop" could arguably be claimed to be ... considering in a particular iteration but what is true for _ALL_ ... watching the "polling" version eating up every single CPU cycle ...
    (alt.lang.asm)
  • Re: numerically intensive app doesnt benifit from multi threading
    ... almost twice as slow on 2 CPU machine when 1 CPU is used". ... When I run single thread version of the program on 2 CPU concurently, ... one will do 1st half the loop, the 2nd thread will do the other half. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: getting a threads state and CPU utilization
    ... of CPU time currently being used)? ... How could you tell an infinite loop from a polling loop ... responding to continuous messages from many client apps, ... though the customer *claims* that the client app is disconnecting (I suspect ...
    (microsoft.public.win32.programmer.kernel)