> I'm using a Mac with 2, 3 GHz quad-core intel xeon processors, running Mac
> OS-X. When I run the following short code:
[quoted text clipped - 21 lines]
> similar, the parfor loop runs 1-2 secs longer (I assume because of the time it
> takes to distribute the for loop).
Strange, I see similar behaviour on one of our Macs, but not on a 64-bit Linux
machine. The problem that you're executing there looks like it's very
memory-bandwidth intensive (you're allocating, filling, and then de-allocating
about 16 GB in that loop), so perhaps you are completely memory-bound. PARFOR
works best on problems that are CPU-bound, like:
>> tic, for ii=1:100, x(ii) = max( eig( abs( rand( 400 ) ) ) ); end, toc
Elapsed time is 38.286138 seconds.
>> tic, parfor ii=1:100, x(ii) = max( eig( abs( rand( 400 ) ) ) ); end, toc
Elapsed time is 9.935093 seconds.
> My first question is how can I make parfor function much faster (as it should)
> than a regular 4.
[quoted text clipped - 7 lines]
>
> is there a way to get matlab to use the full power of this computer?
Currently, the local scheduler is limited to 4 MATLAB workers. To use 8 workers
would require a MATLAB Distributed Computing Server licence:
http://www.mathworks.com/products/distriben/
Cheers,
Edric.
Michael - 29 Jul 2008 16:03 GMT
Edric M Ellis <eellis@mathworks.com> wrote in message
<ytwzlo15b1v.fsf@uk-eellis-deb4-64.mathworks.co.uk>...
> > I'm using a Mac with 2, 3 GHz quad-core intel xeon processors, running Mac
> > OS-X. When I run the following short code:
[quoted text clipped - 53 lines]
>
> Edric.
Edric,
Thanks for the tip on the Distributed Compouting Server.
For my initial problem, what you said makes since, except on
my duel core PC the code I'm running runs faster using
parfor, just not on the Mac. This makes me think something
might be wrong with the configuration on the mac. As an
example, on my PC if i did
parfor i=1:100
fid = fopen(['test_' int2str(i) '.bin'], 'w');
fwrite(fid, rand(i));
fclose(fid);
end
with 4 workers, files would appear in the directory 4 at a
time (because the parfor is being split up 4 ways), however
if I run this same code on the mac, with 4 workers, files
show up 1 at a time, at the same speed as a for loop.
-mike
Titus - 29 Jul 2008 16:31 GMT
> Edric M Ellis <eellis@mathworks.com> wrote in message
> <ytwzlo15b1v.fsf@uk-eellis-deb4-64.mathworks.co.uk>...
[quoted text clipped - 93 lines]
>
> -mike
Hi Mike,
does your call to matlabpool indeed starts the MATLAB workers? I.e., looking
for the running processes, do you indeed see 4 additional MATLABs being
started with matlabpool?
Titus
Edric M Ellis - 30 Jul 2008 08:50 GMT
> [...] This makes me think something might be wrong with the configuration on
> the mac. As an example, on my PC if i did
[quoted text clipped - 9 lines]
> if I run this same code on the mac, with 4 workers, files
> show up 1 at a time, at the same speed as a for loop.
Unfortunately in R2008a there isn't really a nice way of checking the health of
the matlabpool. Here's a few slightly unpleasant things that might shed some
light:
pctRunOnAll system_dependent( 'getpid' )
and
!ps -c | grep MATLAB
They should show several different PIDs, which you should be able to check with
what's actually running on your system.
If the "pctRunOnAll" looks OK (i.e. returns several different PIDs, and matches
the "ps" thing), then you could also try:
parfor ii=1:100
x(ii) = system_dependent( 'getpid' );
end
unique( x )
(There will be less hacky ways of doing this stuff in the next release of
MATLAB/PCT).
If that doesn't look right - i.e. there's only one PID (probably the PID of the
client MATLAB), then there is a problem. Your best bet may be to contact The
MathWorks support to help you from there.
Cheers,
Edric.
Steve Amphlett - 30 Jul 2008 09:47 GMT
Edric M Ellis <eellis@mathworks.com> wrote in message
<ytwr69b6ca8.fsf@uk-eellis-deb4-64.mathworks.co.uk>...
> > [...] This makes me think something might be wrong with the configuration on
> > the mac. As an example, on my PC if i did
[quoted text clipped - 37 lines]
> client MATLAB), then there is a problem. Your best bet may be to contact The
> MathWorks support to help you from there.
Edric,
Your comment about 4 workers being allowed without a
distributed liicence interests me. I could not find any
concrete description of this (probably version-dependent).
Can you point me?
- Steve
Titus - 30 Jul 2008 12:47 GMT
> Edric M Ellis <eellis@mathworks.com> wrote in message
> <ytwr69b6ca8.fsf@uk-eellis-deb4-64.mathworks.co.uk>...
[quoted text clipped - 61 lines]
>
> - Steve
Hi Steve,
the Parallel Computing Toolbox allows for up to 4 local workers running on
the same machine, see
http://www.mathworks.com/products/parallel-computing/description1.html
and there the image at the bottom with the italics text to the right.
Titus
Steve Amphlett - 30 Jul 2008 13:44 GMT
"Titus" <titus.edelhofer@mathworks.de> wrote in message
<g6pkce$56d$1@fred.mathworks.com>...
> > Edric M Ellis <eellis@mathworks.com> wrote in message
> > <ytwr69b6ca8.fsf@uk-eellis-deb4-64.mathworks.co.uk>...
[quoted text clipped - 68 lines]
> http://www.mathworks.com/products/parallel-computing/description1.html
> and there the image at the bottom with the italics text to the right.
I see. I didn't realise you needed to pay for the parallel
computing toolbox and then more for the distributed
computing thing. I kind of assumed they were one and the
same.