Multi Core Processor Time Profile Experiments

Electronics Computer Programming Q&A
Post Reply
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Multi Core Processor Time Profile Experiments

Post by MrAl »

Hello there,


Recently i have been doing a few experiments with programs written specifically to run on
multi core processors. What i have found is interesting.

The most notable is the time profile for using more than one core for the same program
where the total program task is divided up into multiple sections where each section
runs on it's own core. I was mostly experimenting with using three cores to run a single
program.
What happens is for the programs that use the processor more than the hard drive they
speed up quite a bit, almost equal to 3 times as fast (3 is the number of cores used).
When the programs use hard disk more than the processor however, almost no speed
improvement is noticed. This is quite intuitive really, but it's not something you think
of right off unless you have been working with multi core processors for a while already.

For example, a program that accesses the disk 10 percent of the time and does calculations
90 percent of the time will benefit quite a bit, almost equal to the number of cores used.
A real life example would be somewhat complex picture file enhancements that have to
handle a bunch of files with one call.
A program that accesses the disk 90 percent of the time and does calculations only 10
percent of the time however will see almost no improvement whatsoever. A real life
example would be calculating the CRC codes for multiple somewhat small files.

It's quite amazing how different these two types of programs work with multiple cores.
It's a shame really that some programs just will not speed up by just going to multiple
cores.

I also discovered a way to tell if a program will speed up if it actually can be broken up
into several sections (one for each core) or not. Opening Task Manager and looking at
the CPU usage number while the program in question is running on one core, if the number
is close to 100 percent (on a single core system) then the program will definitely benefit
greatly from a multi core system provided it can be broken up of course. If the number is
very low, like 5 percent, then it will not benefit from a multi core architecture. If the
number is somewhere in between (like 50 percent) then it will speed up less than N times
(N is the number of cores) but still more than with just one core. This of course assumes
that no other program is running or at least no other program is taking much processor
time (1 percent or less), which is a common occurrence.

For example, a program that takes 60 minutes to run with one core that uses the processor
for 100 percent of the time will take 20 minutes to run with three cores (T/N where N is the
number of cores).
A program that takes 60 minutes to run with one core that uses the processor for 50 percent
of the time however will take 40 minutes to run because there is no way to speed up the
part of the time that does not use the processor.

In general, i think this equation works for any possibility of additional number of cores and
original processor percentage with one core:

Benefit=(OldRunTime*P*(N-1))/N

where

Benefit is the time that is subtracted from the single core total run time, and P is the original
single core processor percentage (1.00=100 percent) and N is the number of cores, and
OldRunTime is the total run time with one core.

Another way of stating this is to calculate the New Run Time:
NewRunTime=OldRunTime*(1+x/N-x)

where x, N, and OldRunTime are as above and:
NewRunTime is the new (shorter) run time.


The following plot shows the way the different cores and the original percentage of single
core processor usage affects the new run time. In the plot the new run time is expressed
in percentage of the old run time.
We can see that for single core usage of 1 percent there is barely any change in run time
(still near 100 percent of original run time) but for single core usage near 100 percent the
decrease is drastic for a few cores and then tapers off as the number of cores is increased.
The graph might be a little misleading however because 16 cores would give nearly 16 times
the speed if one core was being used 100 percent originally. Maybe a graph showing the
speedup multiplier would make a better illustration (see below).

Image


Yes, here is a new illustration of the speedup factor with the number of cores and with
the original single core usage percentage:

Image

Comparing the right side of the graph to the left side of the graph we can clearly see that the speedup
depends quite largely on how much time the program spends using the processor as well as the number
of cores.
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests