[IPOL discuss] Clapack and cblas libraries interfacing

Tristan Dagobert tristan.dagobert at cmla.ens-cachan.fr
Thu Mar 29 09:44:01 CEST 2012


I would like to share my recent experience
about linking cblas and clapack librairies (two of the authorized libraries
in the guidelines 1.00) with a IPOL program, because this leads some 
remarks and

There are currently at least 3 versions of C prototypes for CBLAS and 
linking the C functions with the Fortran binaries :

(1) the version installed by default, with the ATLAS packages, upon the 
differents Linux systems
    (like the FUCHSIA server) containing :
   - clapack.h (a file of 149 lines) with only few prototypes to Lapack 
Fortran binaries;
   - cblas.h containing all prototypes to Fortran routines.

(2) the version from sources lapack 3.2.1 compatible with Windows :
   - clapack.h (a file of more than 7200 lines) with all the prototypes 
to Fortran binaries;
   but this does not come with the cblas.h file, which must downloaded 
too in CBLAS.tgz.

(3) the version from sources lapack 3.4.0 compatible with Windows :
   - lapacke.h with all the prototypes to Fortran binaries;
   but this does not come with the cblas.h file, which must downloaded 
too in CBLAS.tgz;

The problem is these versions do not share the same C prototypes. For
example, to use the Fortran routine of SVD named dsyevd() :

- (1) --> the prototype simply does not exist in clapack.h
          but binary code is present in libclapack.a (!!);
- (2) --> clapack_dsyevd() is C-prototyped in clapack.h;
- (3) --> LAPACKE_dsyevd() is C-prototyped in lapacke.h;

According to differents lapack forums, the C prototypes of 3.4.0 version
are intented to replace at mean term, the actual format (1).

Consequently, stability of C APIs of clapack seems not to be safe.
Building a IPOL program with the current default prototypes (1) will 
lead to restrict
its portability et its simplicity of installation even upon Linux systems,
from 5 to 10 years.
In addition, the installation from sources, of the (2) and (3) librairies
is quiet subtile and tricky (gfortran compilers, f2c ...) and needs
certainly more time than a final user of an IPOL program should expect.

So my questions are :
- Is there a reference version of Clapack, Cblas defined in the IPOL 
guidelines ?
- What about the GSL library, which owns more stable prototypes (it is 
written in standard C and does not need Fortran conversion)s. Is its 
planned for the next guidelines as a possible alternative as external 
library ?


More information about the discuss mailing list