bugGNU Octave - Bugs: bug #49485, Octave requires painfully long...

 
 

bug #49485: Octave requires painfully long time to saveas() certain complicated figures

Submitter:  None
Submitted:  Sun 30 Oct 2016 11:23:05 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Tharindu Mathew Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 15 Feb 2019 05:02:15 PM UTC, comment #13: 

Marking as fixed and closing report.

The important point is that the default pathway is now fast.  If users want to, they can use the path through Ghostscript, but then it is their own choice to exchange speed for something else (better accuracy?).

Rik <rik5>
Group administrator
Fri 15 Feb 2019 10:09:45 AM UTC, comment #12: 

Printing to PNG is now done using the -opengl renderer by default, and is very fast. Should we close this report or do we want to keep it open as the -painters renderer (that includes Ghostscript post processing for PNG output) is still very slow when it comes to handling many triangles.

Pantxo Diribarne <pantxo>
Group Member
Wed 22 Mar 2017 10:13:10 PM UTC, comment #11: 

I run "dump_plot_demos" with a recent snapshot
(HG ID for this build is "4adb9517d56a")
and it is noticeably slower in plotting and printing with GL
backend (I tried fltk) than 4.2.1. E.g.

4.2.1:
Printing "isosurface_01.png" ... [0.159536 1.049953] done
...
Printing "light_04.png" ... [1.107391 45.229747] done

4.3.0+:

Printing "isosurface_01.png" ... [0.191811 1.172609] done
...
Printing "light_04.png" ... [1.320802 52.687926] done

So it looks like there is ~20% slowdown due to octave's code...

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Sun 19 Mar 2017 03:42:07 PM UTC, comment #10: 

I ran Octave under the debugger and the line consuming all of the time was libinterp/corefcn/gl2ps-print.cc:299


octave::opengl_renderer::draw (go);
-verbatim

This is where the gl2ps print routine asks the Octave gl-renderer to draw the object, but in the OpenGl context provide by gl2ps.

This could be an issue with gl2ps, or it could be that the rendering code for lots and lots of patches is slow in Octave.

Along the way I found that we were copying from a temporary file to a pipe using a very small 256B.  This didn't seem to cause any problem, but just in case I changed the size to 8kB to match common sizes for a Linux kernel.  See http://hg.savannah.gnu.org/hgweb/octave/rev/34c75889ed50.

I have simpler test code now which just uses sphere to generate a surface.  The time to print is related not only to the number of objects, but also to the complexity of the scene.  If I rotate the sphere to different angles the time it takse to print differs.  I suspect this is because OpenGL is having to do a lot of work to figure out which objects are hidden given the perspective of the viewer.

Test code:

+verbatim+
k = 71;
sphere (k);
view (2);
tic;
saveas (gcf, "view2.png");
bm2 = toc
view (3);
tic;
saveas (gcf, "view3.png");
bm3 = toc


which results in


bm2 =  1.4283
bm3 =  10.864




Rik <rik5>
Group administrator
Mon 13 Mar 2017 03:09:22 PM UTC, comment #9: 

Re-titling bug report and marking as confirmed.  Probably need to run Octave under a debugger and figure out what, exactly, it is doing that is taking so long for certain plots.

Rik <rik5>
Group administrator
Mon 13 Mar 2017 08:59:37 AM UTC, comment #8: 

It is windows 10, 64 bit octave.

You are probably right that it does not crash but just takes very long to finish.

I tried k=6 on my machine, it takes 387 seconds.

Marc Dirix <dirixmjm>
Sun 12 Mar 2017 10:28:44 PM UTC, comment #7: 

I am seeing what appears to be very long execution times, not a crash, when using one of the OpenGL toolkits.

On Linux with the qt toolkit I see times of

k = 5 : 5 seconds
k = 6 : 198 seconds

I didn't try k=7 because it might have been in the hour range.

By contrast, the gnuplot toolkit is much better.  I can even get to k = 8 with only a 7 second print time.

On Windows XP I can do k=7, but not k=8 with the gnuplot toolkit.  For k=8 I get this message


The process cannot access the file because it is being used by another process.



Rik <rik5>
Group administrator
Sun 12 Mar 2017 09:05:13 PM UTC, comment #6: 

Actually, I may be seeing something after repeated testing.  Does Octave actually crash, or does it just hang with 99% CPU usage at the saveas step?

Rik <rik5>
Group administrator
Sun 12 Mar 2017 08:54:52 PM UTC, comment #5: 

Just got around to testing this on a Windows XP virtual machine.  This works for me.  Unfortunately, the problem could be something specific to your system.  Windows 10?  64-bit Octave?  video HW on your PC?  I don't know how to debug it.

Rik <rik5>
Group administrator
Sun 05 Mar 2017 10:53:17 PM UTC, comment #4: 

Sorry about makin two posts.

This crashes

k = 7;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
figure
hnd = surf(x,y,z,c);
colormap([1  1  0; 0  1  1])
saveas(hnd,'test.png')

Marc Dirix <dirixmjm>
Sun 05 Mar 2017 10:51:21 PM UTC, comment #3: 

Since this has gotten no update since November 2016, I'm updating from Octave 4.2.1 on windows 10.

It seems if the surf has too many points it crashes.

For me this works (quick < 5 seconds) and a png is generated
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
figure
hnd = surf(x,y,z,c);
colormap([1  1  0; 0  1  1])
saveas(hnd,'test.png')

Marc Dirix <dirixmjm>
Wed 16 Nov 2016 06:38:35 PM UTC, comment #2: 

Octave 4.2.0 has recently been released (ftp://ftp.gnu.org/gnu/octave).  Many bugs have been fixed.  Could you try the latest stable version of Octave and report whether this has been fixed or still remains an issue.

Rik <rik5>
Group administrator
Sun 30 Oct 2016 11:24:24 PM UTC, comment #1: 

This is Windows 10.

Anonymous
Sun 30 Oct 2016 11:23:05 PM UTC, original submission:  

Plot a graph using scatter3;
save file using GUI or script.

Simple script like this reproduced the issue. Input files are attached.

graphics_toolkit('gnuplot')
P = dlmread('P.txt');
Q = dlmread('Q.txt');
clf();
figure(1);
plot3(P(1,:),P(2,:),P(3,:), '.r', Q(1,:),Q(2,:),Q(3,:), '.b');
saveas(1, 'before_icp.png');

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 pantxo (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by dirixmjm (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-15 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-03-13 rik5 CategoryPlotting with gnuplot Plotting with OpenGL
        Item GroupSegfault, Bus Error, etc. Performance
        StatusWorks For Me Confirmed
        Operating SystemMicrosoft Windows Any
        SummaryOctave crashing when saving plot Octave requires painfully long time to saveas() certain complicated figures
    2017-03-12 rik5 StatusNeed Info Works For Me
        Release4.0.3 4.2.1
    2016-11-16 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code