Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: matlab and dual core processing

Subject: matlab and dual core processing

From: Martin

Date: 1 Nov, 2007 16:10:58

Message: 1 of 11

Hey guys,

I'm looking for a bit of advice. I have a simulation that
takes about 24 hrs to run on a 2.8GHz single core processor
with 1Gb of ram.

The simulations involve solving filters (length = 75) for
about 30000 times.

Now, I often have to do 18 simulations so I normally get 18
individually pcs and run one test on each machine.

The problem is, I can't really continue doing this (these
are college PCs and I only get access to them at the
weekend) and need to purchase some alternative.

I could purchase 18 desktop machines, or 3/4 servers
(dual/quad core)

My issue is, will the quad core/dual core be THAT much quicker?

for example if I had 3 super servers running twice as fast
as my 18 desktop machines, the test would take:

each machine has 6 simulations to do ---> 3 days

so it doesn't solve my problem.

Is my only solution to purchase 18 machines, or can anyone
suggest an alternative?

Thanks,
Martin

Subject: matlab and dual core processing

From: Peter Boettcher

Date: 1 Nov, 2007 17:16:16

Message: 2 of 11

"Martin " <jow@nomorepam.com> writes:

> Hey guys,
>
> I'm looking for a bit of advice. I have a simulation that
> takes about 24 hrs to run on a 2.8GHz single core processor
> with 1Gb of ram.
>
> The simulations involve solving filters (length = 75) for
> about 30000 times.

I think you should think about different ways to solve the problem. Do
you need to solve them all 30000 times? Can you be selective about
which ones you run?

What does solve mean? Compute a filter on a piece of data?

If you can outline your problem and the approach you are taking, maybe
you will get some advice on optimizing your simulation.

-Peter

Subject: matlab and dual core processing

From: Joachim

Date: 1 Nov, 2007 19:55:28

Message: 3 of 11

"Martin " <jow@nomorepam.com> wrote in message
<fgctqi$mrn$1@fred.mathworks.com>...
> Hey guys,
>
> I'm looking for a bit of advice. I have a simulation that
> takes about 24 hrs to run on a 2.8GHz single core processor
> with 1Gb of ram.
>
> The simulations involve solving filters (length = 75) for
> about 30000 times.
>
> Now, I often have to do 18 simulations so I normally get 18
> individually pcs and run one test on each machine.
>
> The problem is, I can't really continue doing this (these
> are college PCs and I only get access to them at the
> weekend) and need to purchase some alternative.
>
> I could purchase 18 desktop machines, or 3/4 servers
> (dual/quad core)
>
> My issue is, will the quad core/dual core be THAT much
quicker?
>
> for example if I had 3 super servers running twice as fast
> as my 18 desktop machines, the test would take:
>
> each machine has 6 simulations to do ---> 3 days
>
> so it doesn't solve my problem.
>
> Is my only solution to purchase 18 machines, or can anyone
> suggest an alternative?
>
> Thanks,
> Martin

Martin,

your problem is what is called "embarrassingly parallel."
Thus, this problem should scale very well when run in parallel.

In terms of software, Star-P or Matlab DCT will probably be
good choices for this. This might be expensive and require
some basic tech know-how to set-up...

But since the problem is embarrassingly parallel, at least
making necessary changes to your Matlab code would be
relatively painless using either software.


Subject: matlab and dual core processing

From: Joachim

Date: 1 Nov, 2007 20:10:34

Message: 4 of 11

Two more things:

1.) I second Peter's comment that you should try to further
optimize your code.

2.) Even if you will not consider buying some software that
facilitates parallel computing, you will still be better of
buying multi-core machines. They provide better bang for the
buck: in terms of price per unit of processing power and in
terms of energy consumption. After all, you could just run
multiple Matlab sessions on a multi-core/multi-processor
machine.

Subject: matlab and dual core processing

From: Martin

Date: 2 Nov, 2007 09:25:53

Message: 5 of 11

>I think you should think about different ways to solve the
>problem. Do
>you need to solve them all 30000 times? Can you be
selective >about
>which ones you run?
>What does solve mean? Compute a filter on a piece of data?

Yes, I need to compute a filter on a piece of data, and it's
unavoidable that I need to do this 30000 times. Each set of
filter coefficients has to be calculated independently.
I'm going to run the matlab profiler on my code to find
bottlenecks, but I still believe the code will take quite an
amount of time to run.

