[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Removing clapack?



On Sun, Sep 10, 2017 at 07:36:19AM +0200, Andreas Tille wrote:

> On Sun, Sep 10, 2017 at 12:14:17AM +0200, Sébastien Villemot wrote:
> > 
> > Since clapack and lapack provide exactly the same API and ABI, and actually
> > exactly the same algorithms (the only difference being the programming language
> > in which it is implemented), I have no doubt that phast can directly use
> > lapack.
> > 
> > The only value added of clapack over lapack is the clapack.h header, which
> > provides the prototypes for the Fortran LAPACK interface.
> > 
> > So in the worst case, phast can be packaged by linking it to lapack, and by
> > providing (a subset of) clapack.h in a patch. Or maybe we could include
> > clapack.h in src:lapack (though ATLAS also provides an unrelated clapack.h, so
> > we must think twice about it).
> > 
> > Andreas: in any case, I am willing to help you linking phast with lapack, so
> > that we can get rid of clapack.
> 
> I tried
[…]
> but I have no idea how to replace libctmg-dev.

It should be replaced by libtmglib-dev from src:lapack.

> I'd be more than happy if you could have a look and tell me how to
> get rid of clapack completely.

Please find attached a patch which, applied on top of your phast packaging
repository, removes the dependency on clapack.

Basically, as expected, I had to introduce the C prototypes for the few LAPACK
functions used by phast.

I also removed the dependency on f2c, which was only used for two type
definitions (LAPACK int and double).

Best,

-- 
⢀⣴⠾⠻⢶⣦⠀  Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁  Debian Developer
⢿⡄⠘⠷⠚⠋⠀  http://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀  http://www.debian.org
From e3ee4b30ff001cf2b199c640b341d912da4e50ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@debian.org>
Date: Sun, 10 Sep 2017 11:06:22 +0200
Subject: [PATCH] Depend on packages from src:lapack instead of obsolete
 src:clapack.

---
 debian/control                                   |  7 ++-
 debian/patches/clapack.patch                     | 60 +++++++++++++++++++-----
 debian/patches/fix_include.patch                 | 17 -------
 debian/patches/hardening.patch                   |  7 +--
 debian/patches/series                            |  1 -
 debian/patches/use_debian_packaged_libpcre.patch | 21 ++-------
 6 files changed, 59 insertions(+), 54 deletions(-)
 delete mode 100644 debian/patches/fix_include.patch

diff --git a/debian/control b/debian/control
index 42e72ea..f8818a5 100644
--- a/debian/control
+++ b/debian/control
@@ -4,10 +4,9 @@ Uploaders: Andreas Tille <tille@debian.org>
 Section: science
 Priority: optional
 Build-Depends: debhelper (>= 9),
-               libf2c2-dev (>= 20130926-2~),
-               libclapack-dev,
-               libcblas-dev,
-               libctmg-dev,
+               liblapack-dev,
+               libblas-dev,
+               libtmglib-dev,
                libpcre3-dev,
                help2man
 Standards-Version: 3.9.8
diff --git a/debian/patches/clapack.patch b/debian/patches/clapack.patch
index ac1041b..12e4933 100644
--- a/debian/patches/clapack.patch
+++ b/debian/patches/clapack.patch
@@ -1,9 +1,12 @@
 Author: Andreas Tille <tille@debian.org>
-Last-Update: Fri, 27 May 2016 18:06:35 +0200
-Description: Debian's clapack package renames library from lapack.a
- to clapack.a to enable parallel installation of the alternative
- implementation lapacke
-
+Author: Sébastien Villemot <sebastien@debian.org>
+Last-Update: 2017-09-10
+Description: Use Debian package for BLAS/LAPACK (instead of obsolete clapack)
+ - Use -lblas instead of -lblaswr
+ - Use -ltmglib instead of -ltmg
+ - Do not use f2c, not needed
+ - Introduce prototypes for LAPACK functions used in the package
+   (those are documented in the manpages from the liblapack-doc package)
 --- a/src/lib/Makefile
 +++ b/src/lib/Makefile
 @@ -12,29 +12,9 @@ endif
@@ -49,18 +52,17 @@ Description: Debian's clapack package renames library from lapack.a
  endif
  
  # if neither VECLIB nor CLAPACKPATH is defined, then LAPACK will be
-@@ -140,16 +138,15 @@ else
+@@ -139,8 +137,7 @@ LIBS = -lphast -framework vecLib -lc -lm
+ else
  ifdef CLAPACKPATH
  ifneq ($(TARGETOS), Windows)
-   CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH}
+-  CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH}
 -  LIBS = -lphast -llapack -ltmg -lblaswr -lc -lf2c -lm
-+  LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm
++  LIBS = -lphast -llapack -ltmglib -lblas -lc -lm
  else
--  CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH} -DPCRE_STATIC
-+  CFLAGS += -I${CLAPACKPATH}/INCLUDE -DPCRE_STATIC
+   CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH} -DPCRE_STATIC
    LIBS = -lphast -lm  ${CLAPACKPATH}/liblapack.a ${CLAPACKPATH}/libf2c.a ${CLAPACKPATH}/libblas.a
- endif
- # IMPORTANT: use the following two lines instead for versions of CLAPACK
+@@ -149,7 +146,6 @@ endif
  # older than 3.1.1
  #CFLAGS += -I${CLAPACKPATH} -I${F2CPATH}
  #LIBS = -lphast -llapack -ltmg -lblaswr -lc -lF77 -lI77 -lm
@@ -68,3 +70,37 @@ Description: Debian's clapack package renames library from lapack.a
  
  # bypass
  else
