[Bug 251563] New: [patch] Getting rid of the lapack dependancy using Eigen

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] New: [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

           Summary: [patch] Getting rid of the lapack dependancy using
                    Eigen
           Product: digikam
           Version: unspecified
          Platform: Gentoo Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: Filter
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


Created an attachment (id=51754)
 --> (http://bugs.kde.org/attachment.cgi?id=51754)
patch to remove dependancy on lapack

Version:           unspecified (using Devel)
OS:                Linux

Original mail :
http://mail.kde.org/pipermail/digikam-devel/2010-September/045620.html

I was very surprised (shocked?) to read
http://blog.akhuettel.de/2010/09/first-bump-digikam-140-kipi-plugins-130.html
Lot of people, and especially Gentoo people, think it's very bad to bundle
copies of libraries (btw, I fully agree with them, but that's not the point
here). Hence the gentoo package for digikam tries to use the systemwide lapack,
which requires blas, and hence a fortran compiler.

Looking at the code, i could only see one single call to lapack : "dgesv_()" in
libs/dimg/filters/sharp/matrix.cpp, which is a basic Ax=b solving (LU with
pivoting). So one, and only one solving using a very common method makes
digikam requires lapack/blas/fortran in gentoo, or, to stick with digikam point
of view, lot of 3rdparty/ files in digikam source.

BUT, digikam already depends on KDE, which itself requires Eigen
(http://eigen.tuxfamily.org), which provides such kind of linear algebra, and
moreover in a very efficient manner, both code/API wise, and from a performance
point of view.
Moreover, eigen was developed inside KDE to answer linear algebra needs among
different KDE projects. Though it now lives its own way, there are still strong
connections with KDE.

As you've probably guessed by now, I'm proposing a patch to do right this : use
eigen instead of lapack to solve the linear system. Again, the dependancy on
eigen is weak, as KDE already depends on it. I've used Eigen2 because eigen3 is
not released yet (it's still in beta), and also because kde still depends on
eigen2. I'll be  happy to update those few lines to eigen3 when required. In
case you wonder, eigen works with a very broad range of compilers, oses,
platforms, cpus... so it should in no way constrain digikam.

I've read http://www.digikam.org/drupal/contrib and the "HACKING" file and
think/hope i comply with those. The webpage has great information such as "send
patches this way", but no indication of where those patches should be sent. By
the way, i have write access to kde svn, but I of course would not dare
committing such a patch without asking you first. That can be useful later on
though.

I've not tested this yet, mostly because i dont know how to test it, and
because i first want to get your 'go' on this before spending more times on the
patch. At least it compiles, and i think it does the same as before, there
really are few lines to consider. The return value from the lapack function was
not used (it could tell if the system has no solution), so i've kept it this
way.

If you happen to agree on the idea, I could test it with someone with more
in-depth knowledge of this code, and then commit it. I'd like to make some
performance tests, too, just out of curiosity.

The source code in libs/dimg/filters/sharp/ is really weird by the way, it's
supposed to be C++, but it's actually struct, with lot of c-like functions such
as 'create matrix', 'free matrix', 'copy matrix', and such. It looks like gtk.
My main purpose was to remove the lapack dependancy/code duplication, so i did
a minmalist patch, but there's a lot of room for improvement here, by switching
to actual C++, and maybe use slightly more of eigen (convolution and other
stuff).


Reproducible: Didn't try

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Gilles Caulier-4
https://bugs.kde.org/show_bug.cgi?id=251563


Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]
          Component|Filter                      |Refocus
            Version|unspecified                 |1.5.0
            Product|digikam                     |digikamimageplugins




--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563


[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #51754|0                           |1
        is obsolete|                            |




--- Comment #1 from  <orzel freehackers org>  2010-09-17 17:41:14 ---
Created an attachment (id=51761)
 --> (http://bugs.kde.org/attachment.cgi?id=51761)
updated patch

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Gilles Caulier-4
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #2 from Gilles Caulier <caulier gilles gmail com>  2010-09-20 09:27:27 ---
orzel,

Thanks for the patch...

I'm not fully agree to remove clapack code from digiKam core, because i want to
limit external depencies for digiKam, especially under windows, where it's not
easy to compile whole digiKam & co

But there is an advantage to use Eigen lib, if code use processors
optimizations to speed-up code.

This is my proposal : set Eigen depency as optional. If it found, we compile
digiKam core with it, else, internal Clapack code is used. I do the same with
liblqr currently.

What do you think about ?

Gilles Caulier

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Johannes Wienke-3
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #3 from Johannes Wienke <languitar semipol de>  2010-09-20 11:09:21 ---
Why not also check for lapack in the system and use this if available before
falling back to the internal version?

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #4 from  <orzel freehackers org>  2010-09-20 14:25:05 ---
#2: as you want. Even on windows, the kde guys already have to deal with eigen
anyway. Eigen is not a library, it's just a bunch of headers (template stuff).
It is easier to integrate than libraries you have to find, link to, and so on.
#3: yes, why not.


The problem with all of this, is that you'll have three testcases to check,
which means a lot more work for testing/releasing, and could mean more
problems.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Gilles Caulier-4
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563


Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Refocus                     |Portability
            Product|digikamimageplugins         |digikam




--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Gilles Caulier-4
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #5 from Gilles Caulier <caulier gilles gmail com>  2010-10-22 10:39:49 ---
Johaness, Orzel,

I apply patch from entry #254315 which check if Clapack library is avaialble to
compile digiKam instead to use internal code.

Now it still to check Eigen shared library availability.

Orzel, please checkout svn trunk where the patch is applied and update your
patch accordingly to play with Eigen library. I would apply it to 1.6.0
release...

Thanks in advance for your help

Gilles Caulier

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #6 from  <orzel freehackers org>  2010-10-30 18:08:44 ---
hi. i've updated svn and i'm working on it. I feel slightly uncomfortable,
because i still dont know how to test it, and i guess nobody else has tested
it. It feels weird to work on integration before tests...

Another point is that after this patch, according to configuration and to what
is available at compile time, three very different code paths could be taken,
which, from a maintainance point of view, is a nightmare.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from bruno.schmidt@gmail.com
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563


Bruno Schmidt <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]




--- Comment #7 from Bruno Schmidt <bruno schmidt gmail com>  2011-04-29 00:02:37 ---
Why not remove clapack if Eigen are just headers.
Worst case you can do with it just like with clapack and bundle it but use the
system one if it is available.

I am also a Gentoo user and will give it a try and post a patch when possible.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #8 from  <orzel freehackers org>  2011-04-29 00:22:47 ---
Note than eigen3 is released now, and i expect other kde part will soon depend
on it.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Marcel Wiesweg
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #9 from Marcel Wiesweg <marcel wiesweg gmx de>  2011-04-30 18:16:36 ---
Eigen has several advantages, among them:
- It's 100% template C++, so compile-time only dependency, no runtime
dependency (like our boost graph dependency)
- The compiler can fully optimize
- it's in a git repository and can be easily downloaded if not installed system
wide

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] [patch] Getting rid of the lapack dependancy using Eigen

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563





--- Comment #10 from  <orzel freehackers org>  2011-05-01 01:05:04 ---
Git is bad, we use Mercurial for eigen :-)

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563


Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[patch] Getting rid of the  |Getting rid of the lapack
                   |lapack dependancy using     |dependancy using Eigen
                   |Eigen                       |[patch]




--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Kevin Kofler
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

Kevin Kofler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email],
                   |                            |[hidden email]

--- Comment #11 from Kevin Kofler <[hidden email]> ---
Nice, I think we'll want to use this in Fedora.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Bugzilla from orzel@freehackers.org
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

--- Comment #12 from [hidden email] ---
I would too. If i can be of any help, just ask.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Francesco Riosa-2
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

Francesco Riosa <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #13 from Francesco Riosa <[hidden email]> ---
just an observation, follow a list of packages that depend on eigen in gentoo,
all of them _require_ eigen-2 (including kde) so I think should be safe for a
while to stick with this version of the template library.

>hom>viv>pro>dkD>src$ equery d dev-cpp/eigen
 * These packages depend on dev-cpp/eigen:
app-office/calligra-9999 (eigen ? dev-cpp/eigen:2)
kde-base/cantor-9999 (>=dev-cpp/eigen-2.0.3:2)
kde-base/kdeartwork-kscreensaver-9999 (eigen ? dev-cpp/eigen:2)
kde-base/kdeplasma-addons-9999 (dev-cpp/eigen:2)
kde-base/rocs-9999 (>=dev-cpp/eigen-2.0.3:2)
media-libs/opencv-2.3.1a-r1 (eigen ? dev-cpp/eigen:2)

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

--- Comment #14 from Gilles Caulier <[hidden email]> ---
See my comment here :

https://bugs.kde.org/show_bug.cgi?id=295423#c6

Gilles Caulier

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Gowtham Ashok
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

--- Comment #15 from Gowtham Ashok <[hidden email]> ---
Created attachment 78349
  --> https://bugs.kde.org/attachment.cgi?id=78349&action=edit
Removing Clapack and using eigen3 instead

This patch removes clapack and uses eigen3. Slightly modified from Giles'
patch(eigen2->eigen3).

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 251563] Getting rid of the lapack dependancy using Eigen [patch]

Gowtham Ashok
In reply to this post by Bugzilla from orzel@freehackers.org
https://bugs.kde.org/show_bug.cgi?id=251563

Gowtham Ashok <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #78349|0                           |1
        is obsolete|                            |

--- Comment #16 from Gowtham Ashok <[hidden email]> ---
Created attachment 78351
  --> https://bugs.kde.org/attachment.cgi?id=78351&action=edit
Removing Clapack and using eigen3 instead

Fixed bug in 78349: Faulty detection of Eigen3 library

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
12