Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: speeding up floating point operations
Date: Mon, 11 May 2009 19:57:01 +0000 (UTC)
Organization: Boeing
Lines: 19
Message-ID: <gu9vud$nek$1@fred.mathworks.com>
References: <gu2c2m$mup$1@fred.mathworks.com> <gu2kj1$ea8$1@fred.mathworks.com> <gu7iul$cut$1@fred.mathworks.com> <gu9rhq$plj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1242071821 24020 172.30.248.35 (11 May 2009 19:57:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 11 May 2009 19:57:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:539079


"James Tursa" <aclassyguywithaknotac@hotmail.com> wrote in message <gu9rhq$plj$1@fred.mathworks.com>...
> "NIcholas " <remove.this_nmg33@cornell.edu> wrote in message <gu7iul$cut$1@fred.mathworks.com>...
> > "James Tursa" <aclassyguywithaknotac@hotmail.com> wrote in message <gu2kj1$ea8$1@fred.mathworks.com>...
> > > "NIcholas " <remove.this_nmg33@cornell.edu> wrote in message <gu2c2m$mup$1@fred.mathworks.com>...
> > > > Some C++ compilers have an option for performing floating point computations precisely vs. quickly (e.g. visual studio c++ compiler: http://msdn.microsoft.com/en-us/library/e7s85ffb(VS.80).aspx).  Is there a way to specify such an option in MATLAB to speedup general purpose floating point operations, such as Matrix Multiplication or element wise addition/multiplication etc.?
> > > 
> > > For matrix multiplication, in particular, MATLAB uses an optimized BLAS library in the background and is *very* fast. You will be very hard pressed to find anything faster.
> > > 
> > > James Tursa
> > 
> > In the version of MATLAB I have, r2008a, MATLAB uses INTEL MKL for matrix multiplication and it is really quick.  The computation I am doing doesn't require high precision and I was hoping it was possible to speed up the computation by doing lower precision computations, like some compilers allow (see above), within this library call.
> 
> As I understand it, the Intel MKL includes optimized BLAS routines for things such as matrix multiplication. So Intel has already gone to great lengths to make these operations as fast as possible. Are you saying you want something even faster than that?
> 
> James Tursa

P.S.  If you really don't care much about precision, consider using single precision. I just did a quick test of a simple A * B matrix multiply where A and B are both large double matrices. Converting both operands to single, calling SGEMM from the MATLAB supplied BLAS library, and then converting the result back to double does give you a significant time savings over the A * B operation at the MATLAB prompt. So the benefit of doing the multiply in single far outweighs the overhead of the conversions, at least for large matrices. The key is using an optimized BLAS library for the SGEMM call.

James Tursa