Merge pull request #85799 from matthewbauer/blas-lapack-expand-docs

BLAS/LAPACK fixup and expand docs
This commit is contained in:
Benjamin Hipple 2020-04-22 21:56:20 -04:00 committed by GitHub
commit 21be830522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 22 deletions

View file

@ -140,8 +140,8 @@ self: super:
<section xml:id="sec-overlays-alternatives"> <section xml:id="sec-overlays-alternatives">
<title>Using overlays to configure alternatives</title> <title>Using overlays to configure alternatives</title>
<para> <para>
Certain software has different implementations of the same Certain software packages have different implementations of the
interface. Other distributions have functionality to switch same interface. Other distributions have functionality to switch
between these. For example, Debian provides <link between these. For example, Debian provides <link
xlink:href="https://wiki.debian.org/DebianAlternatives">DebianAlternatives</link>. xlink:href="https://wiki.debian.org/DebianAlternatives">DebianAlternatives</link>.
Nixpkgs has what we call <literal>alternatives</literal>, which Nixpkgs has what we call <literal>alternatives</literal>, which
@ -160,8 +160,9 @@ self: super:
</para> </para>
<para> <para>
The Nixpkgs attribute is <literal>openblas</literal> for The Nixpkgs attribute is <literal>openblas</literal> for
ILP64 and <literal>openblasCompat</literal> for LP64. This ILP64 (integer width = 64 bits) and
is the default. <literal>openblasCompat</literal> for LP64 (integer width =
32 bits). <literal>openblasCompat</literal> is the default.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -190,8 +191,15 @@ self: super:
#83888</link>, we are able to override the blas and lapack #83888</link>, we are able to override the blas and lapack
packages to use different implementations, through the packages to use different implementations, through the
blasProvider and lapackProvider argument. This can be used blasProvider and lapackProvider argument. This can be used
to select a different provider. For example, an overlay can be to select a different provider. BLAS providers will have
created that looks like: symlinks in <literal>$out/lib/libblas.so.3</literal> and
<literal>$out/lib/libcblas.so.3</literal> to their respective
BLAS libraries. Likewise, LAPACK providers will have symlinks
in <literal>$out/lib/liblapack.so.3</literal> and
<literal>$out/lib/liblapacke.so.3</literal> to their respective
LAPCK libraries. For example, Intel MKL is both a BLAS and
LAPACK provider. An overlay can be created to use Intel MKL
that looks like:
</para> </para>
<programlisting> <programlisting>
self: super: self: super:
@ -208,9 +216,12 @@ self: super:
<para> <para>
This overlay uses Intels MKL library for both BLAS and LAPACK This overlay uses Intels MKL library for both BLAS and LAPACK
interfaces. Note that the same can be accomplished at runtime interfaces. Note that the same can be accomplished at runtime
using <literal>LD_PRELOAD</literal> of libblas.so.3 and using <literal>LD_LIBRARY_PATH</literal> of libblas.so.3 and
liblapack.so.3. liblapack.so.3. For instance:
</para> </para>
<programlisting>
$ LD_LIBRARY_PATH=$(nix-build -A mkl)/lib:$LD_LIBRARY_PATH nix-shell -p octave --run octave
</programlisting>
<para> <para>
Intel MKL requires an <literal>openmp</literal> implementation Intel MKL requires an <literal>openmp</literal> implementation
when running with multiple processors. By default, when running with multiple processors. By default,
@ -221,8 +232,8 @@ self: super:
set it with <literal>LD_PRELOAD</literal>. Note that set it with <literal>LD_PRELOAD</literal>. Note that
<literal>mkl</literal> is only available on <literal>mkl</literal> is only available on
<literal>x86_64-linux</literal> and <literal>x86_64-linux</literal> and
<literal>x86_64-darwin</literal>. Moreover, Hydra is not build <literal>x86_64-darwin</literal>. Moreover, Hydra is not
and distributing pre-compiled binaries using it. building and distributing pre-compiled binaries using it.
</para> </para>
<para> <para>
For BLAS/LAPACK switching to work correctly, all packages must For BLAS/LAPACK switching to work correctly, all packages must

View file

