On Sat, Feb 21, 2015 at 03:50:16PM -0800, Susi Lehtola wrote:
Hi,
the GNU Scientific Library (GSL) contains some linear algebra
routines that need a CBLAS library to work.
GSL contains a compatibility CBLAS library (gslcblas) that provides
a version of these routines. In 2010, we started to link libgsl by a
Fedora patch to libgslcblas, so linking to libgsl could be done just
by -lgsl instead of -lgsl -lgslcblas.
However, the GSL CBLAS library is far from optimal, and you can
typically get an order of magnitude more performance by using an
optimized library. In 2011, the default link in libgsl was changed
to be against ATLAS.
This default, Fedora specific link was removed in Fedora 22 in
December, because
a) there are more CBLAS libraries available than just GSL CBLAS or
ATLAS; e.g. OpenBLAS, Intel MKL or AMD ACML being good examples
b) upstream clearly intended the choice of the library to be made upon
link time
c) a project linking multiple libraries must use the same BLAS/CBLAS
library in all of its components
Because libgsl is no longer linked to a CBLAS library, packages
linking to GSL need to also link to a CBLAS library, ATLAS probably
being the best candidate since OpenBLAS is not available for all
Fedora architectures. The following trick should be enough to handle
the link
%if 0%{?fedora} > 20 || 0%{?rhel} > 6
export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas"
%else
export LIBS="-lgsl L%{_libdir}/atlas -lcblas -latlas"
%endif
I'm not really sure I understood all of that, but anyway.
ocaml-gsl appears to use the output of `gsl-config --libs` which in
effect means that it's using on x86-64: '-lgsl -lgslcblas -lm'
It's possible to override this by exporting GSL_CBLAS_LIB to a value
like the one above.
However my questions is why doesn't `gsl-config --libs` appear to
produce the optimal link command?
Also it looks like to use atlas, spec files would need an additional:
BuildRequires: atlas-devel
Proposed patch for ocaml-gsl.spec attached.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top