Which MATLAB functions are multicore aware?

November 22nd, 2009 | Categories: matlab, programming | Tags:

In order to write fully parallel programs in MATLAB you have a few choices but they are either hard work, expensive or both.  For example you could

Wouldn’t it be nice if you could do no work at all and yet STILL get a speedup on a multicore machine?  Well, you can….sometimes.

Slowly but surely, The Mathworks are parallelising some of the built in MATLAB functions to make use of modern multicore processors.  So, for certain functions you will see a speed increase in your code when you move to a dual or quad core machine.  But which functions?

On a recent train journey I trawled through all of the release notes in MATLAB and did my best to come up with a definitive list and the result is below.

Alongside each function is the version of MATLAB where it first became parallelised (if known). If there is any extra detail then I have included it in brackets (typically things like – ‘this function is only run in parallel for input arrays of more than 20,000 elements’). I am almost certainly missing some functions and details so if you know something that I don’t then please drop me a comment and I’ll add it to the list.

Of course when I came to write all of this up I did some googling and discovered that The Mathworks have already answered this question themselves!  Oh well….I’ll publish my list anyway.

Update 11th May 2012 While optimising a user’s application, I discovered that the pinv function makes use of multicore processors so I’ve added it to the list. pinv makes use of svd which is probably the bit that’s multithreaded.

Update 18th February 2012: Added a few functions that I had missed earlier: erfcinv, rank,isfinite,lu and schur. Not sure when they became multithreaded so left the version number blank for now

Update 16th June 2011: Added new functions that became multicore aware in version 2011a plus a couple that have been multicore for a while but I just didn’t know about them!

Update 8th March 2010: Added new functions that became multicore aware in version 2010a. Also added multicore aware functions from the image processing toolbox.

abs (for double arrays > 200k elements),2007a
acos (for double arrays > 20k elements),2007a
acosh (for double arrays > 20k elements),2007a
applylut,2009b (Image processing toolbox)
asin (for double arrays > 20k elements),2007a
asinh(for double arrays > 20k elements),2007a
atan (for double arrays > 20k elements),2007a
atand (for double arrays > 20k elements),2007a
atanh (for double arrays > 20k elements),2007a
backslash operator (A\b for double arrays > 40k elements),2007a
bsxfun,2009b
bwmorph,2010a (Image processing toolbox)
bwpack,2009b (Image processing toolbox)
bwunpack,2009b (Image processing toolbox)
ceil (for double arrays > 200k elements),2007a
conv,2011a
conv2,(two input form),2010a
cos (for double arrays > 20k elements),2007a
cosh (for double arrays > 20k elements),2007a
det (for double arrays > 40k elements),2007a
edge,2010a (Image processing toolbox)
eig
erf,2009b
erfc,2009b
erfcinv
erfcx,2009b
erfinv,2009b
exp (for double arrays > 20k elements),2007a
expm (for double arrays > 40k elements),2007a
fft,2009a
fft2,2009a
fftn,2009a
filter,2009b
fix (for double arrays > 200k elements),2007a
floor (for double arrays > 200k elements),2007a
gamma,2009b
gammaln,2009b
hess (for double arrays > 40k elements),2007a
hypot (for double arrays > 200k elements),2007a
ifft,2009a
ifft2,2009a
ifftn,2009a
imabsdiff,2010a (Image processing toolbox)
imadd,2010a (Image processing toolbox)
imclose,2010a (Image processing toolbox)
imdilate,2009b (Image processing toolbox)
imdivide,2010a (Image processing toolbox)
imerode,2009b (Image processing toolbox)
immultiply,2010a (Image processing toolbox)
imopen,2010a (Image processing toolbox)
imreconstruct,2009b (Image processing toolbox)
int16 (for double arrays > 200k elements),2007a
int32 (for double arrays > 200k elements),2007a
int8 (for double arrays > 200k elements),2007a
inv (for double arrays > 40k elements),2007a
iradon,2010a (Image processing toolbox)
isfinite
isinf (for double arrays > 200k elements),2007a
isnan (for double arrays > 200k elements),2007a
ldivide,2008a
linsolve (for double arrays > 40k elements),2007a
log,2008a
log2,2008a
logical (for double arrays > 200k elements),2007a
lscov (for double arrays > 40k elements),2007a
lu
Matrix Multiply (X*Y - for double arrays > 40k elements),2007a
Matrix Power (X^N - for double arrays > 40k elements),2007a
max (for double arrays > 40k elements),2009a
medfilt2,2010a (Image processing toolbox)
min (for double arrays > 40k elements),2009a
mldivide (for sparse matrix input),2009b
mod (for double arrays > 200k elements),2007a
pinv
pow2 (for double arrays > 20k elements),2007a
prod (for double arrays > 40k elements),2009a
qr (for sparse matrix input),2009b
qz,2011a
rank
rcond (for double arrays > 40k elements),2007a
rdivide,2008a
rem,2008a
round (for double arrays > 200k elements),2007a
schur
sin (for double arrays > 20k elements),2007a
sinh (for double arrays > 20k elements),2007a
sort (for long matrices),2009b
sqrt (for double arrays > 20k elements),2007a
sum (for double arrays > 40k elements),2009a
svd,
tan (for double arrays > 20k elements),2007a
tand (for double arrays > 200k elements),2007a
tanh (for double arrays > 20k elements),2007a
unwrap (for double arrays > 200k elements),2007a
various operators such as x.^y (for double arrays > 20k elements),2007a
Integer conversion and arithmetic,2010a
  1. Lee
    January 27th, 2011 at 18:54
    Reply | Quote | #1

    Hello,

    Any updates on functions from 2010b and the upcoming 2011a release?

  2. January 27th, 2011 at 19:14
    Reply | Quote | #2

    Hi Lee

    I’ve not combed through 2010b looking for additions yet.
    Won’t be able to talk about 2011a until the release.

    Cheers,
    Mike

  3. June 16th, 2011 at 16:30
    Reply | Quote | #3

    The functions I know about in 2011a have been added

Comments are closed.