FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math » num-analysis
execution times of MATLAB/LAPACK programs
Post new topic   Reply to topic Page 1 of 1 [11 Posts] View previous topic :: View next topic
Author Message
Jeremy Watts
science forum Guru Wannabe


Joined: 24 Mar 2005
Posts: 239

PostPosted: Tue Jun 14, 2005 7:19 am    Post subject: execution times of MATLAB/LAPACK programs Reply with quote

Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a 30
x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.


Thanks
Back to top
Jean-Claude Arbaut
science forum Guru


Joined: 13 Jun 2005
Posts: 573

PostPosted: Tue Jun 14, 2005 8:17 am    Post subject: Re : execution times of MATLAB/LAPACK programs Reply with quote

Quote:
Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a 30
x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.




It depends greatly on your machine, your Fortran and Java compiler, etc...
So there is no definitive answer. You can have a look at
http://hoschek.home.cern.ch/hoschek/colt/
According to that site, the COLT library is 2.5 times slower than optimized
Intel libraries.

Another interesting site: http://math.nist.gov/scimark2/
It's a benchmark for Java (and C, but mainly Java !), and you can
compare your machine with many others w.r.t Java performance.

From my personnal experience, Java can be faster than unoptimized C:
thanks to JIT, I had a program 60% faster than C, but it was 30% slower
than the same C program optimized with -O2. But I didn't use vector
instructions to speed up the C program... (on a PowerPC G4).
The COLT performance seems realistic, and I would say you won't have better.
You must note that LAPACK typically makes full use of all SIMD and cache
prefetching instructions available whereas Java can't access these
instructions.
This makes a huge gap.
Back to top
Guest






PostPosted: Tue Jun 14, 2005 9:08 am    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

Jeremy Watts wrote:
Quote:
Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a 30
x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.


Thanks

Well, as we're using different systems I'm not sure how much
information you can glean from this, but on a standard 2.0Ghz Pentium 4
PC, I get (Do you need more info about system? let me know what.):

With Matlab 6:

Quote:
matlabtiming
average time for 30x30 LU = 0.00018394 seconds based on 10000

factorisations.
average time for 20x20 eigenvalue/vector calc = 0.00090253 seconds
based on 10000 factorisations.

With Matlab 7:

Quote:
matlabtiming
average time for 30x30 LU = 0.00019886 seconds based on 10000

factorisations.
average time for 20x20 eigenvalue/vector calc = 0.0010659 seconds based
on 10000 factorisations.
Quote:


With Octave:

octave:1> matlabtiming
average time for 30x30 LU = 0.0006129 seconds based on 10000
factorisations.
average time for 20x20 eigenvalue/vector calc = 0.001344 seconds based
on 10000 factorisations.

using the following code, which others are welcome to comment on,
correct and try themselves. I'd note that: 1) This code generates the
eigenvectors too, 2) The biggest bonus is that coding the 2 maths parts
took <15 seconds each, with no debugging required, 3) The biggest
downside is cost for Matlab, though Octave is free.

What numbers do you get with Java, I'm interested to know, because I'm
about to loose access to Matlab, and am considering my options...

Cheers,
andy.

tic
n = 10000;
for i=1:n
A = rand(30);
[l,u] = lu(A);
b(i) = l(10,14); %This is so cannot optimise
%away call - I'm not sure if
%Matlab would do that or not.
end
timetaken=toc;
disp(['average time for 30x30 LU = ' ...
num2str(timetaken/n) ...
' seconds based on ' ...
int2str(n) ' factorisations.'])

tic
n = 10000;
for i=1:n
A = rand(20);
[e,f] = eig(A);
c(i) = e(10,14); %This is so cannot optimise
%away call - I'm not sure
%if Matlab would do that or not.
end
timetaken=toc;
disp(['average time for 20x20 eigenvalue/vector calc = ' ...
num2str(timetaken/n) ...
' seconds based on ' ...
int2str(n) ...
' factorisations.'])
Back to top
Guest






PostPosted: Tue Jun 14, 2005 9:42 am    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

andy2O@hotmail.com wrote:
Quote:

Well, as we're using different systems I'm not sure how much
information you can glean from this, but on a standard 2.0Ghz Pentium 4
PC, I get (Do you need more info about system? let me know what.):

With Matlab 6:


Jeremy,

I forgot - you can just get the eigenvalues (without the eigenvectors)
from the eig command. And making this change speeds things up somewhat,
so here are the *eigenvalue only* results, as you requested....

