# [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

18 messages
Open this post in threaded view
|

## [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 Hi, I have a problem with complex matrix inverse. It tooks tooo much time - exactly after a few minutes it is still running. For example: R =[2.73777 + 0.00000i   1.37236 - 0.72174i   0.69303 - 0.14167i   0.63994 - 0.83864i  -0.25874 - 0.25550i  -0.82048 - 0.20511i; 1.37236 + 0.72174i   2.69579 + 0.00000i   0.23759 - 0.30504i   1.29171 - 0.17148i  -0.15310 - 0.00730i  -0.25855 - 0.60625i; 0.69303 + 0.14167i   0.23759 + 0.30504i   0.40401 + 0.00000i   0.20763 + 0.24430i   0.20110 - 0.03398i  -0.06607 - 0.18187i; 0.63994 + 0.83864i   1.29171 + 0.17148i   0.20763 - 0.24430i   1.36263 + 0.00000i   0.37732 - 0.65585i  -0.35103 - 0.68330i; -0.25874 + 0.25550i  -0.15310 + 0.00730i   0.20110 + 0.03398i   0.37732 + 0.65585i   0.86475 + 0.00000i   0.15397 - 0.44375i; -0.82048 + 0.20511i  -0.25855 + 0.60625i  -0.06607 + 0.18187i  -0.35103 + 0.68330i   0.15397 + 0.44375i   0.51529 + 0.00000i]; R^-1, inv(R) or even det(R) never ends. I hadn't this sort of problem at previous version (5.1.0 or 4.4.1). I also made some tests: >> inv(randn(5,5)+randn(5,5)*i) ans =   -2.425050 + 0.985107i  -2.252581 + 0.717247i   0.907427 + 0.038175i   1.836315 - 0.164532i   1.118745 + 1.651210i   -0.441461 + 0.242339i  -0.362658 + 0.527868i   0.095278 - 0.101801i   0.421793 - 0.354213i   0.653532 + 0.342560i   -0.822710 + 0.768548i  -0.839364 + 0.685658i   0.352782 - 0.286913i   0.569430 - 0.484251i   0.885459 + 0.606097i   -1.085909 + 1.130584i  -1.502771 + 0.367119i   0.511804 - 0.073505i   1.185076 - 0.471890i   0.831822 + 0.963687i    1.949569 - 2.571564i   2.639221 - 1.653823i  -1.182722 + 0.113535i -1.860883 + 1.649983i  -2.199696 - 1.906358i >> inv(randn(6,6)+randn(6,6)*i) <- still running. It seems that this occures with matrices larger than 5x5. Can somebody check occurrence of this at your copy? Regards. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On Sun, Mar 29, 2020 at 8:58 AM KamilStawiarski <[hidden email]> wrote: >> inv(randn(6,6)+randn(6,6)*i) <- still running. It seems that this occures with matrices larger than 5x5. Can somebody check occurrence of this at your copy?octave:1> a=(randn(5000) + i*randn(5000));octave:2> whos aVariables visible from the current scope:variables in scope: top scope   Attr Name        Size                     Bytes  Class   ==== ====        ====                     =====  =====    c    a        5000x5000               400000000  doubleTotal is 25000000 elements using 400000000 bytesoctave:3> tic; inv(a); tocElapsed time is 3.61655 seconds.octave:4> Your blas library (atlas/openblas -- whatever you are using ) is broken.Dmitri.--
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On 2020-03-29 07:02, Dmitri A. Sergatskov wrote: > > > On Sun, Mar 29, 2020 at 8:58 AM KamilStawiarski <[hidden email] > > wrote: > > >      >> inv(randn(6,6)+randn(6,6)*i) <- still running. > >     It seems that this occures with matrices larger than 5x5. > >     Can somebody check occurrence of this at your copy? > > > octave:1> a=(randn(5000) + i*randn(5000)); > octave:2> whos a > Variables visible from the current scope: > > variables in scope: top scope > >     Attr Name        Size                     Bytes  Class >     ==== ====        ====                     =====  ===== >     c    a        5000x5000               400000000  double > > Total is 25000000 elements using 400000000 bytes > > octave:3> tic; inv(a); toc > Elapsed time is 3.61655 seconds. > octave:4> > > Your blas library (atlas/openblas -- whatever you are using ) is broken. > > Dmitri. > -- > > > I may need a tune-up, On a 4.2GHz i7-3930K, 16G RAM, GNU Octave Version: 6.0.1 (hg id: 4f1d1b1d4afc) octave:38> a=(randn(500) + i*randn(500)); octave:39> tic; inv(a); toc Elapsed time is 0.196272 seconds. octave:40> tic; inv(a); toc Elapsed time is 0.180958 seconds. octave:41> a=(randn(1000) + i*randn(1000)); octave:42> tic; inv(a); toc Elapsed time is 1.41202 seconds. octave:43> a=(randn(2000) + i*randn(2000)); octave:44> tic; inv(a); toc Elapsed time is 12.0782 seconds. I do not see atlas or blas in /usr/local/bin/octave  > ldd /usr/local/bin/octave          linux-vdso.so.1 (0x00007ffd5ae97000)          libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6          libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6          libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1          libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6          libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2          libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6          /lib64/ld-linux-x86-64.so.2          libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6          libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6          libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0          librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1  > dpkg -l libblas* ||/ Name           Version      Architecture Description +++-==============-============-============-================================= ii  libblas-dev:am 3.7.1-4ubunt amd64   Basic Linear Algebra Subroutines ii  libblas3:amd64 3.7.1-4ubunt amd64 I may be using the ubuntu version of blas, libblas.so.3.7.1  > ldconfig -p | grep libblas.so libblas.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblas.so And, following the links... /usr/lib/x86_64-linux-gnu/libblas.so -> /etc/alternatives/libblas.so-x86_64-linux-gnu /etc/alternatives/libblas.so-x86_64-linux-gnu -> /usr/lib/x86_64-linux-gnu/blas/libblas.so /usr/lib/x86_64-linux-gnu/blas/libblas.so -> libblas.so.3.7.1 Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On 2020-03-29 13:52, Thomas D. Dean wrote: > I do not see atlas or blas in /usr/local/bin/octave I don't know where my head is. libblas.so.3.7.1 is linked in to liboctave.  > ldd /usr/local/lib/octave/7.0.0/liboctave.so | grep blas          libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On Sun, Mar 29, 2020 at 5:25 PM Thomas D. Dean <[hidden email]> wrote:On 2020-03-29 13:52, Thomas D. Dean wrote: > I do not see atlas or blas in /usr/local/bin/octave I don't know where my head is. libblas.so.3.7.1 is linked in to liboctave.  > ldd /usr/local/lib/octave/7.0.0/liboctave.so | grep blas          libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3I got similar timing if use reference blas. You can try to start octave as:OPENBLAS_NUM_THREADS=4 LD_PRELOAD=/usr/lib64/libopenblasp.so octave(on Redhat/Fedora, liopenblasp is the name of the multithreaded openblas library,adjust accordingly to your system)Dmitri.--   Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On 2020-03-29 14:40, Dmitri A. Sergatskov wrote: > > > On Sun, Mar 29, 2020 at 5:25 PM Thomas D. Dean <[hidden email] > > wrote: > >     On 2020-03-29 13:52, Thomas D. Dean wrote: > >      > I do not see atlas or blas in /usr/local/bin/octave > >     I don't know where my head is. >     libblas.so.3.7.1 is linked in to liboctave. > >       > ldd /usr/local/lib/octave/7.0.0/liboctave.so | grep blas >               libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 > > > I got similar timing if use reference blas. > You can try to start octave as: > > OPENBLAS_NUM_THREADS=4 LD_PRELOAD=/usr/lib64/libopenblasp.so octave > > (on Redhat/Fedora, liopenblasp is the name of the multithreaded openblas > library, > adjust accordingly to your system) > > Dmitri. I do not have lib*blasp.so except in python3.6 and maple2019 directories.  (Neither work). I cloned openblas.  Now, build it and rebuild octave.  Back later. Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On 2020-03-29 15:13, Thomas D. Dean wrote: I installed OpenBlas in /usr/local/lib/OpenBlas. Octave configure returned "64 bit blas index = no" I used ../configure --with-blas=/usr/local/lib/OpenBlas/lib/libopenblas.so Does this use the include files in  /usr/local/lib/OpenBlas/include?  I fear that configure will use the ubuntu package installed include files. I have related packages installed:  >dpkg -l libatlas* liblapack* libblas* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name           Version      Architecture Description +++-==============-============-============-================================== un  libatlas-base-             (no description available) un  libatlas3-base             (no description available) ii  libblas-dev:am 3.7.1-4ubunt amd64 Basic Linear Algebra Subroutines 3 un  libblas.so                 (no description available) un  libblas.so.3               (no description available) ii  libblas3:amd64 3.7.1-4ubunt amd64 Basic Linear Algebra Reference imp ii  liblapack-dev: 3.7.1-4ubunt amd64 Library of linear algebra routines un  liblapack-doc               (no description available) un  liblapack.so               (no description available) un  liblapack.so.3             (no description available) ii  liblapack3:amd 3.7.1-4ubunt amd64 Library of linear algebra routines I hesitate to remove/purge the 'un' packages. I have changed from Sun to aix to BSD to FreeBSD to debian to ubuntu, fleeing automated system changes. Tom Dean
Open this post in threaded view
|

