diff --git a/doc/using/overlays.xml b/doc/using/overlays.xml index 5f808839dd0..3fa68e32a3c 100644 --- a/doc/using/overlays.xml +++ b/doc/using/overlays.xml @@ -140,8 +140,8 @@ self: super:
Using overlays to configure alternatives - Certain software has different implementations of the same - interface. Other distributions have functionality to switch + Certain software packages have different implementations of the + same interface. Other distributions have functionality to switch between these. For example, Debian provides DebianAlternatives. Nixpkgs has what we call alternatives, which @@ -160,8 +160,9 @@ self: super: The Nixpkgs attribute is openblas for - ILP64 and openblasCompat for LP64. This - is the default. + ILP64 (integer width = 64 bits) and + openblasCompat for LP64 (integer width = + 32 bits). openblasCompat is the default. @@ -190,8 +191,15 @@ self: super: #83888, we are able to override the ‘blas’ and ‘lapack’ packages to use different implementations, through the ‘blasProvider’ and ‘lapackProvider’ argument. This can be used - to select a different provider. For example, an overlay can be - created that looks like: + to select a different provider. BLAS providers will have + symlinks in $out/lib/libblas.so.3 and + $out/lib/libcblas.so.3 to their respective + BLAS libraries. Likewise, LAPACK providers will have symlinks + in $out/lib/liblapack.so.3 and + $out/lib/liblapacke.so.3 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: self: super: @@ -208,9 +216,12 @@ self: super: This overlay uses Intel’s MKL library for both BLAS and LAPACK interfaces. Note that the same can be accomplished at runtime - using LD_PRELOAD of libblas.so.3 and - liblapack.so.3. + using LD_LIBRARY_PATH of libblas.so.3 and + liblapack.so.3. For instance: + +$ LD_LIBRARY_PATH=$(nix-build -A mkl)/lib:$LD_LIBRARY_PATH nix-shell -p octave --run octave + Intel MKL requires an openmp implementation when running with multiple processors. By default, @@ -221,8 +232,8 @@ self: super: set it with LD_PRELOAD. Note that mkl is only available on x86_64-linux and - x86_64-darwin. Moreover, Hydra is not build - and distributing pre-compiled binaries using it. + x86_64-darwin. Moreover, Hydra is not + building and distributing pre-compiled binaries using it. For BLAS/LAPACK switching to work correctly, all packages must diff --git a/pkgs/build-support/alternatives/blas/default.nix b/pkgs/build-support/alternatives/blas/default.nix index 8bba49b4550..bdee6688a74 100644 --- a/pkgs/build-support/alternatives/blas/default.nix +++ b/pkgs/build-support/alternatives/blas/default.nix @@ -63,7 +63,7 @@ stdenv.mkDerivation { installPhase = ('' 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 echo "$libblas does not exist, ${blasProvider.name} does not provide libblas." @@ -100,7 +100,7 @@ Libs: -L$out/lib -lblas Cflags: -I$dev/include EOF - libcblas="${lib.getLib blasProvider}/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" + libcblas="${lib.getLib blasProvider}/lib/libcblas${canonicalExtension}" if ! [ -e "$libcblas" ]; then echo "$libcblas does not exist, ${blasProvider.name} does not provide libcblas." diff --git a/pkgs/build-support/alternatives/lapack/default.nix b/pkgs/build-support/alternatives/lapack/default.nix index e260ad1bd93..5a19916f83e 100644 --- a/pkgs/build-support/alternatives/lapack/default.nix +++ b/pkgs/build-support/alternatives/lapack/default.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation { installPhase = ('' 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 echo "$liblapack does not exist, ${lapackProvider.name} does not provide liblapack." @@ -74,7 +74,7 @@ Cflags: -I$dev/include Libs: -L$out/lib -llapack EOF - liblapacke="${lib.getLib lapackProvider}/lib/liblapacke${stdenv.hostPlatform.extensions.sharedLibrary}" + liblapacke="${lib.getLib lapackProvider}/lib/liblapacke${canonicalExtension}" if ! [ -e "$liblapacke" ]; then echo "$liblapacke does not exist, ${lapackProvider.name} does not provide liblapacke." diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix index f9026ec7b99..ee861c14ab4 100644 --- a/pkgs/development/libraries/science/math/mkl/default.nix +++ b/pkgs/development/libraries/science/math/mkl/default.nix @@ -114,10 +114,10 @@ in stdenvNoCC.mkDerivation { '') + '' # 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/libcblas${stdenvNoCC.hostPlatform.extensions.sharedLibrary} - 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/liblapacke${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}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"} + 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}${stdenvNoCC.lib.optionalString stdenvNoCC.hostPlatform.isLinux ".3"} ''; # fixDarwinDylibName fails for libmkl_cdft_core.dylib because the diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index c55a5cb7878..f6a40204587 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -178,10 +178,10 @@ EOF done # 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/libcblas${stdenv.hostPlatform.extensions.sharedLibrary} - 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/liblapacke${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}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"} + 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}${stdenv.lib.optionalString stdenv.hostPlatform.isLinux ".3"} ''; meta = with stdenv.lib; { diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix index a9947e7e689..ace6c248ab2 100644 --- a/pkgs/development/python-modules/scipy/default.nix +++ b/pkgs/development/python-modules/scipy/default.nix @@ -53,6 +53,8 @@ in buildPythonPackage rec { setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; + SCIPY_USE_G77_ABI_WRAPPER = 1; + meta = { description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. "; homepage = "https://www.scipy.org/";