Skip to content

Commit

Permalink
openblas: Add singleThreaded option. Off by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
nh2 committed Apr 8, 2020
1 parent 3b65398 commit df907c4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkgs/development/libraries/science/math/openblas/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# pointer width, but some expect to use 32-bit integers always
# (for compatibility with reference BLAS).
, blas64 ? null
# Multi-threaded applications must not call a threaded OpenBLAS
# (the only exception is when an application uses OpenMP as its
# *only* form of multi-threading). See
# https://github.com/xianyi/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded
# https://github.com/xianyi/OpenBLAS/issues/2543
# This flag builds a single-threaded OpenBLAS using the flags
# stated in thre.
, singleThreaded ? false
, buildPackages
# Select a specific optimization target (other than the default)
# See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
Expand Down Expand Up @@ -146,7 +154,12 @@ stdenv.mkDerivation rec {
NO_BINARY_MODE = if stdenv.isx86_64
then toString (stdenv.hostPlatform != stdenv.buildPlatform)
else stdenv.hostPlatform != stdenv.buildPlatform;
});
} // (stdenv.lib.optionalAttrs singleThreaded {
# As described on https://github.com/xianyi/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded
USE_THREAD = false;
USE_LOCKING = true; # available with openblas >= 0.3.7
USE_OPENMP = false; # openblas will refuse building with both USE_OPENMP=1 and USE_THREAD=0
}));

doCheck = true;
checkTarget = "tests";
Expand Down

0 comments on commit df907c4

Please sign in to comment.