I've never heard of the term "embarrassingly parallel." ;-)
I'll have a look at both Star-P or Matlab DCT to see if they
can help the situation.

>Even if you will not consider buying some software that
>facilitates parallel computing, you will still be better of
>buying multi-core machines. They provide better bang for >the
>buck: in terms of price per unit of processing power and in
>terms of energy consumption. After all, you could just run
>multiple Matlab sessions on a multi-core/multi-processor
>machine.

I'm not sure if running multiple instances of Matlab on a
dual core system is more efficient. I've tried this, and two
simulations running in parallel on seperate instances of
matlab is often slower than two simulations in series on the
same machine.

Thanks for the help so far!

Subject: matlab and dual core processing

From: Ken Davis

Date: 2 Nov, 2007 13:45:27

Message: 6 of 11

"Martin " <jow@nomorepam.com> wrote in message
news:fgctqi$mrn$1@fred.mathworks.com...
> Hey guys,
>
> I'm looking for a bit of advice. I have a simulation that
> takes about 24 hrs to run on a 2.8GHz single core processor
> with 1Gb of ram.
>
> The simulations involve solving filters (length = 75) for
> about 30000 times.
>
> Now, I often have to do 18 simulations so I normally get 18
> individually pcs and run one test on each machine.
>
> The problem is, I can't really continue doing this (these
> are college PCs and I only get access to them at the
> weekend) and need to purchase some alternative.
>
> I could purchase 18 desktop machines, or 3/4 servers
> (dual/quad core)
>
> My issue is, will the quad core/dual core be THAT much quicker?
>
> for example if I had 3 super servers running twice as fast
> as my 18 desktop machines, the test would take:
>
> each machine has 6 simulations to do ---> 3 days
>
> so it doesn't solve my problem.
>
> Is my only solution to purchase 18 machines, or can anyone
> suggest an alternative?
>
> Thanks,
> Martin

I'm with Peter... what do you mean by "solve"? Do you mean that you want to
filter the data (i.e. apply a fir filter to the data). If so, I'm think it
quite likely that it can be done more quickly. How big is(are) the dat
set(s) that you want to filter? Please describe what you are doing. If your
data sets are too large then maybe more memory might make a difference.
Multiple cores may run quicker if you initiate several instances of MATLAB.
You may need/want to hand code a filter in c/c++. Tell us more.


Subject: matlab and dual core processing

From: Penny Anderson

Date: 2 Nov, 2007 20:02:25

Message: 7 of 11

"Joachim " <a@b.com> wrote in message
news:fgdavg$rdo$1@fred.mathworks.com...
> "Martin " <jow@nomorepam.com> wrote in message
> <fgctqi$mrn$1@fred.mathworks.com>...
>> Hey guys,
>>
>> I'm looking for a bit of advice. I have a simulation that
>> takes about 24 hrs to run on a 2.8GHz single core processor
>> with 1Gb of ram.
>>
>> The simulations involve solving filters (length = 75) for
>> about 30000 times.
>>
>> Now, I often have to do 18 simulations so I normally get 18
>> individually pcs and run one test on each machine.
>>
>> The problem is, I can't really continue doing this (these
>> are college PCs and I only get access to them at the
>> weekend) and need to purchase some alternative.
>>
>> I could purchase 18 desktop machines, or 3/4 servers
>> (dual/quad core)
>>
>> My issue is, will the quad core/dual core be THAT much
> quicker?
>>
>> for example if I had 3 super servers running twice as fast
>> as my 18 desktop machines, the test would take:
>>
>> each machine has 6 simulations to do ---> 3 days
>>
>> so it doesn't solve my problem.
>>
>> Is my only solution to purchase 18 machines, or can anyone
>> suggest an alternative?
>>
>> Thanks,
>> Martin
>
> Martin,
>
> your problem is what is called "embarrassingly parallel."
> Thus, this problem should scale very well when run in parallel.
>
> In terms of software, Star-P or Matlab DCT will probably be
> good choices for this. This might be expensive and require
> some basic tech know-how to set-up...
>
> But since the problem is embarrassingly parallel, at least
> making necessary changes to your Matlab code would be
> relatively painless using either software.

To follow on what Joachim suggested, I am running DCT (R2007b) on my dual
core laptop and just a silly little test loop shows a significant speedup
using the new parfor (parallel for-loop) construct:

>> tic, for i = 1 : 30000, filter(rand(1,10),rand(1,10),rand(1,500)); end,
>> toc
Elapsed time is 4.433696 seconds.