Also, to be clear, I'm performing these operations on matrices with
random elements, uniformly distributed on the interval [0,1]. These are
rather small test problems, and it would be unfair forget that LAPACK
will work efficiently on very much bigger systems (your code may also
scale up well of course... I'd be interested to hear.)

By the way, I think Octave is relying on a rather poorly optimised
BLAS/LAPACK library on my system, so I think these results give an
unfairly poor view of Octave's potential performance.

With Matlab 6:

Quote:
matlabtiming
average time for 30x30 LU = 0.00018409 seconds based on 10000

factorisations.
average time for 20x20 eigenvalue calc = 0.00058158 seconds based on
10000 factorisations.

With Matlab 7:

Quote:
matlabtiming
average time for 30x30 LU = 0.00020559 seconds based on 10000

factorisations.
average time for 20x20 eigenvalue/vector calc = 0.00071079 seconds
based on 10000 factorisations.
Quote:


With Octave:

octave:2> matlabtiming
average time for 30x30 LU = 0.0004633 seconds based on 10000
factorisations.
average time for 20x20 eigenvalue calc = 0.0009076 seconds based on
10000 factorisations.
octave:3>

the change to the code is the following replacement of the call to eig:

A = rand(20);
e = eig(A);
c(i) = e(10); %This is so cannot optimise
%away call - I'm not sure
%if Matlab would do that or not.

Sorry it took 2 posts to give the information as you requested it...

Cheers,
andy
Back to top
Jean-Claude Arbaut
science forum Guru


Joined: 13 Jun 2005
Posts: 573

PostPosted: Tue Jun 14, 2005 10:07 am    Post subject: Re : execution times of MATLAB/LAPACK programs Reply with quote

Le 14/06/2005 13:08, dans
1118747315.778076.51810@g47g2000cwa.googlegroups.com, « andy2O@hotmail.com »
<andy2O@hotmail.com> a écrit :

Quote:
What numbers do you get with Java, I'm interested to know, because I'm
about to loose access to Matlab, and am considering my options...

I would suggest C and/or Fortran (with ATLAS, GSL, ... whatever you like),
and Python/TclTk/SWIG for the GUI. You have also SciPy and NumPy, and you
Can use gnuplot or xmgrace for plots (or pgplot, g2, etc...).
Just a suggestion Smile
Back to top
Jeremy Watts
science forum Guru Wannabe


Joined: 24 Mar 2005
Posts: 239

PostPosted: Tue Jun 14, 2005 10:20 am    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

<andy2O@hotmail.com> wrote in message
news:1118749375.068869.196690@o13g2000cwo.googlegroups.com...
Quote:
andy2O@hotmail.com wrote:

Well, as we're using different systems I'm not sure how much
information you can glean from this, but on a standard 2.0Ghz Pentium 4
PC, I get (Do you need more info about system? let me know what.):

With Matlab 6:


Jeremy,

I forgot - you can just get the eigenvalues (without the eigenvectors)
from the eig command. And making this change speeds things up somewhat,
so here are the *eigenvalue only* results, as you requested....

Also, to be clear, I'm performing these operations on matrices with
random elements, uniformly distributed on the interval [0,1]. These are
rather small test problems, and it would be unfair forget that LAPACK
will work efficiently on very much bigger systems (your code may also
scale up well of course... I'd be interested to hear.)

By the way, I think Octave is relying on a rather poorly optimised
BLAS/LAPACK library on my system, so I think these results give an
unfairly poor view of Octave's potential performance.

With Matlab 6:

matlabtiming
average time for 30x30 LU = 0.00018409 seconds based on 10000
factorisations.
average time for 20x20 eigenvalue calc = 0.00058158 seconds based on
10000 factorisations.

With Matlab 7:

matlabtiming
average time for 30x30 LU = 0.00020559 seconds based on 10000
factorisations.
average time for 20x20 eigenvalue/vector calc = 0.00071079 seconds
based on 10000 factorisations.


With Octave:

octave:2> matlabtiming
average time for 30x30 LU = 0.0004633 seconds based on 10000
factorisations.
average time for 20x20 eigenvalue calc = 0.0009076 seconds based on
10000 factorisations.
octave:3

the change to the code is the following replacement of the call to eig:

A = rand(20);
e = eig(A);
c(i) = e(10); %This is so cannot optimise
%away call - I'm not sure
%if Matlab would do that or not.

Sorry it took 2 posts to give the information as you requested it...

Andy,

Thanks for the reply, most informative. Looking at your results I'd say
Octave whips Java, although I am fairly unsurprised by this.

My results for a 30 x 30 LU decomp. using Java is 1219ms, which is just over
1.2s, so quite a difference there. The method I am using is Doolittles by
the way - dont know how MATLAB does it though.

For the eigenvalues, its giving nearly 2seconds, again quite a difference.

I guess a lot of it is that Java isnt a fully compiled language, unlike
fortran, but it compiles to Java byte code.

Anway, thanks

PS the other thing is that I am using 'arbitrary length' arithmetic , which
technically I dont need to use, switching to standard arithmetic would save
a lot of time I'd say



Quote:

Cheers,
andy
Back to top
Guest






PostPosted: Tue Jun 14, 2005 11:20 am    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

Jeremy Watts wrote:

Quote:
Andy,

Thanks for the reply, most informative. Looking at your results I'd say
Octave whips Java, although I am fairly unsurprised by this.


Jeremy,

I'm glad my reply helped.

Quote:
My results for a 30 x 30 LU decomp. using Java is 1219ms, which is just over
1.2s, so quite a difference there. The method I am using is Doolittles by
the way - dont know how MATLAB does it though.

For the eigenvalues, its giving nearly 2seconds, again quite a difference.

I guess a lot of it is that Java isnt a fully compiled language, unlike
fortran, but it compiles to Java byte code.


Although I'd expect the fact that Java isn't fully compiled to make
some difference, I think modern JIT Java compilers, and gcc's Java
implementation can perform really quite fast. I think the main
difference is infact due to the issue you describe in your PS:

Quote:
PS the other thing is that I am using 'arbitrary length' arithmetic , which
technically I dont need to use, switching to standard arithmetic would save
a lot of time I'd say

I'm not a Java expert, but I think that arbitrary length arithmetic
implemented using software libraries and not the CPU's floating point
hardware instructions is **really** going to cost you a lot of time...
of course, whether of not you worry about run-time efficiency depends
on your application.

Of course, being able to solve an eigenvalue problem to arbitrary
precision is impressive in itself, v. useful if that is what you need,
and is a completely different capability to LAPACK or Matlab's
functionality.

But if all you need is double precision floating point precision, then
switching to hardware floating point will probably make a huge
difference to your runtimes....

Best wishes,
andy

PS: You know there is an initial release of a Java version of LAPACK
around?... and also the JAMA library, which has input from the Matlab
company The Mathworks.... See:

http://math.nist.gov/javanumerics/jama/

(Disclaimer: Seek advice from a Java wizard before you rip apart a code
in favour of usual floating point maths though, in case I'm wrong!! I
don't want to waste your time:-) )
Back to top
Jeremy Watts
science forum Guru Wannabe


Joined: 24 Mar 2005
Posts: 239

PostPosted: Tue Jun 14, 2005 11:28 am    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

<andy2O@hotmail.com> wrote in message
news:1118755256.816260.59240@z14g2000cwz.googlegroups.com...
Quote:
Jeremy Watts wrote:

Andy,

Thanks for the reply, most informative. Looking at your results I'd say
Octave whips Java, although I am fairly unsurprised by this.


Jeremy,

I'm glad my reply helped.

My results for a 30 x 30 LU decomp. using Java is 1219ms, which is just
over
1.2s, so quite a difference there. The method I am using is Doolittles
by
the way - dont know how MATLAB does it though.

For the eigenvalues, its giving nearly 2seconds, again quite a
difference.

I guess a lot of it is that Java isnt a fully compiled language, unlike
fortran, but it compiles to Java byte code.


Although I'd expect the fact that Java isn't fully compiled to make
some difference, I think modern JIT Java compilers, and gcc's Java
implementation can perform really quite fast. I think the main
difference is infact due to the issue you describe in your PS:

PS the other thing is that I am using 'arbitrary length' arithmetic ,
which
technically I dont need to use, switching to standard arithmetic would
save
a lot of time I'd say

I'm not a Java expert, but I think that arbitrary length arithmetic
implemented using software libraries and not the CPU's floating point
hardware instructions is **really** going to cost you a lot of time...
of course, whether of not you worry about run-time efficiency depends
on your application.

Of course, being able to solve an eigenvalue problem to arbitrary
precision is impressive in itself, v. useful if that is what you need,
and is a completely different capability to LAPACK or Matlab's
functionality.

But if all you need is double precision floating point precision, then
switching to hardware floating point will probably make a huge
difference to your runtimes....

Best wishes,
andy

PS: You know there is an initial release of a Java version of LAPACK
around?... and also the JAMA library, which has input from the Matlab
company The Mathworks.... See:

http://math.nist.gov/javanumerics/jama/

(Disclaimer: Seek advice from a Java wizard before you rip apart a code
in favour of usual floating point maths though, in case I'm wrong!! I
don't want to waste your time:-) )

Andy,

Yeah I'd guess the arbitrary length arithmetic would slow things down
considerably, but it does have the advantage of pin point accuracy if thats
whats needed. Also, converting to ordinary arithmetic would be quite
easy - simply substituting the arbitrary length arithmetic commands to
ordinary +,-,*,/ etc.

The programs I wrote myself, so I know how they all work.


Jeremy
>
Back to top
Bill Shortall
science forum beginner


Joined: 14 Jun 2005
Posts: 11

PostPosted: Tue Jun 14, 2005 1:35 pm    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

"Jeremy Watts" <jwatts1970@hotmail.com> wrote in message
news:wixre.20458$%21.10246@newsfe2-gui.ntli.net...
Quote:
Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a
30
x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.


Thanks

Hi,

I am using a linear algebra library of my own design that is written
entirely in
C++ and does not use LAPACK and BLAS. The results for a AMD 64 bit PC
with a 3.2 gig clock are

single precision floating point

30 x 30 LU decomposition 0.14 milliseconds
20 x 20 symmetric eigenvalues and eigenvectors 1.5 milliseconds
Quote:

Bill Shortall
Back to top
Jeremy Watts
science forum Guru Wannabe


Joined: 24 Mar 2005
Posts: 239

PostPosted: Tue Jun 14, 2005 2:14 pm    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

"Bill Shortall" <pecos@cminet.net> wrote in message
news:d8mtgs01e4l@enews2.newsguy.com...
Quote:

"Jeremy Watts" <jwatts1970@hotmail.com> wrote in message
news:wixre.20458$%21.10246@newsfe2-gui.ntli.net...
Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in
their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a
30
x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.


Thanks

Hi,

I am using a linear algebra library of my own design that is written
entirely in
C++ and does not use LAPACK and BLAS. The results for a AMD 64 bit PC
with a 3.2 gig clock are

single precision floating point

30 x 30 LU decomposition 0.14 milliseconds
20 x 20 symmetric eigenvalues and eigenvectors 1.5 milliseconds

Bill Shortall

thats pretty impressive Bill, I did consider C++ myself, and in fact may do
C++ versions of what I have written. Are you using arbitrary length
arithmetic in your routines? In fact that reason I chose Java is because
it has a built in large number facility in the form of 'BigDecimal'.

From the benchmarks I've seen, C++, Fortran, and Delphi seem to be sort of
top 5 in terms of speed, Java coming down the list at sort of 6th or 7th,
then other interpreted languages like PHP furthther down.

Jeremy
Quote:

Back to top
Harmonic Software
science forum beginner


Joined: 15 Jun 2005
Posts: 38

PostPosted: Wed Jun 15, 2005 1:15 pm    Post subject: Re: execution times of MATLAB/LAPACK programs Reply with quote

There are several Matlab LAPACK, (and other) benchmark results available at:
http://www.omatrix.com/bench.html

Beau Paisley
www.omatrix.com

"Jeremy Watts" <jwatts1970@hotmail.com> wrote in message
news:wixre.20458$%21.10246@newsfe2-gui.ntli.net...
Quote:
Hi ,

I have never used the MATLAB/LAPACK routines, but I am interested in their
execution times on an ordinary home computer.

Does anyone have any execution times to run say an LU decomposition on a
30 x 30 real matrix, or the time to find the eigenvalues of a 20 x 20 real
matrix?

I am just interested to compare the times with that of my own programs
written in Java.


Thanks
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [11 Posts] View previous topic :: View next topic
The time now is Fri Jul 30, 2010 5:39 am | All times are GMT
Forum index » Science and Technology » Math » num-analysis
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts The three times table The Last Danish Pastry Math 3 Fri Jul 14, 2006 9:01 am
No new posts Compating double with Interval Proble... immernurzweiter@hotmail.c num-analysis 1 Wed Jul 12, 2006 9:21 pm
No new posts Zahl mit Intervall vergleichen ( Matlab) immernurzweiter@hotmail.c num-analysis 0 Wed Jul 12, 2006 9:04 pm
No new posts precedence of negation and times zxcv_890@hotmail.com Math 8 Wed Jul 12, 2006 6:08 pm
No new posts Matlab: how to obtain reflectors from QR alfredo.buttari@gmail.com num-analysis 2 Wed Jul 05, 2006 7:25 pm

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3753s ][ Queries: 14 (0.3241s) ][ GZIP on - Debug on ]