## Octave build used libblas.so not libopenblas.so

 cd octave-code/build ../configure --with-blas=/usr/local/lib/OpenBlas/lib/libopenblas.so  > make -j12    OK  > make check    OK ldd ./liboctave/.libs/liboctave.so|  grep blas          libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 Looks like make used the ubuntu package libblas, not the newly installed libopenblas. I created an /etc/ld.so.conf.d/openblas.conf with /usr/local/lib/OpenBlas/lib and did  > sudo ldconfig Now,  > sudo ldconfig =p | grep openblas          libopenblas.so.0 (libc6,x86-64) => /usr/local/lib/OpenBlas/lib/libopenblas.so.0          libopenblas.so (libc6,x86-64) => /usr/local/lib/OpenBlas/lib/libopenblas.so So, octave build should have picked up libopenblas, but, it did not. What now? Tom Dean
Open this post in threaded view
|

## Re: Octave build used libblas.so not libopenblas.so

 On Sun, Mar 29, 2020 at 16:00:17 -0700, Thomas D. Dean wrote: > cd octave-code/build > ../configure --with-blas=/usr/local/lib/OpenBlas/lib/libopenblas.so […] > So, octave build should have picked up libopenblas, but, it did not. This is not ideal. Try this instead     ../configure LDFLAGS=-L/usr/local/lib/OpenBlas/lib If you want to use the --with-blas option, it should be something like     --with-blas=openblas or     --with-blas=-lopenblas But these are typically detected automatically, so not required. Cheers, -- mike signature.asc (849 bytes) Download Attachment