@ -63,7 +63,7 @@ stdenv.mkDerivation {
installPhase = ('' installPhase = (''
mkdir -p $out/lib $dev/include $dev/lib/pkgconfig mkdir -p $out/lib $dev/include $dev/lib/pkgconfig
libblas="${lib.getLib blasProvider}/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}" libblas="${lib.getLib blasProvider}/lib/libblas${canonicalExtension}"
if ! [ -e "$libblas" ]; then if ! [ -e "$libblas" ]; then
echo "$libblas does not exist, ${blasProvider.name} does not provide libblas." echo "$libblas does not exist, ${blasProvider.name} does not provide libblas."
@ -100,7 +100,7 @@ Libs: -L$out/lib -lblas
Cflags: -I$dev/include Cflags: -I$dev/include
EOF EOF
libcblas="${lib.getLib blasProvider}/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" libcblas="${lib.getLib blasProvider}/lib/libcblas${canonicalExtension}"
if ! [ -e "$libcblas" ]; then if ! [ -e "$libcblas" ]; then
echo "$libcblas does not exist, ${blasProvider.name} does not provide libcblas." echo "$libcblas does not exist, ${blasProvider.name} does not provide libcblas."

View file

@ -41,7 +41,7 @@ stdenv.mkDerivation {
installPhase = ('' installPhase = (''
mkdir -p $out/lib $dev/include $dev/lib/pkgconfig mkdir -p $out/lib $dev/include $dev/lib/pkgconfig
liblapack="${lib.getLib lapackProvider}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" liblapack="${lib.getLib lapackProvider}/lib/liblapack${canonicalExtension}"
if ! [ -e "$liblapack" ]; then if ! [ -e "$liblapack" ]; then
echo "$liblapack does not exist, ${lapackProvider.name} does not provide liblapack." echo "$liblapack does not exist, ${lapackProvider.name} does not provide liblapack."
@ -74,7 +74,7 @@ Cflags: -I$dev/include
Libs: -L$out/lib -llapack Libs: -L$out/lib -llapack
EOF EOF
liblapacke="${lib.getLib lapackProvider}/lib/liblapacke${stdenv.hostPlatform.extensions.sharedLibrary}" liblapacke="${lib.getLib lapackProvider}/lib/liblapacke${canonicalExtension}"
if ! [ -e "$liblapacke" ]; then if ! [ -e "$liblapacke" ]; then
echo "$liblapacke does not exist, ${lapackProvider.name} does not provide liblapacke." echo "$liblapacke does not exist, ${lapackProvider.name} does not provide liblapacke."

View file

@ -114,10 +114,10 @@ in stdenvNoCC.mkDerivation {
'') + '' '') + ''
# Setup symlinks for blas / lapack # Setup symlinks for blas / lapack
ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/libblas${stdenvNoCC.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/libblas${stdenvNoCC.hostPlatform.extensions.sharedLibrary}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"}
ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/libcblas${stdenvNoCC.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/libcblas${stdenvNoCC.hostPlatform.extensions.sharedLibrary}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"}
ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/liblapack${stdenvNoCC.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/liblapack${stdenvNoCC.hostPlatform.extensions.sharedLibrary}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"}
ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/liblapacke${stdenvNoCC.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libmkl_rt${stdenvNoCC.hostPlatform.extensions.sharedLibrary} $out/lib/liblapacke${stdenvNoCC.hostPlatform.extensions.sharedLibrary}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"}
''; '';
# fixDarwinDylibName fails for libmkl_cdft_core.dylib because the # fixDarwinDylibName fails for libmkl_cdft_core.dylib because the

View file

@ -178,10 +178,10 @@ EOF
done done
# Setup symlinks for blas / lapack # Setup symlinks for blas / lapack
ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"}
ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"}
ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"}
ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/liblapacke${stdenv.hostPlatform.extensions.sharedLibrary} ln -s $out/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/liblapacke${stdenv.hostPlatform.extensions.sharedLibrary}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"}
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View file

@ -53,6 +53,8 @@ in buildPythonPackage rec {
setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
SCIPY_USE_G77_ABI_WRAPPER = 1;
meta = { meta = {
description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. "; description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. ";
homepage = "https://www.scipy.org/"; homepage = "https://www.scipy.org/";