Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m45g2000hsb.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: Mon, 4 Aug 2008 07:43:56 -0700 (PDT)
Organization: http://groups.google.com
Lines: 64
Message-ID: <6ea3ee54-6457-4eb4-ab5c-171d40fe446b@m45g2000hsb.googlegroups.com>
References: <g717k3$kb3$1@news.dialog.net.pl> <g7740j$ii2$1@fred.mathworks.com>
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 1217861037 27034 127.0.0.1 (4 Aug 2008 14:43:57 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 4 Aug 2008 14:43:57 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m45g2000hsb.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:483519



On 4 Aug, 16:33, "Steven Lord" <sl...@mathworks.com> wrote:
> "uC" <bla....@uc.uc> wrote in message
>
> news:g717k3$kb3$1@news.dialog.net.pl...
>
>
>
>
>
> > Hi all,
>
> > Yesterday I have written tha post entitled "density matrix conversion -
> > vectorization" where I needed some help regarding vectorization to impr=
ove
> > 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 =A0for m=3D1:row_no
> > =A0 =A0 =A0 =A0 =A0 =A0for k=3D1:D(m, n)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[SOME SIMPLE ARITHMETIC OPERATIONS]
> > =A0 =A0 =A0 =A0 =A0 =A0end
> > =A0 =A0 =A0 =A0 =A0 =A0if rand() < D(m, n)-floor(D(m, n))
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 [SOME SIMPLE ARITHMETIC OPERATIONS]
> > =A0 =A0 =A0 =A0 =A0 =A0end
> > =A0 =A0 =A0 =A0end
> > =A0 =A0end
> > end
>
> > On 32 bit system (XP Pro) and Matlab (2006a) it takes ~17 seconds to
> > finish these operations but on 64 bit (Win 2003 Serv. End. Ed.) and 64 =
bit
> > Matlab (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
> > seconds 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 =
RAM
>
> > Does anyone have an idea if it is a Matlab bug or anything else?
>
> You need to post the rest of the code, including what col_no, row_no, D, =
and
> the two instances of "[SOME SIMPLE ARITHMETIC OPERATIONS]" are.

[technical considerations snipped]

I agree with your sentiments, but I interpret the OPs post
such that the same code runs in 17 seconds on the 32-bit
computer and in 370 seconds on the 64-bit computer.

If any of the arguments you mention were valid, they ought to
impact the performance on the 32 bit system as well, not only
on the 64-bit system.

Seems to me there is a bug in the 64-bit version.

Rune