[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54005] kron performance affected by octave_qu
From: |
A.R. Burgers |
Subject: |
[Octave-bug-tracker] [bug #54005] kron performance affected by octave_quit() calls |
Date: |
Tue, 29 May 2018 16:34:33 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299 |
URL:
<http://savannah.gnu.org/bugs/?54005>
Summary: kron performance affected by octave_quit() calls
Project: GNU Octave
Submitted by: arb
Submitted on: Tue 29 May 2018 08:34:32 PM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Performance
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: Any
_______________________________________________________
Details:
Kron execution times of 2 row vectors or 2 column vectors differ
significantly:
nrep = 10;
np = 10000;
tic()
ver = version
hg_id = __octave_config_info__.hg_id
for i = 1 : nrep
a = kron(ones(np,1), ones(np, 1));
end
toc()
tic()
for i = 1 : nrep
a = kron(ones(1, np), ones(1, np));
end
toc()
The timings are
Elapsed time is 2.40767 seconds. (for the column vectors)
Elapsed time is 5.19106 seconds. (for the row vectors)
Moving the octave_quit() from the innermost loop to outside
diff -r cdaa884568b1 libinterp/corefcn/kron.cc
--- a/libinterp/corefcn/kron.cc Thu May 24 19:20:35 2018 -0700
+++ b/libinterp/corefcn/kron.cc Tue May 29 22:26:22 2018 +0200
@@ -63,11 +63,11 @@
MArray<T> c (dim_vector (nra*nrb, nca*ncb));
T *cv = c.fortran_vec ();
+ octave_quit ();
for (octave_idx_type ja = 0; ja < nca; ja++)
for (octave_idx_type jb = 0; jb < ncb; jb++)
for (octave_idx_type ia = 0; ia < nra; ia++)
{
- octave_quit ();
mx_inline_mul (nrb, cv, a(ia, ja), b.data () + nrb*jb);
cv += nrb;
}
makes the row vector case quite a bit faster:
Elapsed time is 2.31054 seconds. (column vectors)
Elapsed time is 3.54135 seconds. (row vectors)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54005>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54005] kron performance affected by octave_quit() calls,
A.R. Burgers <=