Open this post in threaded view
|

## Re: Octave build used libblas.so not libopenblas.so

 On 2020-03-29 16:08, Mike Miller wrote: > On Sun, Mar 29, 2020 at 16:00:17 -0700, Thomas D. Dean wrote: >> cd octave-code/build >> ../configure --with-blas=/usr/local/lib/OpenBlas/lib/libopenblas.so > […] >> So, octave build should have picked up libopenblas, but, it did not. > > This is not ideal. Try this instead > >      ../configure LDFLAGS=-L/usr/local/lib/OpenBlas/lib > This detected -lopenblas.  > make    OK  > ldd ./liboctave/.libs/liboctave.so|  grep blas          libopenblas.so.0 => /usr/local/lib/OpenBlas/lib/libopenblas.so.0 (0x00007f0784e41000)          libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f07807e7000) Looks like both libblas and olibpenblas were linked into liboctave.  > make check    OK. Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 In reply to this post by Thomas D. Dean-2 On 2020-03-29 15:36, Thomas D. Dean wrote: > On 2020-03-29 15:13, Thomas D. Dean wrote: > After installing libOpenBlas and rebuilding, and installing octave, octave:1> a=(randn(2000) + i*randn(2000)); octave:2> tic; inv(a); toc Elapsed time is 1.0736 seconds. octave:3> a=(randn(5000) + i*randn(5000)); octave:4> tic; inv(a); toc Elapsed time is 17.6952 seconds. Tom Dean
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On Ubuntu 18.04, for Octave 5.2.0 built from source using libblas-dev, you can switch to openblas without rebuilding it. On my AWS c5.4xlarge instance, >> sudo apt-get install libopenblas-base Reading package lists... Done ... Setting up libopenblas-base:amd64 (0.2.20+ds-4) ... update-alternatives: using /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 to provide /usr/lib/x86_64-linux-gnu/libblas.so.3 (libblas.so.3-x86_64-linux-gnu) in auto mode update-alternatives: using /usr/lib/x86_64-linux-gnu/openblas/liblapack.so.3 to provide /usr/lib/x86_64-linux-gnu/liblapack.so.3 (liblapack.so.3-x86_64-linux-gnu) in auto mode Processing triggers for libc-bin (2.27-3ubuntu1) ... octave:8> a=randn(n)+i*randn(n); octave:9> tic;lu(a);toc Elapsed time is 1.25847 seconds. Maximum CPU usage reported in top is 1600% (all 16 cores). -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 I've got lapack/blas in version 3.9: un  libatlas-base-dev                 (brak dostępnego opisu) un  libatlas3-base                     (brak dostępnego opisu) ii  libblas-dev:amd64   3.9.0-1build1 amd64        Basic Linear Algebra Subroutines 3, static library un  libblas.so                         (brak dostępnego opisu) un  libblas.so.3                       (brak dostępnego opisu) ii  libblas3:amd64      3.9.0-1build1 amd64        Basic Linear Algebra Reference implementations, shared library ii  libblas64-3:amd64   3.9.0-1build1 amd64        Basic Linear Algebra Reference implementations, shared library (64bit-index) ii  libblas64-dev:amd64 3.9.0-1build1 amd64        Basic Linear Algebra Subroutines 3, static library (64bit-index) un  libblas64.so                       (brak dostępnego opisu) un  libblas64.so.3                     (brak dostępnego opisu) un  liblapack-dev                     (brak dostępnego opisu) un  liblapack-doc                     (brak dostępnego opisu) un  liblapack.so                       (brak dostępnego opisu) un  liblapack.so.3                     (brak dostępnego opisu) ii  liblapack3:amd64    3.9.0-1build1 amd64        Library of linear algebra routines 3 - shared version Bu I've tried install octave in freshly installed ubuntu 20.04. It works fine, and has the same versions of lapack/libblas packages. This is definitely issue with my installation (ubuntu 18.04 upgraded to 20.04). Regards. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 I really need Octave so I reinstalled ubuntu. And the same problem comes out. I have look into code, put some couts and it stops at function F77_XFCN (zgetrf, ZGETRF, (nr, nr, F77_DBLE_CMPLX_ARG (tmp_data), nr, pipvt, tmp_info)); which comes from lapack package. I have written my own cpp code with this function and everything works fine. At this moment I am trying run Ortave in gdb to check what is really going on. I will write a solution here (if I find it), maybe someone will use it. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 On Wed, Apr 8, 2020 at 12:34 AM KamilStawiarski <[hidden email]> wrote:I really need Octave so I reinstalled ubuntu. And the same problem comes out. I have look into code, put some couts and it stops at function F77_XFCN (zgetrf, ZGETRF, (nr, nr, F77_DBLE_CMPLX_ARG (tmp_data), nr, pipvt, tmp_info)); which comes from lapack package. I have written my own cpp code with this function and everything works fine. At this moment I am trying run Ortave in gdb to check what is really going on. I will write a solution here (if I find it), maybe someone will use it.Ubuntu 20 has broken openblas. Either use reference blas or atlas (or self compile openblas,etc ...). And please file the bug on Ubuntu tracker.Dmitri.--
Open this post in threaded view
|

## Re: [Octave 5.2.0 @ Ubuntu 20.04] Long duration of complex matrix inverse

 Thanks for reply. I also have found, that this problem does not occure when Octave is running with with su permissions. I have added a new user, and under this new user - Octave also blocks. So ihmo it is the problem with prermissions. I will run Octave under root, but it is temporary walkaround. To sum up the problem, the problem is not due to Octave. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html