summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-04-21 11:03:10 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-04-21 11:03:10 -0500
commit3c41d61514029d5aa4ea748c1e46098767ae448b (patch)
tree8830180c68f0dc03a7dd03bf982cdcbce89ee868 /doc
parent8f58fa044dca8becdc865c2feb51e5048bf14fef (diff)
downloadnixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar.gz
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar.bz2
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar.lz
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar.xz
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.tar.zst
nixpkgs-3c41d61514029d5aa4ea748c1e46098767ae448b.zip
doc/overlays.xml: update documentation for BLAS/LAPACK
This expands the documentation and explains how to assert LP64.
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/python.section.md29
-rw-r--r--doc/using/overlays.xml40
2 files changed, 42 insertions, 27 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md
index f8884785e90..e6f0b64fa9c 100644
--- a/doc/languages-frameworks/python.section.md
+++ b/doc/languages-frameworks/python.section.md
@@ -1290,32 +1290,9 @@ self: super: {
 
 ### How to use Intel's MKL with numpy and scipy?
 
-A `site.cfg` is created that configures BLAS based on the `blas` parameter of
-the `numpy` derivation. By passing in `mkl`, `numpy` and packages depending on
-`numpy` will be built with `mkl`.
-
-The following is an overlay that configures `numpy` to use `mkl`:
-
-```nix
-self: super: {
-  python37 = super.python37.override {
-    packageOverrides = python-self: python-super: {
-      numpy = python-super.numpy.override {
-        blas = super.pkgs.mkl;
-      };
-    };
-  };
-}
-```
-
-`mkl` requires an `openmp` implementation when running with multiple processors.
-By default, `mkl` will use Intel's `iomp` implementation if no other is
-specified, but this is a runtime-only dependency and binary compatible with the
-LLVM implementation. To use that one instead, Intel recommends users set it with
-`LD_PRELOAD`.
-
-Note that `mkl` is only available on `x86_64-{linux,darwin}` platforms;
-moreover, Hydra is not building and distributing pre-compiled binaries using it.
+MKL can be configured using an overlay. See the section “[Using
+overlays to configure
+alternatives](#sec-overlays-alternatives-blas-lapack)”.
 
 ### What inputs do `setup_requires`, `install_requires` and `tests_require` map to?
 
diff --git a/doc/using/overlays.xml b/doc/using/overlays.xml
index 7732e0ac217..5f808839dd0 100644
--- a/doc/using/overlays.xml
+++ b/doc/using/overlays.xml
@@ -177,7 +177,7 @@ self: super:
          <para>
            <link
            xlink:href="https://software.intel.com/en-us/mkl">Intel
-           MKL</link> (only works on x86 architecture)
+           MKL</link> (only works on x86 architecture, unfree)
          </para>
          <para>
            The Nixpkgs attribute is <literal>mkl</literal>.
@@ -211,6 +211,44 @@ self: super:
        using <literal>LD_PRELOAD</literal> of libblas.so.3 and
        liblapack.so.3.
      </para>
+     <para>
+       Intel MKL requires an <literal>openmp</literal> implementation
+       when running with multiple processors. By default,
+       <literal>mkl</literal> will use Intel’s <literal>iomp</literal>
+       implementation if no other is specified, but this is a
+       runtime-only dependency and binary compatible with the LLVM
+       implementation. To use that one instead, Intel recommends users
+       set it with <literal>LD_PRELOAD</literal>. Note that
+       <literal>mkl</literal> is only available on
+       <literal>x86_64-linux</literal> and
+       <literal>x86_64-darwin</literal>. Moreover, Hydra is not build
+       and distributing pre-compiled binaries using it.
+     </para>
+     <para>
+       For BLAS/LAPACK switching to work correctly, all packages must
+       depend on <literal>blas</literal> or <literal>lapack</literal>.
+       This ensures that only one BLAS/LAPACK library is used at one
+       time. There are two versions versions of BLAS/LAPACK currently
+       in the wild, <literal>LP64</literal> (integer size = 32 bits)
+       and <literal>ILP64</literal> (integer size = 64 bits). Some
+       software needs special flags or patches to work with
+       <literal>ILP64</literal>. You can check if
+       <literal>ILP64</literal> is used in Nixpkgs with
+       <varname>blas.isILP64</varname> and
+       <varname>lapack.isILP64</varname>. Some software does NOT work
+       with <literal>ILP64</literal>, and derivations need to specify
+       an assertion to prevent this. You can prevent
+       <literal>ILP64</literal> from being used with the following:
+     </para>
+     <programlisting>
+{ stdenv, blas, lapack, ... }:
+
+assert (!blas.isILP64) &amp;&amp; (!lapack.isILP64);
+
+stdenv.mkDerivation {
+  ...
+}
+     </programlisting>
    </section>
  </section>
 </chapter>