Add blis package

This commit is contained in:
Vincent A. Arcila 2025-09-26 11:56:59 +02:00
parent c7b5ec13b8
commit af955ca345

65
pkgs/blis/default.nix Normal file
View File

@ -0,0 +1,65 @@
{
lib,
stdenv,
fetchFromGitHub,
perl,
python3,
# Enable BLAS interface with 64-bit integer width.
blasIntSize ? "64",
# Target architecture. x86_64 builds Intel and AMD kernels.
withArchitecture ? "x86_64",
# 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
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" ]
++ [ "auto" ];
postPatch = ''
patchShebangs configure build/flatten-headers.py
'';
postInstall = ''
ln -s $out/lib/libblis.so.4 $out/lib/libblas.so.3
ln -s $out/lib/libblis.so.4 $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
'';
}