Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!x41g2000hsb.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: FOR loops performance - 32bit vs 64 bit Matlab
Date: Sat, 2 Aug 2008 03:12:26 -0700 (PDT)
Organization: http://groups.google.com
Lines: 46
Message-ID: <cda98d30-89e8-4ac6-8139-365701844e8f@x41g2000hsb.googlegroups.com>
References: <g717k3$kb3$1@news.dialog.net.pl>
NNTP-Posting-Host: 212.17.141.54
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1217671947 23346 127.0.0.1 (2 Aug 2008 10:12:27 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 2 Aug 2008 10:12:27 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: x41g2000hsb.googlegroups.com; posting-host=212.17.141.54; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
Xref: news.mathworks.com comp.soft-sys.matlab:483267



On 2 Aug, 10:58, "uC" <bla....@uc.uc> wrote:
> Hi all,
>
> Yesterday I have written tha post entitled "density matrix conversion -
> vectorization" where I needed some help regarding vectorization to improv=
e
> the speed. It turned out that in fact I don't need to vectorize it and
> performance problem is somewhere else.
>
> There are three loops:
>
> for n=3D1:col_no
> =A0 =A0 =A0 =A0 for m=3D1:row_no
> =A0 =A0 =A0 =A0 =A0 =A0 for k=3D1:D(m, n)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 [SOME SIMPLE ARITHMETIC OPERATIONS]
> =A0 =A0 =A0 =A0 =A0 =A0 end
> =A0 =A0 =A0 =A0 =A0 =A0 if rand() < D(m, n)-floor(D(m, n))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[SOME SIMPLE ARITHMETIC OPERATIONS]
> =A0 =A0 =A0 =A0 =A0 =A0 end
> =A0 =A0 =A0 =A0 end
> =A0 =A0 end
> end
>
> On 32 bit system (XP Pro) and Matlab (2006a) it takes ~17 seconds to fini=
sh
> these operations but on 64 bit (Win 2003 Serv. End. Ed.) and 64 bit Matla=
b
> (2007b) it takes 370 secons!!!
>
> Now the most interesting... when I substitute exact numbers for "col_no" =
and
> "row_no" (6700 and 7100 in tested case) 64 bit Matlab needs only 8 second=
s
> to finish, when on 32 bit one timings remains almost untouched!
>
> 32 bit machine is dual core Athlon64x2 2GHz with 2 GB RAM
> 64 bit machine is dual socket dual core Opteron 2218 2.6 GHz with 8 GB RA=
M
>
> Does anyone have an idea if it is a Matlab bug or anything else?

Yes, it is a bug. There is no reason why there should be an
overhead on the order of 50x or 6 minutes just to handle a
few million loops.

Rune