Dear Matthew,

Many thanks for your very detailed reply.  Given your recommendations, I think I will go for the MKL option rather than ATLAS.

A few quick notes on my journeys through Google:

1) Matlab R14 uses ATLAS by default.  The Windows version ships with MKL version 6.1 which can be manually enabled (threading is disabled but can be enabled)  See this page.

2) Matlab R14SP1 uses MKL 7.0 on Intel chips and AMD Core Math Library on AMD chips.  Threading on MKL is disabled by default but can be re-enabled.

3) It is possible to download a free non-commercial version of MKL 7.2 (the newest version) directly from Intel.  The graphs on Intel's site show the MKL performing faster than ATLAS (but you'd expect that, right?).  It looks fairly straight forward to install and enable the latest version MKL for Matlab. (there's even talk of a cluster-enabled version of MKL... is this an easy way to teach MatLab to use a cluster?)

I'll update the wiki page.

http://en.wikibooks.org/wiki/SPM-Faster_SPM#SPM_optimizations

Thanks again,
Jack



Matthew Brett wrote:
[log in to unmask]" type="cite">
Hi,

  
Many thanks for your very swift reply.  Do we know how the Intel Math
Kernel Library performs in comparison to an optimised install of ATLAS
on a hyperthreaded P4?  Does the IMKL make use of SSE2 and multiple
threads (I assume it does, being Intel and all)?
    

Sorry, I shouldn't answer this question as I have no access to matlab
R14, but my experience of the MKL is that it is very similar to the
ATLAS libraries in terms of performance, and is more stable.  It makes
full use of SSE2, so does not suffer from the NaN problem which is the
real killer on the Pentium4.  I'm afraid I don't know anything about
its use of threads.

  
Sorry - one more question: I notice that MatLab R14 comes with a module
called atlas_P4.so - does that make use of SSE2?
    

I don't know (ATLAS always makes use of SSE2 in the calculations, but
the default libraries don't use SSE2 for the housekeeping routines,
and therefore hit the NaN problem).  You could check it by:

export BLAS_VERSION=atlas_P4
matlab
  
a = ones(1000);
b = a;
c = a + NaN;
tic; a*b; toc
tic; a*c; toc
      

If all is well the two times should be more or less the same.

Lastly, you might try the following version of the library creation
script from my page, to see if it does a better job than your previous
install (with appropriate edits to paths etc):

#!/bin/sh
# Script to make matlab ATLAS library for gcc

# matlab, atlas paths; change these as necessary
MATLAB=/usr/local/matlab6p5
ATLAS=/root/installs/atlas/atlas-3.7.8
ARCH=PMSSE2_sse_gcc

ATLAS_LIB=$ATLAS/lib/Linux_$ARCH
GCC_LIB=/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/

LIB_NAME=$MATLAB/bin/glnx86/atlas_$ARCH.so

ld -shared -o $LIB_NAME --whole-archive \
$ATLAS_LIB/libatlas.a \
$ATLAS_LIB/libcblas.a \
$ATLAS_LIB/liblapack.a \
$ATLAS_LIB/libf77blas.a \
--no-whole-archive -L $GCC_LIB \
-lg2c -lm -lpthread

Best,

Matthew