[CMake] Extension proposal: CheckFortranFuinctionExists.cmake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Jun 26 12:47:34 EDT 2008


On 2008-06-26 09:56+0200 Hauke Heibel wrote:

> 2) FindCBLAS.cmake:
> -------------------
> a) Well, we need it (I already told Alan, that I am willing to write it)
> b) Should be able to use FindBLAS.cmake (Legacy BLAS is required by CBLAS),
>  even without a Fotran compiler being present...

In the CLAPACK, case, the C code was generated by f2c and then additionally
modified so CLAPACK is now completely independent of LAPACK.  I assume the
same is true of legacy CBLAS. Presumably there are also other CBLAS
alternatives that are also completely independent of the Fortran version. So
your planning should probably include the alternatives of both CBLAS
depending on BLAS and not.

>
> 2) FindCBLAS.cmake:
> -------------------
> Things I assume to be true from the script's point of view
> * A sane system, i.e. not 10 different versions of BLAS & Co.
> The script will simply return the first one it stumbles upon
> * BLAS and commercial alternatives may though coexist.
> The script might return at first optimized versions and then
> non-optimized ones.
>
> Actually, the Fortran underscoring remains an issue, since there exist two
> possible solutions (that is also the main reason, why we cannot have a 
> general
> purpose script).
>
> a) We try to figure out the underscoring convention from within the script
>  since some libraries that require BLAS offer the possibility to set the 
> used
>  convention via pre-processor defines.
>
> b) We let the developer tell the script the desired convention via a 
> variable.
>
> In my opinion the latter solution is as valid as the first one

PLplot currently has a default underscoring convention we use to interface
our fortran and C libraries.  That default works for Linux and Mac OS X, and
we also have a preprocessor #define option to change that convention to one
of the known alternatives when needed for some of the traditional Unix
variants.  So I feel some underlying solution like that for interfacing C
code to Fortran BLAS is the way to go.

But then the choices are (a) whether to have automatic detection of the
underscoring convention so the preprocessor define is figured out
automatically or (b) just simply have the user specify it for their platform
(as in the PLplot case) if the default doesn't work for them.

(b) certainly works pretty well for the PLplot case (since in our experience
traditional Unix PLplot users are a tiny minority compared to Linux and Mac
OS X users) and is simpler, and the option always exists to go for automatic
detection in the future.

Also, I have changed my mind on my previous stance about separating
FindCBLAS.cmake from FindBLAS.cmake (and similarly for FindCLAPACK.cmake and
FindLAPACK.cmake) since the user can specify exactly what combination is
required via an additional control variable.  This variable would be
distinct from the above variable to control the underscoring convention for
C/Fortran interfacing if the default does not work.  (And, of course, the
above variable is moot when interfacing C code with C BLAS and fortran code
with Fortran BLAA). Thus, it should be possible to have one general-purpose
Find script deal with all the different C and Fortran possibilities and
combinations thereof (with both the choice of underscoring convention (if
needed) and library under the user's control) for BLAS and similarly for
LAPACK.

> So let's go for the next round... :)

Indeed.  LAPACK and BLAS are so useful that they have been implemented in a
very large number of different ways so it is going to take some planning
effort to figure out the simplest (from the user perspective) CMake control
of all the potential variations.  However, note if you pick good defaults
for the control variables most LAPACK/BLAS users won't have to worry about
these issues in any case.

Alin, could you please chime in here as the FindLAPACK.cmake and
FindBLAS.cmake maintainer?  You know a lot more about the many LAPACK and
BLAS possibilities than I do so if I got something wrong or forgot
an issue, please correct me.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list