nixpkgs/pkgs/by-name/am/amd-blis/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

75 lines
1.8 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
perl,
python3,
# Enable BLAS interface with 64-bit integer width.
blas64 ? false,
# Target architecture. "amdzen" compiles kernels for all Zen
# generations. To build kernels for specific Zen generations,
# use "zen", "zen2", "zen3", or "zen4".
withArchitecture ? "amdzen",
# Enable OpenMP-based threading.
withOpenMP ? true,
}:
let
threadingSuffix = lib.optionalString withOpenMP "-mt";
blasIntSize = if blas64 then "64" else "32";
in
stdenv.mkDerivation rec {
pname = "amd-blis";
version = "5.0";
src = fetchFromGitHub {
owner = "amd";
repo = "blis";
rev = version;
hash = "sha256-E6JmV4W0plFJfOAPK1Vn7qkmFalwl6OjqSpxYnhAPmw=";
};
inherit blas64;
nativeBuildInputs = [
perl
python3
];
# Tests currently fail with non-Zen CPUs due to a floating point
# exception in one of the generic kernels. Try to re-enable the
# next release.
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
'';
meta = with lib; {
description = "BLAS-compatible library optimized for AMD CPUs";
homepage = "https://developer.amd.com/amd-aocl/blas-library/";
license = licenses.bsd3;
maintainers = [ maintainers.markuskowa ];
platforms = [ "x86_64-linux" ];
};
}