From af955ca3451475608e1af6d01af92ccbdb6f8162 Mon Sep 17 00:00:00 2001 From: "Vincent A. Arcila" Date: Fri, 26 Sep 2025 11:56:59 +0200 Subject: [PATCH] Add blis package --- pkgs/blis/default.nix | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pkgs/blis/default.nix diff --git a/pkgs/blis/default.nix b/pkgs/blis/default.nix new file mode 100644 index 0000000..2a481bd --- /dev/null +++ b/pkgs/blis/default.nix @@ -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 + ''; + } +