+--- a/include/external_libs.h
++++ b/include/external_libs.h
+@@ -39,10 +39,27 @@
+ #else
+ 
+ #ifndef SKIP_LAPACK 
+-#include <f2c.h>  
+-#include <clapack.h> 
+-#define LAPACK_INT integer
+-#define LAPACK_DOUBLE doublereal
++
++int dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr,
++           double *wi, double *vl, int *ldvl, double *vr, int *ldvr,
++           double *work, int *lwork, int *info);
++
++int dgebal_(char *job, int *n, double *a, int *lda, int *ilo, int *ihi,
++            double *scale, int *info);
++
++int dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b,
++           int *ldb, int *info);
++
++int dgebak_(char *job, char *side, int *n, int *ilo, int *ihi, double *scale,
++            int *m, double *v, int *ldv, int *info);
++
++int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
++
++int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork,
++            int *info);
++
++#define LAPACK_INT int
++#define LAPACK_DOUBLE double
+ #endif  /*ifndef SKIP_LAPACK */
+ 
+ #endif  /*ifdef VECLIB */
diff --git a/debian/patches/fix_include.patch b/debian/patches/fix_include.patch
deleted file mode 100644
index 46a7c5c..0000000
--- a/debian/patches/fix_include.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Author: Andreas Tille <tille@debian.org>
-Last-Update: Fri, 27 May 2016 18:06:35 +0200
-Description: Remove broken include options
-
---- a/src/make-include.mk
-+++ b/src/make-include.mk
-@@ -137,10 +137,8 @@ LIBS = -lphast -framework vecLib -lc -lm
- else
- ifdef CLAPACKPATH
- ifneq ($(TARGETOS), Windows)
--  CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH}
-   LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm -lpcre
- else
--  CFLAGS += -I${CLAPACKPATH}/INCLUDE
-   LIBS = -lphast -lm  ${CLAPACKPATH}/liblapack.a ${CLAPACKPATH}/libf2c.a ${CLAPACKPATH}/libblas.a
- endif
- # IMPORTANT: use the following two lines instead for versions of CLAPACK
diff --git a/debian/patches/hardening.patch b/debian/patches/hardening.patch
index 939cfb6..a3c86dc 100644
--- a/debian/patches/hardening.patch
+++ b/debian/patches/hardening.patch
@@ -13,12 +13,13 @@ Description: Propagate hardening options
   # some other options
   #CFLAGS = -mcpu=opteron -O3
   #CFLAGS = -mcpu=pentiumpro -O3 
-@@ -137,7 +137,7 @@ LIBS = -lphast -framework vecLib -lc -lm
+@@ -137,8 +137,8 @@ LIBS = -lphast -framework vecLib -lc -lm
  else
  ifdef CLAPACKPATH
  ifneq ($(TARGETOS), Windows)
--  LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm -lpcre
-+  LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm -lpcre $(LDFLAGS)
+-  LIBS = -lphast -llapack -ltmglib -lblas -lc -lm -lpcre
++  LIBS = -lphast -llapack -ltmglib -lblas -lc -lm -lpcre $(LDFLAGS)
  else
+   CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH} -DPCRE_STATIC
    LIBS = -lphast -lm  ${CLAPACKPATH}/liblapack.a ${CLAPACKPATH}/libf2c.a ${CLAPACKPATH}/libblas.a
  endif
diff --git a/debian/patches/series b/debian/patches/series
index 744d043..63e3cef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,5 @@
 clapack.patch
 do_not_install_to_opt.patch
 use_debian_packaged_libpcre.patch
-fix_include.patch
 use_debian_packaged_help2man.patch
 hardening.patch
diff --git a/debian/patches/use_debian_packaged_libpcre.patch b/debian/patches/use_debian_packaged_libpcre.patch
index efce51f..5284535 100644
--- a/debian/patches/use_debian_packaged_libpcre.patch
+++ b/debian/patches/use_debian_packaged_libpcre.patch
@@ -13,29 +13,16 @@ Description: Use Debian packaged libpcre
  LIBPATH = -L${LIB} 
  
  # uncomment these lines for profiling (add -g for line-by-line
-@@ -138,9 +138,9 @@ else
+@@ -138,8 +138,8 @@ else
  ifdef CLAPACKPATH
  ifneq ($(TARGETOS), Windows)
-   CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH}
--  LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm
-+  LIBS = -lphast -lclapack -lctmg -lcblas -lc -lf2c -lm -lpcre
+-  LIBS = -lphast -llapack -ltmglib -lblas -lc -lm
++  LIBS = -lphast -llapack -ltmglib -lblas -lc -lm -lpcre
  else
--  CFLAGS += -I${CLAPACKPATH}/INCLUDE -DPCRE_STATIC
-+  CFLAGS += -I${CLAPACKPATH}/INCLUDE
+   CFLAGS += -I${CLAPACKPATH}/INCLUDE -I${F2CPATH} -DPCRE_STATIC
    LIBS = -lphast -lm  ${CLAPACKPATH}/liblapack.a ${CLAPACKPATH}/libf2c.a ${CLAPACKPATH}/libblas.a
  endif
  # IMPORTANT: use the following two lines instead for versions of CLAPACK
-@@ -154,8 +154,8 @@ ifneq ($(TARGETOS), Windows)
-   CFLAGS += -DSKIP_LAPACK
-   LIBS = -lphast -lc -lm
- else
--  CFLAGS += -DSKIP_LAPACK -DPCRE_STATIC
--  LIBS = -lphast -lm  
-+  CFLAGS += -DSKIP_LAPACK
-+  LIBS = -lphast -lm -lpcre
- endif
- endif
- endif
 --- a/src/lib/Makefile
 +++ b/src/lib/Makefile
 @@ -3,7 +3,7 @@ PHAST := ${PHAST}/..
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature


Reply to: