bugGNU Octave - Bugs: bug #54005, kron performance affected by...


bug #54005: kron performance affected by octave_quit() calls

Submitted by:  A.R. Burgers <arb>
Submitted on:  Tue 29 May 2018 08:34:32 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 21 Jun 2018 08:47:00 AM UTC, comment #10:

Maybe it is not related, but I observe the following thing:

After the second call to kron, my system is quite slow for a couple of minutes.

Marco Caliari <caliari>
Project Member
Wed 20 Jun 2018 09:58:20 PM UTC, comment #9:

I'm not too worried about it, but I see something like this:

John W. Eaton <jwe>
Project Administrator
Wed 20 Jun 2018 06:44:25 PM UTC, comment #8:

Human reaction time, at least from what I learned in driver's education, is about 3/4 of a second or 750 milliseconds. As long as the outermost loop is executed say once every 500 milliseconds a human isn't going to really register the delay.

I tried

There is a slight delay after Ctrl+C but nothing that I couldn't live with. If I add another factor of 10 to the size of either A or B I get an out-of-memory error, so this is close to the maximum case for my machine and still acceptable.

Rik <rik5>
Project Administrator
Wed 20 Jun 2018 06:29:22 PM UTC, comment #7:

This change does make kron somewhat less responsive to interrupts when the number of columns of A is small and the other dimensions are large. OTOH, we can't interrupt external library routines at all, so maybe it's not a serious limitation.

John W. Eaton <jwe>
Project Administrator
Wed 20 Jun 2018 05:54:20 PM UTC, comment #6:

I had run that experiment and I thought I had reported on it, but apparently not. The savings is 17%. I suppose that is worth it.

I made that change on the development branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/38a07d930ccd).

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 20 Jun 2018 08:20:11 AM UTC, comment #5:

@Rik: what happens if you move octave_quit() up one level more?

Marco Caliari <caliari>
Project Member
Tue 19 Jun 2018 08:51:41 PM UTC, comment #4:

I'm not saying we shouldn't do this, but I am seeing only modest improvement when moving octave_quit() up one level.

First, I rewrote the test script to have pre-computed vectors. The only thing that we want in the tic/toc loop is the test of kron itself, not the actual construction of new vectors each time using ones(). The result is shown here, and attached.

Results were:

I then moved octave_quit out of the innermost loop. I don't think it is necessary to call it that frequently.

And the result was

The reduction in execution time for column vectors was about 7%.

Marco is correct that we don't want to move octave_quit() completely outside the loops or we would disable Ctrl+C interruption. Is 7% worth it?

Rik <rik5>
Project Administrator
Thu 31 May 2018 09:22:20 PM UTC, comment #3:

Well, the initial diff was only meant to highlight the issue.
Moving the octave_quit one level up, in case nrb==1 leads to these timings:

A.R. Burgers <arb>
Thu 31 May 2018 08:03:53 AM UTC, comment #2:

Of course, it is not Xgemm, but Xscal the proper BLAS routine for scaling a matrix.

Marco Caliari <caliari>
Project Member
Wed 30 May 2018 01:29:29 PM UTC, comment #1:

@A.R. Burgers: If you move octave_quit() outside, then you will never be able to interrupt the operation with a Ctrl+C, I think. Can you please measure what happens if you move octave_quit() to the other loops?

It seems to me that the operation here is made column by column on b. This is a general question: is scalar times a matrix a column by column operation in octave? Could not it be done by BLAS xgemm (with alpha=0)?

Marco Caliari <caliari>
Project Member
Tue 29 May 2018 08:34:32 PM UTC, original submission:

Kron execution times of 2 row vectors or 2 column vectors differ significantly:

The timings are

Moving the octave_quit() from the innermost loop to outside

makes the row vector case quite a bit faster:

A.R. Burgers <arb>


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

Attach Files:

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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by arb (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-20 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed
        Release4.4.0 => dev

    Back to the top

    Powered by Savane 3.4