bugGNU Octave - Bugs: bug #32967, Slow norm in Octave 3.4.0 (Mac?)

 
 

bug #32967: Slow norm in Octave 3.4.0 (Mac?)

Submitter:  None
Submitted:  Thu 31 Mar 2011 03:48:47 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Works For Me Assigned to:  None
Originator Name:  Vic Norton Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.4.0
Operating System:  * Mac OS Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 05 Apr 2011 01:52:02 PM UTC, comment #2: 

This problem proved to be a problem with the compilation of Octave 3.4.0 for Mac. Julien Salort has been able optimize his compilation so that the new Octave 3.4.0 for Mac runs as fast as Thomas Treichl's Octave 3.2.3 compilation.

Vic Norton <vicnorton>
Thu 31 Mar 2011 10:06:44 PM UTC, comment #1: 

I can't reproduce this on a Linux machine running 3.2.3 and 3.4.0.  For both versions the timing is within 5% of the other and the difference between norm and sqrt_sum approaches is about 20%.

The magnitude of the changes you are seeing is more likely due to differences in compilation options (-O1, -O2, or -O3) and potentially which BLAS is being linked in.  I think you need to take this issue to the packagers of Octave on Mac or build it yourself from source.  The file README.MacOS has been completely rewritten for 3.4 and it seems that more people are having success now even from source.

Rik <rik5>
Group administrator
Thu 31 Mar 2011 03:48:47 PM UTC, original submission:  

I have compared the speed of the instructions "norm(x)" and
"sqrt(sum(x .* x))" on Thomas Treichl's Octave.app (3.2.3) and Julien
Salort's Octave.app (3.4.0). These versions of octave can be found at
http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/
2011-03-27 binary of Octave 3.4.0 (2011-03-27)
2009-10-03 binary of Octave 3.2.3 (2010-11-23)

Here is a summary of the results I observed.
1. Octave 3.4.0 is a bit slower than Octave 3.2.3 on sqrt(sum(x .* x)).
2. On Octave 3.2.3, norm(x) is a bit faster than sqrt(sum(x .* x)). This
   is as it should be since NRM2 is a BLAS.
3. On Octave 3.4.0, sqrt(sum(x .* x)) is four times as fast as norm(x).
   This is not as it should be for the reason cited in 2.
4. norm(x) on Octave 3.2.3 is nine times as fast as norm(x) on Octave
   3.4.0.

My test script and my results appear below.

The test script. The two different shebang lines placed at the top of
the file test the two different versions of octave.
   #!/usr/local/bin/octave323
  
   # norm2test.m
  
   #!/usr/local/bin/octave323
   #!/usr/local/bin/octave340
  
   ntests = 20; n = 1e6; x = rand(n, 1);
   test1 = zeros(ntests, 1); test2 = zeros(ntests, 1);
  
   for i = 1 : ntests
     tic;
     norm(x);
     test1(i) = toc;
   endfor
   for i = 1 : ntests
     tic;
     sqrt(sum(x .* x));
     test2(i) = toc;
   endfor
  
   printf ("norm2 speed test - octave %s\n", version);
   printf ("%40s\n","ellapsed times");
   printf ("%30s%10s\n", "mean", "stdv");
   printf ("%-20s", "norm(x)");
   printf ("%10.2e", mean(test1));
   printf ("%10.2e", std(test1));
   printf ("\n");
   printf ("%-20s", "sqrt(sum(x .* x))");
   printf ("%10.2e", mean(test2));
   printf ("%10.2e", std(test2));
   printf ("\n");

The output.
---
norm2 speed test - octave 3.2.3
                        ellapsed times
                        mean      stdv
norm(x)               7.06e-03  2.62e-05
sqrt(sum(x .* x))     1.06e-02  1.98e-03
---
norm2 speed test - octave 3.4.0
                        ellapsed times
                        mean      stdv
norm(x)               6.48e-02  3.78e-04
sqrt(sum(x .* x))     1.46e-02  1.21e-04

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vicnorton (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-05 rik5 Open/ClosedOpen Closed
    2011-03-31 rik5 StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code