>> matlabpool(2)
<snip startup message>
>> tic, parfor(i = 1 : 30000), filter(rand(1,10),rand(1,10),rand(1,500));
>> end, toc
Elapsed time is 2.537413 seconds.


Penny Anderson
The MathWorks, Inc.


Subject: matlab and dual core processing

From: Markus Buehren

Date: 2 Nov, 2007 22:44:33

Message: 8 of 11

For this task, you don't need to buy the distributed
computing toolbox. Use the "multicore" package on the file
exchange!

Markus

Subject: matlab and dual core processing

From: Martin

Date: 5 Nov, 2007 15:16:43

Message: 9 of 11

"Markus Buehren" <mb_REMOVEmatlab@gmxTHIS.de> wrote in
message <fgg98h$hf1$1@fred.mathworks.com>...
> For this task, you don't need to buy the distributed
> computing toolbox. Use the "multicore" package on the file
> exchange!
>
> Markus
>

Thanks for the help guys.

I suppose I should explain the problem a bit better. I have
a channel that I have to equalize for using a filter 30000
times in my program. This can take between 10 to 24 hours to
run on a desktop machine.

I have to either buy 3 quad core servers or 10+ high spec
desktop machines by the end of the week for my project.

My suspicion is the dual core desktop machines operating
independently in parallel will finish the (18+) simulations
quicker than the same jobs queued up in series on the quad
core machines.

Would this be everyones view, or am I off the mark with my
assumptions?

Subject: matlab and dual core processing

From: Martin

Date: 5 Nov, 2007 15:20:42

Message: 10 of 11

"Markus Buehren" <mb_REMOVEmatlab@gmxTHIS.de> wrote in
message <fgg98h$hf1$1@fred.mathworks.com>...
> For this task, you don't need to buy the distributed
> computing toolbox. Use the "multicore" package on the file
> exchange!
>
> Markus
>

Thanks for the help guys.

I suppose I should explain the problem a bit better. I have
a channel that I have to equalize for using a filter 30000
times in my program. This can take between 10 to 24 hours to
run on a desktop machine.

I have to either buy 3 quad core servers or 10+ high spec
desktop machines by the end of the week for my project.

My suspicion is the dual core desktop machines operating
independently in parallel will finish the (18+) simulations
quicker than the same jobs queued up in series on the quad
core machines.

Would this be everyones view, or am I off the mark with my
assumptions?

Subject: matlab and dual core processing

From: Peter Boettcher

Date: 5 Nov, 2007 17:12:22

Message: 11 of 11

"Martin " <jow@nomorepam.com> writes:

> "Markus Buehren" <mb_REMOVEmatlab@gmxTHIS.de> wrote in
> message <fgg98h$hf1$1@fred.mathworks.com>...
>> For this task, you don't need to buy the distributed
>> computing toolbox. Use the "multicore" package on the file
>> exchange!
>>
>> Markus
>>
>
> Thanks for the help guys.
>
> I suppose I should explain the problem a bit better. I have
> a channel that I have to equalize for using a filter 30000
> times in my program. This can take between 10 to 24 hours to
> run on a desktop machine.
>
> I have to either buy 3 quad core servers or 10+ high spec
> desktop machines by the end of the week for my project.
>
> My suspicion is the dual core desktop machines operating
> independently in parallel will finish the (18+) simulations
> quicker than the same jobs queued up in series on the quad
> core machines.
>
> Would this be everyones view, or am I off the mark with my
> assumptions?

I think you are correct.

parallel vs. series is a strange way to describe the difference. Just
via cores: 10 dual core machines = 20 cores. 3 quad core machines = 12
cores.

Independent machines are almost always faster than multiple cores in one
box. Memory bandwidth is the big reason. If you have 2 processors in
one box, they have their own cache, but share access speed to main
memory. If you have a dual core processor, they sometimes share a cache
as well. Quad core is even worse.

Note we're not comparing 1 quad core to 1 single core. We're comparing
1 quad core to 2 dual cores.

I still think there must be some serious room for improvement in your
algorithm or software. If you're absolutely convinced that your algorithm
and your MATLAB code are fully optimized, then it's time to think about
porting to C or C++.

The number 30000 is not scary to us unless we know what is happening
30000 times. I don't suppose your code has a small inner loop that you
could just post so we all know what is going on. Maybe someone can
suggest a change that speeds up your code.

-Peter

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
parallelized computing Joachim 1 Nov, 2007 16:00:24
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics