bscpkgs/pkgs/amd_blis/default.nix

70 lines
1.5 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
perl,
python3,
# Enable BLAS interface with 64-bit integer width.
blasIntSize ? "64",
# Target architecture. "auto" lets the script decide for itself.
# For fox, "zen4" should be used.
withArchitecture ? "auto",
# Enable OpenMP-based threading.
withOpenMP ? true,
# TODO: Use tag of last release insted of commit
gitUrl ? "https://github.com/amd/blis.git",
gitBranch ? "master",
gitCommit ? "16f852a065e76e824d77bc39e2baa82ac19ed419"
}:
assert lib.assertOneOf "blasIntSize" blasIntSize ["32" "64"];
let
threadingSuffix = lib.optionalString withOpenMP "-mt";
git = rec {
version = src.shortRev;
src = builtins.fetchGit {
url = gitUrl;
ref = gitBranch;
rev = gitCommit;
};
};
in
stdenv.mkDerivation rec {
pname = "blis";
inherit (git) src version;
nativeBuildInputs = [
perl
python3
];
doCheck = false;
enableParallelBuilding = true;
configureFlags = [
"--enable-cblas"
"--blas-int-size=${blasIntSize}"
]
++ lib.optionals withOpenMP [ "--enable-threading=openmp" ]
++ [ withArchitecture ];
postPatch = ''
patchShebangs configure build/flatten-headers.py
'';
postInstall = ''
ls $out/lib
ln -s $out/lib/libblis${threadingSuffix}.so $out/lib/libblas.so.3
ln -s $out/lib/libblis${threadingSuffix}.so $out/lib/libcblas.so.3
ln -s $out/lib/libblas.so.3 $out/lib/libblas.so
ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
'';
}