Re: very slow vectorized code
- From: "Yi Cao" <y.cao@xxxxxxxxxxxxxxx>
- Date: Fri, 25 Apr 2008 19:18:01 +0000 (UTC)
"Julian Reichl" <julesreichl@xxxxxxxxxxx> wrote in message
<fupbim$hs6$1@xxxxxxxxxxxxxxxxxx>...
I just tried commenting out all the other code within theloop
i=1:28305The
...
end
and it bought that e(:,:)=0;
statement back to 0.04s. So could this mean that there is
some memory issue?
"Julian Reichl" <julesreichl@xxxxxxxxxxx> wrote in message
<fupais$8av$1@xxxxxxxxxxxxxxxxxx>...
Hi all,
I have a problem that I can't figure out. I have two
versions of some code, one vectorised, the other not.
~17vectorised version runs WAY slower for single repeats -
simpleseconds cf. 0.3 seconds.
The profiler tells me that pretty much every line of the
code is a lot slower in the vectorised version. Even
removed)things like
e=repmat(1,1);
for i=1:28305
e(:,:)=0;
end
(the 1:28305 is a time-stepping loop and can't be
thetakes 0.39 s inside the vectorised code (not including
arepmat), whereas in the command line it takes less than
replace it10th of that time.
if, in the same code (the vectorised version), I
notwith
for i=1:28305
e=0;
end
(which is fine for this example because it's a 1x1, but
for my application), the time for that function drops,
again, to ~ a 10th.
I really hope someone has an idea!!!
thanks
Julian
I guess this is because JIT accelerator, i.e. your
vectorized code is quite complicated, hence the JIT
accelerator is not able to accelerate it, while your simple
loop version is in favour for the JIT to accelerate. When
you remove all other lines in the loop, the vectorized
version becomes simple as well, hence the JIT can
accelerate it now. That is why you see speed improvement.
To demonstrate this, you can try run your code with JIT on
and off by using the command:
feature accel on
or
feature accel off
to see if this is the case.
hth
Yi Cao
.
- Follow-Ups:
- Re: very slow vectorized code
- From: Julian Reichl
- Re: very slow vectorized code
- References:
- very slow vectorized code
- From: Julian Reichl
- Re: very slow vectorized code
- From: Julian Reichl
- very slow vectorized code
- Prev by Date: Re: Vectorizing help
- Next by Date: Re: Loadlibrary fails on x64, wants lcc
- Previous by thread: Re: very slow vectorized code
- Next by thread: Re: very slow vectorized code
- Index(es):
Relevant Pages
|