openblas: build with native-width integers by default

This commit is contained in:
Thomas Tuegel
2015-06-04 17:42:01 -05:00
parent 14ee766024
commit 86fb034008
@@ -1,24 +1,24 @@
{ stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils }: { stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils
# Most packages depending on openblas expect integer width to match pointer width,
# but some expect to use 32-bit integers always (for compatibility with reference BLAS).
, blas64 ? null
}:
with stdenv.lib; with stdenv.lib;
let local = config.openblas.preferLocalBuild or false; let local = config.openblas.preferLocalBuild or false;
binary = binary =
{ { i686-linux = "32";
i686-linux = "32";
x86_64-linux = "64"; x86_64-linux = "64";
x86_64-darwin = "64"; x86_64-darwin = "64";
}."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
genericFlags = genericFlags =
[ [ "DYNAMIC_ARCH=1"
"DYNAMIC_ARCH=1"
"NUM_THREADS=64"
"BINARY=${binary}"
"USE_OPENMP=1"
"NUM_THREADS=64" "NUM_THREADS=64"
]; ];
localFlags = config.openblas.flags or localFlags = config.openblas.flags or
optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ]; optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ];
blas64Orig = blas64;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "0.2.14"; version = "0.2.14";
@@ -45,9 +45,13 @@ stdenv.mkDerivation rec {
# thus is not an explicit dependency. # thus is not an explicit dependency.
"CC=${if stdenv.isDarwin then "clang" else "gcc"}" "CC=${if stdenv.isDarwin then "clang" else "gcc"}"
''PREFIX="''$(out)"'' ''PREFIX="''$(out)"''
"INTERFACE64=1" "BINARY=${binary}"
"USE_OPENMP=1"
"INTERFACE64=${if blas64 then "1" else "0"}"
]; ];
blas64 = if blas64Orig != null then blas64Orig else hasPrefix "x86_64" stdenv.system;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Basic Linear Algebra Subprograms"; description = "Basic Linear Algebra Subprograms";
license = licenses.bsd3; license = licenses.bsd3;