diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
commit | 99fcaeccb89621dd492203ce1f2d551c06f228ed (patch) | |
tree | 41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/libraries/science | |
parent | 59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff) | |
parent | 75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff) | |
download | nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2 nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/nixos/modules/config/console.nix nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/nixos/modules/services/mail/rss2email.nix nixpkgs/nixos/modules/services/networking/ssh/sshd.nix nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix nixpkgs/pkgs/applications/networking/irc/weechat/default.nix nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/interpreters/python/default.nix nixpkgs/pkgs/development/node-packages/overrides.nix nixpkgs/pkgs/development/tools/b4/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix nixpkgs/pkgs/servers/mail/public-inbox/default.nix nixpkgs/pkgs/tools/security/pinentry/default.nix nixpkgs/pkgs/tools/text/unoconv/default.nix nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science')
86 files changed, 2420 insertions, 698 deletions
diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix index e7e8dd04b071..8a6b72f52130 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "cfitsio"; - version = "4.1.0"; + version = "4.2.0"; src = fetchurl { url = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${version}.tar.gz"; - sha256 = "sha256-s2fGldKDGVjnFmkhw7NW1d+lGx7O5QW5dBa6OdG2wXo="; + sha256 = "sha256-66U9Gz9uNFYyuwmnt1LsfO09Y+xRU6hIOA84gMXWGIk="; }; buildInputs = [ bzip2 zlib ]; diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix index d0cf27bef5bd..cf722af9cbe1 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix @@ -6,6 +6,7 @@ , libusb1 , zlib , boost +, libev , libnova , curl , libjpeg @@ -15,13 +16,13 @@ stdenv.mkDerivation rec { pname = "indilib"; - version = "1.9.5"; + version = "1.9.8"; src = fetchFromGitHub { owner = "indilib"; repo = "indi"; rev = "v${version}"; - sha256 = "sha256-mj9rnPn85Fbc7Y8qRndqPVANzBrk3al+vDJagLTDJ04="; + sha256 = "sha256-+KFuZgM/Bl6Oezq3WXjWCHefc1wvR3wOKXejmT0pw1U="; }; nativeBuildInputs = [ @@ -31,6 +32,7 @@ stdenv.mkDerivation rec { buildInputs = [ curl cfitsio + libev libusb1 zlib boost @@ -51,6 +53,8 @@ stdenv.mkDerivation rec { changelog = "https://github.com/indilib/indi/releases/tag/v${version}"; license = licenses.lgpl2Plus; maintainers = with maintainers; [ hjones2199 ]; - platforms = platforms.linux; + platforms = platforms.unix; + # error: use of undeclared identifier 'MSG_NOSIGNAL' + broken = stdenv.isDarwin && stdenv.isx86_64; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix index c4faadd2a5eb..7144a17c18b4 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix @@ -48,6 +48,8 @@ stdenv.mkDerivation rec { --replace "/etc/udev/rules.d" "lib/udev/rules.d" \ --replace "/lib/firmware" "lib/firmware" done + + sed '1i#include <ctime>' -i indi-duino/libfirmata/src/firmata.cpp # gcc12 ''; cmakeFlags = [ diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix index d23673ac37ae..660433c2dd59 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix @@ -45,7 +45,7 @@ stdenv.mkDerivation rec { ]; postPatch = '' - for f in libfishcamp/CMakeLists.txt libsbig/CMakeLists.txt + for f in {libfishcamp,libsbig,libqhy}/CMakeLists.txt do substituteInPlace $f --replace "/lib/firmware" "lib/firmware" done diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix index a20c92dfaeba..fae8b95cb28c 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix @@ -1,12 +1,12 @@ { stdenv, lib, callPackage, fetchFromGitHub, indilib }: let - indi-version = "1.9.3"; + indi-version = "1.9.8"; indi-3rdparty-src = fetchFromGitHub { owner = "indilib"; repo = "indi-3rdparty"; rev = "v${indi-version}"; - sha256 = "sha256-TBccdheBEO48uIXd6tya6dytkzxaHg2+YancBkcL3bw="; + sha256 = "sha256-ZFbMyjMvAWcdsl+1TyX5/v5nY1DqvhZ2ckFBDe8gdQg="; }; indi-firmware = callPackage ./indi-firmware.nix { version = indi-version; diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix new file mode 100644 index 000000000000..e7e4bc98b0d8 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix @@ -0,0 +1,47 @@ +{ lib +, stdenv +, fetchFromGitea +, cmake +, pkg-config +, lz4 +, pugixml +, zlib +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "libxisf"; + version = "0.2.3"; + + src = fetchFromGitea { + domain = "gitea.nouspiro.space"; + owner = "nou"; + repo = "libXISF"; + rev = "v${finalAttrs.version}"; + hash = "sha256-u5EYnRO2rUV8ofLL9qfACeVvVbWXEXpkqh2Q4OOxpaQ="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + cmakeFlags = [ + "-DUSE_BUNDLED_LIBS=OFF" + ] ++ lib.optional stdenv.hostPlatform.isStatic "-DBUILD_SHARED_LIBS=OFF"; + + buildInputs = [ + lz4 + pugixml + zlib + ]; + + doCheck = true; + + meta = with lib; { + description = "Library to load and write XISF format from PixInsight"; + homepage = "https://gitea.nouspiro.space/nou/libXISF"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ panicgh ]; + platforms = platforms.linux; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix index 2b2cade6fbba..bea05468cedc 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "wcslib"; - version = "7.9"; + version = "7.12"; src = fetchurl { url = "ftp://ftp.atnf.csiro.au/pub/software/wcslib/${pname}-${version}.tar.bz2"; - sha256 = "sha256-vv+MHw6GAAeIE8Ay0a/NnLMFwx9WdWdDSCQjPVgqulg="; + sha256 = "sha256-nPjeUOEJqX+gRRHUER6NFL0KRAdxMqz3PmzwAp/pa9Q="; }; nativeBuildInputs = [ flex ]; diff --git a/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix b/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix index d4610d60415b..7e022bafbb40 100644 --- a/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix @@ -3,12 +3,12 @@ }: stdenv.mkDerivation rec { - version = "6.0.0.1"; + version = "7.0.1"; pname = "papi"; src = fetchurl { url = "https://bitbucket.org/icl/papi/get/papi-${lib.replaceStrings ["."] ["-"] version}-t.tar.gz"; - sha256 = "1jd67yadyffzxwsqlylsi0bx8ishb0cgj2ziz1wdslaz6ylvyf9j"; + sha256 = "sha256-VajhmPW8sEJksfhLjBVlpBH7+AZr4fwKZPAtZxRF1Bk="; }; setSourceRoot = '' diff --git a/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix index 2a832fc7c37a..7a6122fbc8db 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix @@ -11,6 +11,12 @@ stdenv.mkDerivation rec { sha256 = "1a1qw6i47fs1izx60l1ysabpmyx9j5sjnbdv8b47wi2xcc9i3hpq"; }; + # error: use of undeclared identifier 'finite'; did you mean 'isfinite'? + postPatch = '' + substituteInPlace templates/EBTKS/SimpleArray.h \ + --replace "#define FINITE(x) finite(x)" "#define FINITE(x) isfinite(x)" + ''; + nativeBuildInputs = [ cmake ]; buildInputs = [ libminc ]; diff --git a/nixpkgs/pkgs/development/libraries/science/biology/ciftilib/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/ciftilib/default.nix index 797607ed8f54..85b0b1c8a0e5 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/ciftilib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/ciftilib/default.nix @@ -24,13 +24,16 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'big|datatype-md5'" ]; + # error: no member named 'file_string' in 'boost::filesystem::path' + env.NIX_CFLAGS_COMPILE = "-UCIFTILIB_BOOST_NO_FSV3"; + doCheck = true; meta = with lib; { homepage = "https://github.com/Washington-University/CiftiLib"; description = "Library for reading and writing CIFTI files"; maintainers = with maintainers; [ bcdarwin ]; - platforms = platforms.linux; + platforms = platforms.unix; license = licenses.bsd2; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/biology/edlib/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/edlib/default.nix new file mode 100644 index 000000000000..b8ea4a55291a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/biology/edlib/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "edlib"; + version = "unstable-2021-08-20"; + + src = fetchFromGitHub { + owner = "Martinsos"; + repo = pname; + rev = "f8afceb49ab0095c852e0b8b488ae2c88e566afd"; + hash = "sha256-P/tFbvPBtA0MYCNDabW+Ypo3ltwP4S+6lRDxwAZ1JFo="; + }; + + nativeBuildInputs = [ cmake ]; + + doCheck = true; + checkPhase = '' + runHook preCheck + bin/runTests + runHook postCheck + ''; + + meta = with lib; { + homepage = "https://martinsos.github.io/edlib"; + description = "Lightweight, fast C/C++ library for sequence alignment using edit distance"; + maintainers = with maintainers; [ bcdarwin ]; + license = licenses.mit; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix index 84762414fef9..0344559f8a8f 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix @@ -1,25 +1,17 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, itk, python3, Cocoa }: +{ lib, stdenv, fetchFromGitHub, cmake, itk, Cocoa }: stdenv.mkDerivation rec { pname = "elastix"; - version = "5.0.1"; + version = "5.1.0"; src = fetchFromGitHub { - owner = "SuperElastix"; - repo = pname; - rev = version; - sha256 = "1mx8kkak2d3ibfrxrh8jkmh2zkdlgl9h578wiw3617zcwaa97bxw"; + owner = "SuperElastix"; + repo = pname; + rev = version; + hash = "sha256-wFeLU8IwiF43a9TAvecQG+QMw88PQZdJ8sI1Zz3ZeXc="; }; - patches = [ - (fetchpatch { - name = "install-executables.patch"; # https://github.com/SuperElastix/elastix/issues/305 - url = "https://github.com/SuperElastix/elastix/commit/8e26cdc0d66f6030c7be085fdc424d84d4fc7546.patch"; - sha256 = "12y9wbpi9jlarnw6fk4iby97jxvx5g4daq9zqblbcmn51r134bj5"; - }) - ]; - - nativeBuildInputs = [ cmake python3 ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ itk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ]; doCheck = !stdenv.isDarwin; # usual dynamic linker issues diff --git a/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix index 2e3f9dec3194..a3b35d55c9e8 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "htslib"; - version = "1.15"; + version = "1.17"; src = fetchurl { url = "https://github.com/samtools/htslib/releases/download/${version}/${pname}-${version}.tar.bz2"; - sha256 = "sha256-Gp9JkRUDoi9WgXzILqm4f7fnRntf+YnKWqYcEufVMtk="; + sha256 = "sha256-djd5KIxA8HZG7HrZi5bDeMc5Fx0WKtmDmIaHg7chg58"; }; # perl is only used during the check phase. diff --git a/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix index d2615b391ffc..de419dc3d575 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python3, vtk, zlib, tbb }: +{ lib, stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python3, vtk_8, zlib, tbb }: stdenv.mkDerivation rec { version = "2.0.0"; @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ cmake gtest ]; - buildInputs = [ boost eigen python3 vtk zlib tbb ]; + buildInputs = [ boost eigen python3 vtk_8 zlib tbb ]; meta = with lib; { homepage = "https://github.com/BioMedIA/MIRTK"; diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/avogadrolibs/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/avogadrolibs/default.nix index b7f5f5f6d90e..e23fba7fb0eb 100644 --- a/nixpkgs/pkgs/development/libraries/science/chemistry/avogadrolibs/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/avogadrolibs/default.nix @@ -21,13 +21,13 @@ let in stdenv.mkDerivation rec { pname = "avogadrolibs"; - version = "1.95.1"; + version = "1.97.0"; src = fetchFromGitHub { owner = "OpenChemistry"; repo = pname; rev = version; - sha256 = "0zzVg8xNqFwDrK8gRkDm3tRgBt7fD4K3Uy/ajUBc+eQ="; + hash = "sha256-ZGFyUlFyI403aw/6GVze/gronT67XlEOKuw5sfHeVy8="; }; postUnpack = '' diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/dftd4/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/dftd4/default.nix new file mode 100644 index 000000000000..c9f00fa72ee6 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/dftd4/default.nix @@ -0,0 +1,47 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, gfortran +, blas +, lapack +, mctc-lib +, mstore +, multicharge +}: + +assert !blas.isILP64 && !lapack.isILP64; + +stdenv.mkDerivation rec { + pname = "dftd4"; + version = "3.5.0"; + + src = fetchFromGitHub { + owner = "dftd4"; + repo = pname; + rev = "v${version}"; + hash = "sha256-ZCoFbjTNQD7slq5sKwPRPkrHSHofsxU9C9h/bF5jmZI="; + }; + + nativeBuildInputs = [ cmake gfortran ]; + + buildInputs = [ blas lapack mctc-lib mstore multicharge ]; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/${pname}.pc \ + --replace "''${prefix}/" "" + ''; + + doCheck = true; + preCheck = '' + export OMP_NUM_THREADS=2 + ''; + + meta = with lib; { + description = "Generally Applicable Atomic-Charge Dependent London Dispersion Correction"; + license = with licenses; [ lgpl3Plus gpl3Plus ]; + homepage = "https://github.com/grimme-lab/dftd4"; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/harminv/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/harminv/default.nix new file mode 100644 index 000000000000..54c0d03979ab --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/harminv/default.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, gfortran +, blas +, lapack +}: + +assert !blas.isILP64; +assert !lapack.isILP64; + +stdenv.mkDerivation rec { + pname = "harminv"; + version = "1.4.2"; + + src = fetchFromGitHub { + owner = "NanoComp"; + repo = pname; + rev = "v${version}"; + hash = "sha256-EXEt7l69etcBdDdEDlD1ODOdhTBZCVjgY1jhRUDd/W0="; + }; + + # File is missing in the git checkout but required by autotools + postPatch = '' + touch ChangeLog + ''; + + nativeBuildInputs = [ autoreconfHook gfortran ]; + + buildInputs = [ blas lapack ]; + + configureFlags = [ "--enable-shared" ]; + + meta = with lib; { + description = "Harmonic inversion algorithm of Mandelshtam: decompose signal into sum of decaying sinusoids"; + homepage = "https://github.com/NanoComp/harminv"; + license = with licenses; [ gpl2Only ]; + maintainers = with maintainers; [ sheepforce markuskowa ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/libGDSII/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/libGDSII/default.nix new file mode 100644 index 000000000000..c3257bad3e26 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/libGDSII/default.nix @@ -0,0 +1,32 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +}: + +stdenv.mkDerivation rec { + pname = "libGDSII"; + version = "0.21"; + + src = fetchFromGitHub { + owner = "HomerReid"; + repo = pname; + rev = "v${version}"; + hash = "sha256-EXEt7l69etcBdDdEDlD1ODOdhTBZCVjgY1jhRUDd/W0="; + }; + + # File is missing in the repo but automake requires it + postPatch = '' + touch ChangeLog + ''; + + nativeBuildInputs = [ autoreconfHook ]; + + meta = with lib; { + description = "Library and command-line utility for reading GDSII geometry files"; + homepage = "https://github.com/HomerReid/libGDSII"; + license = [ licenses.gpl2Only ]; + maintainers = with maintainers; [ sheepforce markuskowa ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix new file mode 100644 index 000000000000..f90cad4a099f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix @@ -0,0 +1,52 @@ +{ stdenv +, lib +, fetchFromGitLab +, gfortran +, autoreconfHook +, fftwMpi +, mpi +}: + +stdenv.mkDerivation rec { + pname = "libvdwxc"; + # Stable version has non-working MPI detection. + version = "unstable-24.02.2020"; + + src = fetchFromGitLab { + owner = "libvdwxc"; + repo = pname; + rev = "92f4910c6ac88e111db2fb3a518089d0510c53b0"; + sha256 = "1c7pjrvifncbdyngs2bv185imxbcbq64nka8gshhp8n2ns6fids6"; + }; + + nativeBuildInputs = [ autoreconfHook gfortran ]; + + propagatedBuildInputs = [ mpi fftwMpi ]; + + preConfigure = '' + mkdir build && cd build + + export PATH=$PATH:${mpi}/bin + configureFlagsArray+=( + --with-mpi=${mpi} + CC=mpicc + FC=mpif90 + MPICC=mpicc + MPIFC=mpif90 + ) + ''; + + configureScript = "../configure"; + + hardeningDisable = [ "format" ]; + + doCheck = true; + + meta = with lib; { + description = "Portable C library of density functionals with van der Waals interactions for density functional theory"; + license = with licenses; [ lgpl3Plus bsd3 ]; + homepage = "https://libvdwxc.org/"; + platforms = platforms.unix; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix new file mode 100644 index 000000000000..aeb7c8bb6f56 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix @@ -0,0 +1,39 @@ +{ stdenv +, lib +, fetchFromGitHub +, gfortran +, pkg-config +, json-fortran +, cmake +}: + +stdenv.mkDerivation rec { + pname = "mctc-lib"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "grimme-lab"; + repo = pname; + rev = "v${version}"; + hash = "sha256-AXjg/ZsitdDf9fNoGVmVal1iZ4/sxjJb7A9W4yye/rg="; + }; + + nativeBuildInputs = [ gfortran pkg-config cmake ]; + + buildInputs = [ json-fortran ]; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/${pname}.pc \ + --replace "''${prefix}/" "" + ''; + + doCheck = true; + + meta = with lib; { + description = "Modular computation tool chain library"; + homepage = "https://github.com/grimme-lab/mctc-lib"; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/mstore/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/mstore/default.nix new file mode 100644 index 000000000000..86e03df16b0e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/mstore/default.nix @@ -0,0 +1,36 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, gfortran +, mctc-lib +}: + +stdenv.mkDerivation rec { + pname = "mstore"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "grimme-lab"; + repo = pname; + rev = "v${version}"; + hash = "sha256-dN2BulLS/ENRFVdJIrZRxgBV8S4d5+7BjTCGnhBbf4I="; + }; + + nativeBuildInputs = [ cmake gfortran ]; + + buildInputs = [ mctc-lib ]; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/${pname}.pc \ + --replace "''${prefix}/" "" + ''; + + meta = with lib; { + description = "Molecular structure store for testing"; + license = licenses.asl20; + homepage = "https://github.com/grimme-lab/mstore"; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/multicharge/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/multicharge/default.nix new file mode 100644 index 000000000000..f61f11225f1b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/multicharge/default.nix @@ -0,0 +1,46 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, gfortran +, blas +, lapack +, mctc-lib +, mstore +}: + +assert !blas.isILP64 && !lapack.isILP64; + +stdenv.mkDerivation rec { + pname = "multicharge"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "grimme-lab"; + repo = pname; + rev = "v${version}"; + hash = "sha256-oUI5x5/Gd0EZBb1w+0jlJUF9X51FnkHFu8H7KctqXl0="; + }; + + nativeBuildInputs = [ cmake gfortran ]; + + buildInputs = [ blas lapack mctc-lib mstore ]; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/${pname}.pc \ + --replace "''${prefix}/" "" + ''; + + doCheck = true; + preCheck = '' + export OMP_NUM_THREADS=2 + ''; + + meta = with lib; { + description = "Electronegativity equilibration model for atomic partial charges"; + license = licenses.asl20; + homepage = "https://github.com/grimme-lab/multicharge"; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix new file mode 100644 index 000000000000..2ad84249758a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix @@ -0,0 +1,105 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, gfortran +, fftwSinglePrec +, doxygen +, swig +, enablePython ? false +, python3Packages +, enableOpencl ? true +, opencl-headers +, ocl-icd +, enableCuda ? false +, cudaPackages +, addOpenGLRunpath +}: + +stdenv.mkDerivation rec { + pname = "openmm"; + version = "8.0.0"; + + src = fetchFromGitHub { + owner = "openmm"; + repo = pname; + rev = version; + hash = "sha256-89ngeZHdjyL/OoGuQ+F5eaXE1/od0EEfIgw9eKdLtL8="; + }; + + # "This test is stochastic and may occassionally fail". It does. + postPatch = '' + rm \ + platforms/*/tests/Test*BrownianIntegrator.* \ + platforms/*/tests/Test*LangevinIntegrator.* \ + serialization/tests/TestSerializeIntegrator.cpp + ''; + + nativeBuildInputs = [ + cmake + gfortran + swig + doxygen + python3Packages.python + ] ++ lib.optional enableCuda addOpenGLRunpath; + + buildInputs = [ fftwSinglePrec ] + ++ lib.optionals enableOpencl [ ocl-icd opencl-headers ] + ++ lib.optional enableCuda cudaPackages.cudatoolkit; + + propagatedBuildInputs = lib.optionals enablePython (with python3Packages; [ + python + numpy + cython + ]); + + cmakeFlags = [ + "-DBUILD_TESTING=ON" + "-DOPENMM_BUILD_AMOEBA_PLUGIN=ON" + "-DOPENMM_BUILD_CPU_LIB=ON" + "-DOPENMM_BUILD_C_AND_FORTRAN_WRAPPERS=ON" + "-DOPENMM_BUILD_DRUDE_PLUGIN=ON" + "-DOPENMM_BUILD_PME_PLUGIN=ON" + "-DOPENMM_BUILD_RPMD_PLUGIN=ON" + "-DOPENMM_BUILD_SHARED_LIB=ON" + ] ++ lib.optionals enablePython [ + "-DOPENMM_BUILD_PYTHON_WRAPPERS=ON" + ] ++ lib.optionals enableOpencl [ + "-DOPENMM_BUILD_OPENCL_LIB=ON" + "-DOPENMM_BUILD_AMOEBA_OPENCL_LIB=ON" + "-DOPENMM_BUILD_DRUDE_OPENCL_LIB=ON" + "-DOPENMM_BUILD_RPMD_OPENCL_LIB=ON" + ] ++ lib.optionals enableCuda [ + "-DCUDA_SDK_ROOT_DIR=${cudaPackages.cudatoolkit}" + "-DOPENMM_BUILD_AMOEBA_CUDA_LIB=ON" + "-DOPENMM_BUILD_CUDA_LIB=ON" + "-DOPENMM_BUILD_DRUDE_CUDA_LIB=ON" + "-DOPENMM_BUILD_RPMD_CUDA_LIB=ON" + "-DCMAKE_LIBRARY_PATH=${cudaPackages.cudatoolkit}/lib64/stubs" + ]; + + postInstall = lib.strings.optionalString enablePython '' + export OPENMM_LIB_PATH=$out/lib + export OPENMM_INCLUDE_PATH=$out/include + cd python + ${python3Packages.python.pythonForBuild.interpreter} setup.py build + ${python3Packages.python.pythonForBuild.interpreter} setup.py install --prefix=$out + ''; + + postFixup = '' + for lib in $out/lib/plugins/*CUDA.so $out/lib/plugins/*Cuda*.so; do + addOpenGLRunpath "$lib" + done + ''; + + # Couldn't get CUDA to run properly in the sandbox + doCheck = !enableCuda && !enableOpencl; + + meta = with lib; { + description = "Toolkit for molecular simulation using high performance GPU code"; + homepage = "https://openmm.org/"; + license = with licenses; [ gpl3Plus lgpl3Plus mit ]; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/plumed/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/plumed/default.nix new file mode 100644 index 000000000000..b825c8270d62 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/plumed/default.nix @@ -0,0 +1,34 @@ +{ stdenv +, lib +, fetchFromGitHub +, blas +}: + +assert !blas.isILP64; + +stdenv.mkDerivation rec { + pname = "plumed"; + version = "2.9.0"; + + src = fetchFromGitHub { + owner = "plumed"; + repo = "plumed2"; + rev = "v${version}"; + hash = "sha256-yL+59f908IhbxGIylI1ydi1BPZwAapjK/vP4/h5gcHk="; + }; + + postPatch = '' + patchShebangs . + ''; + + buildInputs = [ blas ]; + + enableParallelBuilding = true; + + meta = with lib; { + description = "Molecular metadynamics library"; + homepage = "https://github.com/plumed/plumed2"; + license = licenses.lgpl3Only; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix new file mode 100644 index 000000000000..57139f8bcd00 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix @@ -0,0 +1,46 @@ +{ stdenv +, lib +, fetchFromGitHub +, gfortran +, cmake +, mctc-lib +, mstore +, toml-f +, blas +}: + +assert !blas.isILP64; + +stdenv.mkDerivation rec { + pname = "simple-dftd3"; + version = "0.7.0"; + + src = fetchFromGitHub { + owner = "dftd3"; + repo = pname; + rev = "v${version}"; + hash = "sha256-5OvmMgjD8ujjKHkuw4NT8hEXKh5YPxuBl/Mu6g2/KIA="; + }; + + nativeBuildInputs = [ cmake gfortran ]; + + buildInputs = [ mctc-lib mstore toml-f blas ]; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/s-dftd3.pc \ + --replace "''${prefix}/" "" + ''; + + doCheck = true; + preCheck = '' + export OMP_NUM_THREADS=2 + ''; + + meta = with lib; { + description = "Reimplementation of the DFT-D3 program"; + license = with licenses; [ lgpl3Only gpl3Only ]; + homepage = "https://github.com/dftd3/simple-dftd3"; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/0001-fix-multicharge-dep-needed-for-static-compilation.patch b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/0001-fix-multicharge-dep-needed-for-static-compilation.patch new file mode 100644 index 000000000000..d2d84f42e09f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/0001-fix-multicharge-dep-needed-for-static-compilation.patch @@ -0,0 +1,31 @@ +From 1885a2349102742e33c5c97a8ab4bcacc032fc70 Mon Sep 17 00:00:00 2001 +From: Ryan Swart <ryan@talosystems.com> +Date: Thu, 30 Mar 2023 15:50:23 +0800 +Subject: [PATCH] fix: multicharge dep needed for static compilation + +--- + config/meson.build | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/config/meson.build b/config/meson.build +index 4f76160..629fa5e 100644 +--- a/config/meson.build ++++ b/config/meson.build +@@ -136,6 +136,14 @@ sdftd3_dep = dependency( + ) + lib_deps += sdftd3_dep + ++# Create multicharge library as subproject ++multicharge_dep = dependency( ++ 'multicharge', ++ fallback: ['multicharge'], ++ default_options: ['default_library=static', 'api=false', 'python=false'], ++) ++lib_deps += multicharge_dep ++ + # Create TOML Fortran as subproject + tomlf_dep = dependency( + 'toml-f', +-- +2.39.2 + diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/default.nix new file mode 100644 index 000000000000..0f05315b9d88 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/default.nix @@ -0,0 +1,59 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, gfortran +, blas +, lapack +, mctc-lib +, mstore +, toml-f +, multicharge +, dftd4 +, simple-dftd3 +}: + +assert !blas.isILP64 && !lapack.isILP64; + +stdenv.mkDerivation rec { + pname = "tblite"; + version = "0.3.0"; + + src = fetchFromGitHub { + owner = "tblite"; + repo = pname; + rev = "v${version}"; + hash = "sha256-R7CAFG/x55k5Ieslxeq+DWq1wPip4cI+Yvn1cBbeVNs="; + }; + + nativeBuildInputs = [ cmake gfortran ]; + + buildInputs = [ + blas + lapack + mctc-lib + mstore + toml-f + multicharge + dftd4 + simple-dftd3 + ]; + + doCheck = true; + preCheck = '' + export OMP_NUM_THREADS=2 + ''; + + postInstall = '' + substituteInPlace $out/lib/pkgconfig/${pname}.pc \ + --replace "''${prefix}" "" + ''; + + meta = with lib; { + description = "Light-weight tight-binding framework"; + license = with licenses; [ gpl3Plus lgpl3Plus ]; + homepage = "https://github.com/tblite/tblite"; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/python.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/python.nix new file mode 100644 index 000000000000..f19c3377b178 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/tblite/python.nix @@ -0,0 +1,58 @@ +{ buildPythonPackage +, meson +, ninja +, pkg-config +, tblite +, numpy +, simple-dftd3 +, cffi +, gfortran +, blas +, lapack +, mctc-lib +, mstore +, toml-f +, multicharge +, dftd4 +}: + +buildPythonPackage { + inherit (tblite) pname version src meta; + + nativeBuildInputs = [ + tblite + meson + ninja + pkg-config + gfortran + mctc-lib + ]; + + buildInputs = [ + tblite + simple-dftd3 + blas + lapack + mctc-lib + mstore + toml-f + multicharge + dftd4 + ]; + + propagatedBuildInputs = [ tblite simple-dftd3 cffi numpy ]; + + # Add multicharge to the meson deps; otherwise we get missing mod_multicharge errors + patches = [ ./0001-fix-multicharge-dep-needed-for-static-compilation.patch ]; + + format = "other"; + pythonImportsCheck = [ "tblite" "tblite.interface" ]; + configurePhase = '' + runHook preConfigure + + meson setup build -Dpython=true --prefix=$out + cd build + + runHook postConfigure + ''; +} diff --git a/nixpkgs/pkgs/development/libraries/science/electronics/qcsxcad/default.nix b/nixpkgs/pkgs/development/libraries/science/electronics/qcsxcad/default.nix index a20f6973384a..6ac453aec2c0 100644 --- a/nixpkgs/pkgs/development/libraries/science/electronics/qcsxcad/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/electronics/qcsxcad/default.nix @@ -10,13 +10,13 @@ mkDerivation { pname = "qcsxcad"; - version = "unstable-2020-01-04"; + version = "unstable-2023-01-06"; src = fetchFromGitHub { owner = "thliebig"; repo = "QCSXCAD"; - rev = "0dabbaf2bc1190adec300871cf309791af842c8e"; - sha256 = "11kbh0mxbdfh7s5azqin3i2alic5ihmdfj0jwgnrhlpjk4cbf9rn"; + rev = "1cde9d560a5000f4c24c249d2dd5ccda12de38b6"; + hash = "sha256-kc9Vnx6jGiQC2K88ZH00b61D/DbWxAIZZwYCsINqtrY="; }; outputs = [ "out" "dev" ]; diff --git a/nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix b/nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix index f04087302825..962e8e8e6ace 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix @@ -16,7 +16,7 @@ }: let - threadingSuffix = if withOpenMP then "-mt" else ""; + threadingSuffix = lib.optionalString withOpenMP "-mt"; blasIntSize = if blas64 then "64" else "32"; in stdenv.mkDerivation rec { pname = "amd-blis"; diff --git a/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix index 2413a0a25cfe..a418df7050eb 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix @@ -1,5 +1,13 @@ { lib, stdenv, fetchFromGitHub, fetchpatch, cmake -, gfortran, blas, lapack, eigen }: +, gfortran, blas, lapack, eigen +, useMpi ? false +, mpi +, openssh +}: + +# MPI version can only be built with LP64 interface. +# See https://github.com/opencollab/arpack-ng#readme +assert useMpi -> !blas.isILP64; stdenv.mkDerivation rec { pname = "arpack"; @@ -27,13 +35,16 @@ stdenv.mkDerivation rec { blas lapack eigen - ]; + ] ++ lib.optional useMpi mpi; + + nativeCheckInputs = lib.optional useMpi openssh; doCheck = true; cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DINTERFACE64=${if blas.isILP64 then "1" else "0"}" + "-DMPI=${if useMpi then "ON" else "OFF"}" ]; preCheck = '' @@ -45,9 +56,7 @@ stdenv.mkDerivation rec { install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libarpack.dylib ''; - # disable stackprotector on aarch64-darwin for now - # https://github.com/NixOS/nixpkgs/issues/127608 - hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; + passthru = { inherit (blas) isILP64; }; meta = { homepage = "https://github.com/opencollab/arpack-ng"; diff --git a/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix index acb737836c0d..ed899a02aa78 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix @@ -1,15 +1,15 @@ { lib, stdenv, fetchurl, cmake, gfortran -# Wether to build with ILP64 interface +# Whether to build with ILP64 interface , blas64 ? false }: stdenv.mkDerivation rec { pname = "blas"; - version = "3.10.0"; + version = "3.11.0"; src = fetchurl { url = "http://www.netlib.org/blas/${pname}-${version}.tgz"; - sha256 = "sha256-LjYNmcm9yEB6YYiMQKqFP7QhlCDruCZNtIbLiGBGirM="; + sha256 = "sha256-LZ/e59NhlU/uUyEApQ5gKCbJzBFT+M0Fe6pl7VfpAoM="; }; passthru = { inherit blas64; }; diff --git a/nixpkgs/pkgs/development/libraries/science/math/bonmin/default.nix b/nixpkgs/pkgs/development/libraries/science/math/bonmin/default.nix index 9526a6250184..7f494b245c30 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/bonmin/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/bonmin/default.nix @@ -47,5 +47,7 @@ stdenv.mkDerivation rec { license = licenses.epl10; platforms = platforms.unix; maintainers = with maintainers; [ aanderse ]; + # never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs + broken = stdenv.isDarwin; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix b/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix index 142641398f56..6ec28ba1c226 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix @@ -8,14 +8,14 @@ }: stdenv.mkDerivation rec { - version = "1.2.11"; + version = "1.2.12"; pname = "brial"; src = fetchFromGitHub { owner = "BRiAl"; repo = "BRiAl"; rev = version; - sha256 = "sha256-GkaeBggOCiIWNBZoIaCvAcqGDRc/whTOqPZbGpAxWIk="; + sha256 = "sha256-y6nlqRBJRWohGDAKe/F37qBP1SgtFHR1HD+erFJReOM="; }; # FIXME package boost-test and enable checks diff --git a/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix b/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix new file mode 100644 index 000000000000..281076caba9f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix @@ -0,0 +1,44 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, ninja +, opencl-headers +, ocl-icd +}: + +stdenv.mkDerivation rec { + pname = "clblast"; + version = "1.6.0"; + + src = fetchFromGitHub { + owner = "CNugteren"; + repo = "CLBlast"; + rev = version; + hash = "sha256-eRwSfP6p0+9yql7TiXZsExRMcnnBLXXW2hh1JliYU2I="; + }; + + nativeBuildInputs = [ + cmake + ninja + ]; + + buildInputs = [ + opencl-headers + ocl-icd + ]; + + cmakeFlags = [ + # https://github.com/NixOS/nixpkgs/issues/144170 + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_INSTALL_LIBDIR=lib" + ]; + + meta = with lib; { + description = "The tuned OpenCL BLAS library"; + homepage = "https://github.com/CNugteren/CLBlast"; + license = licenses.asl20; + maintainers = with maintainers; [ Tungsten842 ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix b/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix index fd89ede1efb9..55a1b9dcb4c9 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { doCheck = true; - buildInputs = [ + nativeBuildInputs = [ autoreconfHook ]; diff --git a/nixpkgs/pkgs/development/libraries/science/math/clmagma/default.nix b/nixpkgs/pkgs/development/libraries/science/math/clmagma/default.nix index fe9fc540902d..c5efbb757df8 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/clmagma/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/clmagma/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchurl, gfortran, opencl-headers, clblas, ocl-icd, mkl, intel-ocl }: -with lib; - let incfile = builtins.toFile "make.inc.custom" '' CC = g++ diff --git a/nixpkgs/pkgs/development/libraries/science/math/coin-utils/default.nix b/nixpkgs/pkgs/development/libraries/science/math/coin-utils/default.nix new file mode 100644 index 000000000000..6cb7666e5688 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/coin-utils/default.nix @@ -0,0 +1,22 @@ +{ lib, stdenv, fetchFromGitHub, pkg-config }: + +stdenv.mkDerivation rec { + version = "2.11.9"; + pname = "coinutils"; + + src = fetchFromGitHub { + owner = "coin-or"; + repo = "CoinUtils"; + rev = "releases/${version}"; + hash = "sha256-DgHVbcXd36WW6JQbiq1MUHAiKLs8CTau87rs0T76sGs="; + }; + + doCheck = true; + + meta = with lib; { + license = licenses.epl20; + homepage = "https://github.com/coin-or/CoinUtils"; + description = "Collection of classes and helper functions that are generally useful to multiple COIN-OR projects"; + maintainers = with maintainers; [ tmarkus ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/extension.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/extension.nix index 265e09f436ab..d4c83428980d 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/cudnn/extension.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/extension.nix @@ -1,116 +1,66 @@ +# Support matrix can be found at +# https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html +# Type aliases +# Release = { +# version: String, +# minCudaVersion: String, +# maxCudaVersion: String, +# url: String, +# hash: String, +# } final: prev: let - inherit (final) callPackage; - inherit (prev) cudatoolkit cudaVersion lib pkgs; + inherit (prev) cudaVersion; + inherit (prev.lib) attrsets lists versions; + inherit (prev.lib.strings) replaceStrings versionAtLeast versionOlder; - ### CuDNN + # Compute versioned attribute name to be used in this package set + # Patch version changes should not break the build, so we only use major and minor + # computeName :: String -> String + computeName = version: "cudnn_${replaceStrings ["."] ["_"] (versions.majorMinor version)}"; - buildCuDnnPackage = args: - let - useCudatoolkitRunfile = lib.versionOlder cudaVersion "11.3.999"; - in - callPackage ./generic.nix { inherit useCudatoolkitRunfile; } args; + # Check whether a CUDNN release supports our CUDA version + # Thankfully we're able to do lexicographic comparison on the version strings + # isSupported :: Release -> Bool + isSupported = release: + versionAtLeast cudaVersion release.minCudaVersion + && versionAtLeast release.maxCudaVersion cudaVersion; + + # useCudatoolkitRunfile :: Bool + useCudatoolkitRunfile = versionOlder cudaVersion "11.3.999"; - toUnderscore = str: lib.replaceStrings ["."] ["_"] str; + # buildCuDnnPackage :: Release -> Derivation + buildCuDnnPackage = callPackage ./generic.nix {inherit useCudatoolkitRunfile;}; - majorMinorPatch = str: lib.concatStringsSep "." (lib.take 3 (lib.splitVersion str)); + # Reverse the list to have the latest release first + # cudnnReleases :: List Release + cudnnReleases = lists.reverseList (builtins.import ./releases.nix); - cuDnnPackages = with lib; let - # Check whether a file is supported for our cuda version - isSupported = fileData: elem cudaVersion fileData.supportedCudaVersions; - # Return the first file that is supported. In practice there should only ever be one anyway. - supportedFile = files: findFirst isSupported null files; - # Supported versions with versions as keys and file as value - supportedVersions = filterAttrs (version: file: file !=null ) (mapAttrs (version: files: supportedFile files) cuDnnVersions); - # Compute versioned attribute name to be used in this package set - computeName = version: "cudnn_${toUnderscore version}"; - # Add all supported builds as attributes - allBuilds = mapAttrs' (version: file: nameValuePair (computeName version) (buildCuDnnPackage (removeAttrs file ["fileVersion"]))) supportedVersions; - # Set the default attributes, e.g. cudnn = cudnn_8_3_1; - defaultBuild = { "cudnn" = allBuilds.${computeName cuDnnDefaultVersion}; }; - in allBuilds // defaultBuild; + # Check whether a CUDNN release supports our CUDA version + # supportedReleases :: List Release + supportedReleases = builtins.filter isSupported cudnnReleases; - cuDnnVersions = let - urlPrefix = "https://developer.download.nvidia.com/compute/redist/cudnn"; - in { - "7.4.2" = [ - rec { - fileVersion = "10.0"; - fullVersion = "7.4.2.24"; - sha256 = "18ys0apiz9afid2s6lvy9qbyi8g66aimb2a7ikl1f3dm09mciprf"; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-10.0-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.0" ]; - } - ]; - "7.6.5" = [ - rec { - fileVersion = "10.0"; - fullVersion = "7.6.5.32"; - hash = "sha256-KDVeOV8LK5OsLIO2E2CzW6bNA3fkTni+GXtrYbS0kro="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.0" ]; - } - rec { - fileVersion = "10.1"; - fullVersion = "7.6.5.32"; - hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLM="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.1" ]; - } - rec { - fileVersion = "10.2"; - fullVersion = "7.6.5.32"; - hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLN="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.2" ]; - } - ]; - "8.1.1" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.1.1.33"; - hash = "sha256-Kkp7mabpv6aQ6xm7QeSVU/KnpJGls6v8rpAOFmxbbr0="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.2"; - fullVersion = "8.1.1.33"; - hash = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "11.2" ]; - } - ]; - "8.3.2" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.3.2.44"; - hash = "sha256-1vVu+cqM+PketzIQumw9ykm6REbBZhv6/lXB7EC2aaw="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.5"; - fullVersion = "8.3.2.44"; - hash = "sha256-VQCVPAjF5dHd3P2iNPnvvdzb5DpTsm3AqCxyP6FwxFc="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.4" "11.5" "11.6" ]; - } - ]; + # Function to transform our releases into build attributes + # toBuildAttrs :: Release -> { name: String, value: Derivation } + toBuildAttrs = release: { + name = computeName release.version; + value = buildCuDnnPackage release; }; - # Default attributes - cuDnnDefaultVersion = { - "10.0" = "7.4.2"; - "10.1" = "7.6.5"; - "10.2" = "8.3.2"; - "11.0" = "8.3.2"; - "11.1" = "8.3.2"; - "11.2" = "8.3.2"; - "11.3" = "8.3.2"; - "11.4" = "8.3.2"; - "11.5" = "8.3.2"; - "11.6" = "8.3.2"; - }.${cudaVersion}; + # Add all supported builds as attributes + # allBuilds :: AttrSet String Derivation + allBuilds = builtins.listToAttrs (builtins.map toBuildAttrs supportedReleases); + + defaultBuild = attrsets.optionalAttrs (supportedReleases != []) { + cudnn = let + # The latest release is the first element of the list and will be our default choice + # latestReleaseName :: String + latestReleaseName = computeName (builtins.head supportedReleases).version; + in + allBuilds.${latestReleaseName}; + }; -in cuDnnPackages + # builds :: AttrSet String Derivation + builds = allBuilds // defaultBuild; +in + builds diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix index 731b5588f887..cdfa924b2242 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix @@ -1,116 +1,130 @@ -{ stdenv -, lib -, zlib -, useCudatoolkitRunfile ? false -, cudaVersion -, cudaMajorVersion -, cudatoolkit # if cuda>=11: only used for .cc -, libcublas ? null # cuda <11 doesn't ship redist packages -, autoPatchelfHook -, autoAddOpenGLRunpathHook -, fetchurl -, # The distributed version of CUDNN includes both dynamically liked .so files, +{ stdenv, + backendStdenv, + lib, + zlib, + useCudatoolkitRunfile ? false, + cudaVersion, + cudaMajorVersion, + cudatoolkit, # For cuda < 11 + libcublas ? null, # cuda <11 doesn't ship redist packages + autoPatchelfHook, + autoAddOpenGLRunpathHook, + fetchurl, + # The distributed version of CUDNN includes both dynamically liked .so files, # as well as statically linked .a files. However, CUDNN is quite large # (multiple gigabytes), so you can save some space in your nix store by # removing the statically linked libraries if you are not using them. # # Setting this to true removes the statically linked .a files. # Setting this to false keeps these statically linked .a files. - removeStatic ? false + removeStatic ? false, +}: { + version, + url, + hash, + minCudaVersion, + maxCudaVersion, }: +assert useCudatoolkitRunfile || (libcublas != null); let + inherit (lib) lists strings trivial versions; + + # majorMinorPatch :: String -> String + majorMinorPatch = (trivial.flip trivial.pipe) [ + (versions.splitVersion) + (lists.take 3) + (strings.concatStringsSep ".") + ]; -{ fullVersion -, url -, hash ? null -, sha256 ? null -, supportedCudaVersions ? [ ] -}: - -assert (hash != null) || (sha256 != null); - -assert useCudatoolkitRunfile || (libcublas != null); - -let - inherit (cudatoolkit) cc; - - majorMinorPatch = version: lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version)); - version = majorMinorPatch fullVersion; + # versionTriple :: String + # Version with three components: major.minor.patch + versionTriple = majorMinorPatch version; + # cudatoolkit_root :: Derivation cudatoolkit_root = if useCudatoolkitRunfile then cudatoolkit else libcublas; in -stdenv.mkDerivation { - pname = "cudatoolkit-${cudaMajorVersion}-cudnn"; - inherit version; - - src = fetchurl { - inherit url hash sha256; - }; - - # Check and normalize Runpath against DT_NEEDED using autoPatchelf. - # Prepend /run/opengl-driver/lib using addOpenGLRunpath for dlopen("libcudacuda.so") - nativeBuildInputs = [ - autoPatchelfHook - autoAddOpenGLRunpathHook - ]; - - # Used by autoPatchelfHook - buildInputs = [ - cc.cc.lib # libstdc++ - zlib - cudatoolkit_root - ]; - - # We used to patch Runpath here, but now we use autoPatchelfHook - # - # Note also that version <=8.3.0 contained a subdirectory "lib64/" but in - # version 8.3.2 it seems to have been renamed to simply "lib/". - installPhase = '' - runHook preInstall - - mkdir -p $out - cp -a include $out/include - [ -d "lib/" ] && cp -a lib $out/lib - [ -d "lib64/" ] && cp -a lib64 $out/lib64 - '' + lib.optionalString removeStatic '' - rm -f $out/lib/*.a - rm -f $out/lib64/*.a - '' + '' - runHook postInstall - ''; - - # Without --add-needed autoPatchelf forgets $ORIGIN on cuda>=8.0.5. - postFixup = lib.optionalString (lib.versionAtLeast fullVersion "8.0.5") '' - patchelf $out/lib/libcudnn.so --add-needed libcudnn_cnn_infer.so - ''; - - passthru = { - inherit useCudatoolkitRunfile; - - cudatoolkit = lib.warn '' - cudnn.cudatoolkit passthru attribute is deprecated; - if your derivation uses cudnn directly, it should probably consume cudaPackages instead - '' - cudatoolkit; - - majorVersion = lib.versions.major version; - }; - - meta = with lib; { - # Check that the cudatoolkit version satisfies our min/max constraints (both - # inclusive). We mark the package as broken if it fails to satisfies the - # official version constraints (as recorded in default.nix). In some cases - # you _may_ be able to smudge version constraints, just know that you're - # embarking into unknown and unsupported territory when doing so. - broken = !(elem cudaVersion supportedCudaVersions); - description = "NVIDIA CUDA Deep Neural Network library (cuDNN)"; - homepage = "https://developer.nvidia.com/cudnn"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - # TODO: consider marking unfreRedistributable when not using runfile - license = licenses.unfree; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ mdaiter samuela ]; - }; -} + backendStdenv.mkDerivation { + pname = "cudatoolkit-${cudaMajorVersion}-cudnn"; + version = versionTriple; + + src = fetchurl { + inherit url hash; + }; + + # Check and normalize Runpath against DT_NEEDED using autoPatchelf. + # Prepend /run/opengl-driver/lib using addOpenGLRunpath for dlopen("libcudacuda.so") + nativeBuildInputs = [ + autoPatchelfHook + autoAddOpenGLRunpathHook + ]; + + # Used by autoPatchelfHook + buildInputs = [ + # Note this libstdc++ isn't from the (possibly older) nvcc-compatible + # stdenv, but from the (newer) stdenv that the rest of nixpkgs uses + stdenv.cc.cc.lib + + zlib + cudatoolkit_root + ]; + + # We used to patch Runpath here, but now we use autoPatchelfHook + # + # Note also that version <=8.3.0 contained a subdirectory "lib64/" but in + # version 8.3.2 it seems to have been renamed to simply "lib/". + installPhase = + '' + runHook preInstall + + mkdir -p $out + cp -a include $out/include + [ -d "lib/" ] && cp -a lib $out/lib + [ -d "lib64/" ] && cp -a lib64 $out/lib64 + '' + + strings.optionalString removeStatic '' + rm -f $out/lib/*.a + rm -f $out/lib64/*.a + '' + + '' + runHook postInstall + ''; + + # Without --add-needed autoPatchelf forgets $ORIGIN on cuda>=8.0.5. + postFixup = strings.optionalString (strings.versionAtLeast versionTriple "8.0.5") '' + patchelf $out/lib/libcudnn.so --add-needed libcudnn_cnn_infer.so + ''; + + passthru = { + inherit useCudatoolkitRunfile; + + cudatoolkit = + trivial.warn + '' + cudnn.cudatoolkit passthru attribute is deprecated; + if your derivation uses cudnn directly, it should probably consume cudaPackages instead + '' + cudatoolkit; + + majorVersion = versions.major versionTriple; + }; + + meta = with lib; { + # Check that the cudatoolkit version satisfies our min/max constraints (both + # inclusive). We mark the package as broken if it fails to satisfies the + # official version constraints (as recorded in default.nix). In some cases + # you _may_ be able to smudge version constraints, just know that you're + # embarking into unknown and unsupported territory when doing so. + broken = + strings.versionOlder cudaVersion minCudaVersion + || strings.versionOlder maxCudaVersion cudaVersion; + description = "NVIDIA CUDA Deep Neural Network library (cuDNN)"; + homepage = "https://developer.nvidia.com/cudnn"; + sourceProvenance = with sourceTypes; [binaryNativeCode]; + # TODO: consider marking unfreRedistributable when not using runfile + license = licenses.unfree; + platforms = ["x86_64-linux"]; + maintainers = with maintainers; [mdaiter samuela]; + }; + } diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/releases.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/releases.nix new file mode 100644 index 000000000000..b82dd78178c0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/releases.nix @@ -0,0 +1,185 @@ +# NOTE: Check https://docs.nvidia.com/deeplearning/cudnn/archives/index.html for support matrices. +[ + { + version = "7.4.2.24"; + minCudaVersion = "10.0"; + maxCudaVersion = "10.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.4.2/cudnn-10.0-linux-x64-v7.4.2.24.tgz"; + hash = "sha256-Lt/IagK1DRfojEeJVaMy5qHoF05+U6NFi06lH68C2qM="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.0"; + maxCudaVersion = "10.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.0-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-KDVeOV8LK5OsLIO2E2CzW6bNA3fkTni+GXtrYbS0kro="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.1"; + maxCudaVersion = "10.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.1-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLM="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.2-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLN="; + } + { + version = "8.0.5.39"; + minCudaVersion = "10.1"; + maxCudaVersion = "10.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-10.1-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-kJCElSmIlrM6qVBjo0cfk8NmJ9esAcF9w211xl7qSgA="; + } + { + version = "8.0.5.39"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-10.2-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-IfhMBcZ78eyFnnfDjM1b8VSWT6HDCPRJlZvkw1bjgvM="; + } + { + version = "8.0.5.39"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.0-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-ThbueJXetKixwZS4ErpJWG730mkCBRQB03F1EYmKm3M="; + } + { + version = "8.0.5.39"; + minCudaVersion = "11.1"; + maxCudaVersion = "11.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.1-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-HQRr+nk5navMb2yxUHkYdUQ5RC6gyp4Pvs3URvmwDM4="; + } + { + version = "8.1.1.33"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-10.2-linux-x64-v8.1.1.33.tgz"; + hash = "sha256-Kkp7mabpv6aQ6xm7QeSVU/KnpJGls6v8rpAOFmxbbr0="; + } + { + version = "8.1.1.33"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-11.2-linux-x64-v8.1.1.33.tgz"; + hash = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; + } + { + version = "8.2.4.15"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.2.4/cudnn-10.2-linux-x64-v8.2.4.15.tgz"; + hash = "sha256-0jyUoxFaHHcRamwSfZF1+/WfcjNkN08mo0aZB18yIvE="; + } + { + version = "8.2.4.15"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.4"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.2.4/cudnn-11.4-linux-x64-v8.2.4.15.tgz"; + hash = "sha256-Dl0t+JC5ln76ZhnaQhMQ2XMjVlp58FoajLm3Fluq0Nc="; + } + { + version = "8.3.3.40"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.3.3/local_installers/10.2/cudnn-linux-x86_64-8.3.3.40_cuda10.2-archive.tar.xz"; + hash = "sha256-2FVPKzLmKV1fyPOsJeaPlAWLAYyAHaucFD42gS+JJqs="; + } + { + version = "8.3.3.40"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.6"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.3.3/local_installers/11.5/cudnn-linux-x86_64-8.3.3.40_cuda11.5-archive.tar.xz"; + hash = "sha256-6r6Wx1zwPqT1N5iU2RTx+K4UzqsSGYnoSwg22Sf7dzE="; + } + { + version = "8.4.1.50"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.4.1.50_cuda10.2-archive.tar.xz"; + hash = "sha256-I88qMmU6lIiLVmaPuX7TTbisgTav839mssxUo3lQNjg="; + } + { + version = "8.4.1.50"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.7"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz"; + hash = "sha256-7JbSN22B/KQr3T1MPXBambKaBlurV/kgVhx2PinGfQE="; + } + { + version = "8.5.0.96"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.5.0.96_cuda10-archive.tar.xz"; + hash = "sha256-1mzhbbzR40WKkHnQLtJHhg0vYgf7G8a0OBcCwIOkJjM="; + } + { + version = "8.5.0.96"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.7"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.5.0.96_cuda11-archive.tar.xz"; + hash = "sha256-VFSm/ZTwCHKMqumtrZk8ToXvNjAuJrzkO+p9RYpee20="; + } + { + version = "8.6.0.163"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.6.0.163_cuda10-archive.tar.xz"; + hash = "sha256-t4sr/GrFqqdxu2VhaJQk5K1Xm/0lU4chXG8hVL09R9k="; + } + { + version = "8.6.0.163"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz"; + hash = "sha256-u8OW30cpTGV+3AnGAGdNYIyxv8gLgtz0VHBgwhcRFZ4="; + } + { + version = "8.7.0.84"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.7.0.84_cuda10-archive.tar.xz"; + hash = "sha256-bZhaqc8+GbPV2FQvvbbufd8VnEJgvfkICc2N3/gitRg="; + } + { + version = "8.7.0.84"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.7.0.84_cuda11-archive.tar.xz"; + hash = "sha256-l2xMunIzyXrnQAavq1Fyl2MAukD1slCiH4z3H1nJ920="; + } + { + version = "8.8.1.3"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.1.3_cuda11-archive.tar.xz"; + hash = "sha256-r3WEyuDMVSS1kT7wjCm6YVQRPGDrCjegWQqRtRWoqPk="; + } + { + version = "8.8.1.3"; + minCudaVersion = "12.0"; + maxCudaVersion = "12.0"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz"; + hash = "sha256-edd6dpx+cXWrx7XC7VxJQUjAYYqGQThyLIh/lcYjd3w="; + } + { + version = "8.9.1.23"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.9.1.23_cuda11-archive.tar.xz"; + hash = "sha256-ptmIcmfihZDJ25XOZcvpamaN8DUjOLfTN+BTLe0zSFw="; + } + { + version = "8.9.1.23"; + minCudaVersion = "12.0"; + maxCudaVersion = "12.1"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.9.1.23_cuda12-archive.tar.xz"; + hash = "sha256-NRY8XFQr4MURc4sn4lI1GTy+7cXg4AbkSxzerxki6D4="; + } +] diff --git a/nixpkgs/pkgs/development/libraries/science/math/cutensor/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/cutensor/generic.nix index e4cbf0ab7bf7..c957fcdd99d4 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/cutensor/generic.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/cutensor/generic.nix @@ -13,6 +13,7 @@ let mostOfVersion = builtins.concatStringsSep "." (lib.take 3 (lib.versions.splitVersion version)); + platform = "${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}"; in stdenv.mkDerivation { @@ -20,7 +21,9 @@ stdenv.mkDerivation { inherit version; src = fetchurl { - url = "https://developer.download.nvidia.com/compute/cutensor/${mostOfVersion}/local_installers/libcutensor-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}-${version}.tar.gz"; + url = if lib.versionOlder mostOfVersion "1.3.3" + then "https://developer.download.nvidia.com/compute/cutensor/${mostOfVersion}/local_installers/libcutensor-${platform}-${version}.tar.gz" + else "https://developer.download.nvidia.com/compute/cutensor/redist/libcutensor/${platform}/libcutensor-${platform}-${version}-archive.tar.xz"; inherit hash; }; diff --git a/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix b/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix new file mode 100644 index 000000000000..2175d1343856 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix @@ -0,0 +1,81 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, fypp +, gfortran +, blas +, lapack +, python3 +, libxsmm +, mpi +, openssh +}: + +stdenv.mkDerivation rec { + pname = "dbcsr"; + version = "2.5.0"; + + src = fetchFromGitHub { + owner = "cp2k"; + repo = "dbcsr"; + rev = "v${version}"; + hash = "sha256-GGClK3heGE3zUM0R+u58vRdAK+xWzaqdCHaMIDerHSI="; + }; + + postPatch = '' + patchShebangs . + + # Force build of shared library, otherwise just static. + substituteInPlace src/CMakeLists.txt \ + --replace 'add_library(dbcsr ''${DBCSR_SRCS})' 'add_library(dbcsr SHARED ''${DBCSR_SRCS})' \ + --replace 'add_library(dbcsr_c ''${DBCSR_C_SRCS})' 'add_library(dbcsr_c SHARED ''${DBCSR_C_SRCS})' + + # Avoid calling the fypp wrapper script with python again. The nix wrapper took care of that. + substituteInPlace cmake/fypp-sources.cmake \ + --replace 'COMMAND ''${Python_EXECUTABLE} ''${FYPP_EXECUTABLE}' 'COMMAND ''${FYPP_EXECUTABLE}' + ''; + + nativeBuildInputs = [ + gfortran + python3 + cmake + pkg-config + fypp + ]; + + buildInputs = [ blas lapack libxsmm ]; + + propagatedBuildInputs = [ mpi ]; + + preConfigure = '' + export PKG_CONFIG_PATH=${libxsmm}/lib + ''; + + cmakeFlags = [ + "-DUSE_OPENMP=ON" + "-DUSE_SMM=libxsmm" + "-DWITH_C_API=ON" + "-DBUILD_TESTING=ON" + "-DTEST_OMP_THREADS=2" + "-DTEST_MPI_RANKS=2" + "-DENABLE_SHARED=ON" + "-DUSE_MPI=ON" + ]; + + checkInputs = [ openssh ]; + + doCheck = true; + preCheck = '' + export HYDRA_IFACE=lo # Fix to make mpich run in a sandbox + export OMPI_MCA_rmaps_base_oversubscribe=1 + ''; + + meta = with lib; { + description = "Distributed Block Compressed Sparse Row matrix library"; + license = licenses.gpl2Only; + homepage = "https://github.com/cp2k/dbcsr"; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix b/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix index f2d5e29f6a4a..d67f31375e7d 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix @@ -1,32 +1,59 @@ { lib , config , fetchFromGitHub +, symlinkJoin , stdenv , cmake -, cudaPackages +, cudaPackages ? { } , cudaSupport ? config.cudaSupport or false -, cudaCapabilities ? [ "60" "70" "80" "86" ] +, nvidia-thrust +, useThrustSourceBuild ? true , pythonSupport ? true , pythonPackages +, llvmPackages +, boost , blas , swig , addOpenGLRunpath , optLevel ? let optLevels = - lib.optional stdenv.hostPlatform.avx2Support "avx2" - ++ lib.optional stdenv.hostPlatform.sse4_1Support "sse4" + lib.optionals stdenv.hostPlatform.avx2Support [ "avx2" ] + ++ lib.optionals stdenv.hostPlatform.sse4_1Support [ "sse4" ] ++ [ "generic" ]; in # Choose the maximum available optimization level builtins.head optLevels , faiss # To run demos in the tests , runCommand -}: +}@inputs: + +assert cudaSupport -> nvidia-thrust.cudaSupport; let pname = "faiss"; - version = "1.7.2"; - inherit (cudaPackages) cudatoolkit; + version = "1.7.4"; + + inherit (cudaPackages) cudaFlags backendStdenv; + inherit (cudaFlags) cudaCapabilities dropDot; + + stdenv = if cudaSupport then backendStdenv else inputs.stdenv; + + cudaJoined = symlinkJoin { + name = "cuda-packages-unsplit"; + paths = with cudaPackages; [ + cuda_cudart # cuda_runtime.h + libcublas + libcurand + ] ++ lib.optionals useThrustSourceBuild [ + nvidia-thrust + ] ++ lib.optionals (!useThrustSourceBuild) [ + cuda_cccl + ] ++ lib.optionals (cudaPackages ? cuda_profiler_api) [ + cuda_profiler_api # cuda_profiler_api.h + ] ++ lib.optionals (!(cudaPackages ? cuda_profiler_api)) [ + cuda_nvprof # cuda_profiler_api.h + ]; + }; in stdenv.mkDerivation { inherit pname version; @@ -37,7 +64,7 @@ stdenv.mkDerivation { owner = "facebookresearch"; repo = pname; rev = "v${version}"; - hash = "sha256-Tklf5AaqJbOs9qtBZVcxXPLAp+K54EViZLSOvEhmswg="; + hash = "sha256-WSce9X6sLZmGM5F0ZkK54VqpIy8u1VB0e9/l78co29M="; }; buildInputs = [ @@ -47,6 +74,10 @@ stdenv.mkDerivation { pythonPackages.setuptools pythonPackages.pip pythonPackages.wheel + ] ++ lib.optionals stdenv.cc.isClang [ + llvmPackages.openmp + ] ++ lib.optionals cudaSupport [ + cudaJoined ]; propagatedBuildInputs = lib.optionals pythonSupport [ @@ -54,9 +85,9 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ] ++ lib.optionals cudaSupport [ - cudatoolkit + cudaPackages.cuda_nvcc addOpenGLRunpath - ] ++ lib.optional pythonSupport [ + ] ++ lib.optionals pythonSupport [ pythonPackages.python ]; @@ -69,7 +100,8 @@ stdenv.mkDerivation { "-DFAISS_ENABLE_PYTHON=${if pythonSupport then "ON" else "OFF"}" "-DFAISS_OPT_LEVEL=${optLevel}" ] ++ lib.optionals cudaSupport [ - "-DCMAKE_CUDA_ARCHITECTURES=${lib.concatStringsSep ";" cudaCapabilities}" + "-DCMAKE_CUDA_ARCHITECTURES=${builtins.concatStringsSep ";" (map dropDot cudaCapabilities)}" + "-DCUDAToolkit_INCLUDE_DIR=${cudaJoined}/include" ]; @@ -98,6 +130,11 @@ stdenv.mkDerivation { addOpenGLRunpath $demos/bin/* ''; + # Need buildPythonPackage for this one + # pythonImportsCheck = [ + # "faiss" + # ]; + passthru = { inherit cudaSupport cudaPackages pythonSupport; diff --git a/nixpkgs/pkgs/development/libraries/science/math/faiss/tests.nix b/nixpkgs/pkgs/development/libraries/science/math/faiss/tests.nix index fcf57a8bc9fd..858a980bfeaf 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/faiss/tests.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/faiss/tests.nix @@ -11,6 +11,8 @@ buildPythonPackage { pname = "faiss-pytest-suite"; inherit (faiss) version; + format = "other"; + src = "${faiss.src}/tests"; dontBuild = true; @@ -21,7 +23,12 @@ buildPythonPackage { "test_contrib.py" ]; - checkInputs = [ + disabledTests = [ + # https://github.com/facebookresearch/faiss/issues/2836 + "test_update_codebooks_with_double" + ]; + + nativeCheckInputs = [ faiss pytestCheckHook scipy diff --git a/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix b/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix index 325a6b82a6f9..9b26b352cdad 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix @@ -5,20 +5,20 @@ , blas , lapack , gfortran -, enableAMPL ? stdenv.isLinux, libamplsolver +, enableAMPL ? true, libamplsolver }: assert (!blas.isILP64) && (!lapack.isILP64); stdenv.mkDerivation rec { pname = "ipopt"; - version = "3.14.5"; + version = "3.14.12"; src = fetchFromGitHub { owner = "coin-or"; repo = "Ipopt"; rev = "releases/${version}"; - sha256 = "sha256-eqOacZGuuGAjWMs2H6RntQ+WJmGTi+EqydHUQXEpY54="; + sha256 = "sha256-cyV3tgmZz5AExxxdGJ12r+PPXn7v2AEhxb9icBxolS8="; }; CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ]; diff --git a/nixpkgs/pkgs/development/libraries/science/math/itpp/default.nix b/nixpkgs/pkgs/development/libraries/science/math/itpp/default.nix index c3ff2aeebfb4..b5e2f4b80d3b 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/itpp/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/itpp/default.nix @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "IT++ is a C++ library of mathematical, signal processing and communication classes and functions"; - homepage = "http://itpp.sourceforge.net/"; + homepage = "https://itpp.sourceforge.net/"; license = licenses.gpl3; platforms = platforms.unix; maintainers = with maintainers; [ andrew-d ]; diff --git a/nixpkgs/pkgs/development/libraries/science/math/latte-integrale/default.nix b/nixpkgs/pkgs/development/libraries/science/math/latte-integrale/default.nix new file mode 100644 index 000000000000..7eb485974ff2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/latte-integrale/default.nix @@ -0,0 +1,41 @@ +{ lib +, stdenv +, fetchurl +, fetchpatch +, gmp +, ntl +, cddlib +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "latte-integrale"; + version = "1.7.6"; + + src = fetchurl { + url = "https://github.com/latte-int/latte/releases/download/version_${lib.replaceStrings ["."] ["_"] finalAttrs.version}/latte-int-${finalAttrs.version}.tar.gz"; + sha256 = "sha256-AGwQ6+XVv9ybFZy6YmSkQyhh/nY84F/oIWJKt9P8IXA="; + }; + + patches = [ + # C++17 compat + (fetchpatch { + url = "https://github.com/latte-int/latte/commit/6dbf7f07d5c9e1f3afe793f782d191d4465088ae.patch"; + excludes = [ "code/latte/sqlite/IntegrationDB.h" ]; + sha256 = "sha256-i7c11y54OLuJ0m7PBnhEoAzJzxC842JU7A6TOtTz06k="; + }) + ]; + + buildInputs = [ + gmp + ntl + cddlib + ]; + + meta = { + description = "Software for counting lattice points and integration over convex polytopes"; + homepage = "https://www.math.ucdavis.edu/~latte/"; + license = lib.licenses.gpl2; + maintainers = with lib.maintainers; [ amesgen ]; + platforms = lib.platforms.unix; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/default.nix b/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/default.nix index bcbde5f61359..c0bc89b492ea 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, fetchpatch }: +{ lib, stdenv, substitute, fetchurl, fetchpatch }: stdenv.mkDerivation rec { pname = "libamplsolver"; @@ -10,20 +10,22 @@ stdenv.mkDerivation rec { }; patches = [ - # Debian provides a patch to build a shared library - (fetchpatch { - url = "https://sources.debian.org/data/main/liba/libamplsolver/0~20190702-2/debian/patches/fix-makefile-shared-lib.patch"; - sha256 = "sha256-96qwj3fLugzbsfxguKMce13cUo7XGC4VUE7xKcJs42Y="; + (substitute { + src = ./libamplsolver-sharedlib.patch; + replacements = [ "--replace" "@sharedlibext@" "${stdenv.hostPlatform.extensions.sharedLibrary}" ]; }) ]; installPhase = '' runHook preInstall - pushd sys.`uname -m`.`uname -s` + pushd sys.$(uname -m).$(uname -s) install -D -m 0644 *.h -t $out/include - install -D -m 0644 *.so* -t $out/lib + install -D -m 0644 *${stdenv.hostPlatform.extensions.sharedLibrary}* -t $out/lib install -D -m 0644 *.a -t $out/lib popd + '' + lib.optionalString stdenv.isDarwin '' + install_name_tool -id $out/lib/libamplsolver.dylib $out/lib/libamplsolver.dylib + '' + '' runHook postInstall ''; @@ -31,7 +33,7 @@ stdenv.mkDerivation rec { description = "A library of routines that help solvers work with AMPL"; homepage = "https://ampl.com/netlib/ampl/"; license = [ licenses.mit ]; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = with maintainers; [ aanderse ]; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/libamplsolver-sharedlib.patch b/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/libamplsolver-sharedlib.patch new file mode 100644 index 000000000000..f2af2910e89c --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/libamplsolver-sharedlib.patch @@ -0,0 +1,39 @@ +Authors: Andrei Rozanski and Grace Dinh +Last-Update: 2022-08-23 +Description: fix makefile.u in order to get libamplsover.so (Linux) or libamplsolver.dylib (Mac) + +--- a/makefile.u ++++ b/makefile.u + +@@ -26,8 +26,9 @@ + + .SUFFIXES: .c .o + CC = cc +-CFLAGS = -O ++CFLAGS := $(CFLAGS) -pipe -DASL_BUILD -fPIC -DPIC + SHELL=/bin/sh ++OFILES=$(addsuffix .o,$(basename $(a))) + + # Add -DNO_RUSAGE to the CFLAGS assignment if your system + # lacks getrusage(). This only matters for compiling xectim.c. +@@ -86,7 +87,7 @@ + .c.o: + $(CC) -c $(CFLAGS) $*.c + +-all: arith.h stdio1.h amplsolver.a funcadd0.o ++all: arith.h stdio1.h amplsolver.a funcadd0.o libamplsolver@sharedlibext@ + + a = \ + asldate.c \ +@@ -189,6 +190,11 @@ + # search path, e.g. + # exec true + # or just comment out the ranlib invocation above. ++libamplsolver.so: $(OFILES) ++ $(CC) $^ -shared -Wl,-soname,libamplsolver.so.0 $(LDFLAGS) -o $@.0 ++ ln -s $@.0 $@ ++libamplsolver.dylib: amplsolver.a ++ $(CC) -fpic -shared -Wl,-all_load amplsolver.a $(LDFLAGS) -o libamplsolver.dylib + + Aslh = arith.h asl.h funcadd.h stdio1.h + auxinfo.o libnamsave.o: funcadd.h stdio1.h \ No newline at end of file diff --git a/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix b/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix index cc5d3baf3442..2ee2e831f6e6 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix @@ -4,14 +4,14 @@ }: stdenv.mkDerivation rec { - version = "1.1"; + version = "1.2"; pname = "libbraiding"; src = fetchFromGitHub { owner = "miguelmarco"; repo = "libbraiding"; rev = version; - sha256 = "1n1j58y9jaiv0ya0y4fpfb3b05wv0h6k2babpnk2zifjw26xr366"; + sha256 = "sha256-cgg6rvlOvFqGjgbw6i7QXS+tqvfFd1MkPCEjnW/FyFs="; }; nativeBuildInputs = [ diff --git a/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix index 05470f61dd3e..3bf16057f835 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix @@ -6,17 +6,18 @@ , shared ? true # Compile with ILP64 interface , blas64 ? false +, testers }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "liblapack"; - version = "3.10.1"; + version = "3.11"; src = fetchFromGitHub { owner = "Reference-LAPACK"; repo = "lapack"; - rev = "v${version}"; - sha256 = "07wwydw72gl4fhfqcyc8sbz7ynm0i23pggyfqn0r9a29g7qh8bqs"; + rev = "v${finalAttrs.version}"; + sha256 = "sha256-AYD78u70y8cY19hmM/aDjQEzxO8u9lPWhCFxRe5cqXI="; }; nativeBuildInputs = [ gfortran cmake ]; @@ -30,13 +31,17 @@ stdenv.mkDerivation rec { "-DCBLAS=ON" "-DBUILD_TESTING=ON" ] ++ lib.optional shared "-DBUILD_SHARED_LIBS=ON" - ++ lib.optional blas64 "-DBUILD_INDEX64=ON"; + ++ lib.optional blas64 "-DBUILD_INDEX64=ON" + # Tries to run host platform binaries during the build + # Will likely be disabled by default in 3.12, see: + # https://github.com/Reference-LAPACK/lapack/issues/757 + ++ lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) "-DTEST_FORTRAN_COMPILER=OFF"; passthru = { inherit blas64; }; postInstall = let canonicalExtension = if stdenv.hostPlatform.isLinux - then "${stdenv.hostPlatform.extensions.sharedLibrary}.${lib.versions.major version}" + then "${stdenv.hostPlatform.extensions.sharedLibrary}.${lib.versions.major finalAttrs.version}" else stdenv.hostPlatform.extensions.sharedLibrary; in lib.optionalString blas64 '' ln -s $out/lib/liblapack64${canonicalExtension} $out/lib/liblapack${canonicalExtension} @@ -61,15 +66,18 @@ stdenv.mkDerivation rec { checkPhase = '' runHook preCheck - ctest ${ctestArgs} + ctest ${finalAttrs.ctestArgs} runHook postCheck ''; + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + meta = with lib; { description = "Linear Algebra PACKage"; homepage = "http://www.netlib.org/lapack/"; maintainers = with maintainers; [ markuskowa ]; license = licenses.bsd3; + pkgConfigModules = [ "lapack" ]; platforms = platforms.all; }; -} +}) diff --git a/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix b/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix index b00de428c8d4..a47d8260714a 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix @@ -17,7 +17,7 @@ let # this derivation. However, we should ensure on version bumps # that the CUDA toolkit for `passthru.tests` is still # up-to-date. - version = "1.10.0"; + version = "2.0.0"; device = if cudaSupport then "cuda" else "cpu"; srcs = import ./binary-hashes.nix version; unavailable = throw "libtorch is not available for this platform"; @@ -93,6 +93,7 @@ in stdenv.mkDerivation { meta = with lib; { description = "C++ API of the PyTorch machine learning framework"; homepage = "https://pytorch.org/"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; # Includes CUDA and Intel MKL, but redistributions of the binary are not limited. # https://docs.nvidia.com/cuda/eula/index.html # https://www.intel.com/content/www/us/en/developer/articles/license/onemkl-license-faq.html diff --git a/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix b/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix index 156515f6eb51..83533d89b1e8 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix @@ -1,19 +1,19 @@ version : builtins.getAttr version { - "1.10.0" = { + "2.0.0" = { x86_64-darwin-cpu = { - name = "libtorch-macos-1.10.0.zip"; - url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.10.0.zip"; - hash = "sha256-HSisxHs466c6XwvZEbkV/1kVNBzJOy3uVw9Bh497Vk8="; + name = "libtorch-macos-2.0.0.zip"; + url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.0.zip"; + hash = "sha256-u6y5IeYoiOC0yQ/k6JCChDs9lXWccLxUorgR8L62lkM="; }; x86_64-linux-cpu = { - name = "libtorch-cxx11-abi-shared-with-deps-1.10.0-cpu.zip"; - url = "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.10.0%2Bcpu.zip"; - hash = "sha256-wAtA+AZx3HjaFbsrbyfkSXjYM0BP8H5HwCgyHbgJXJ0="; + name = "libtorch-cxx11-abi-shared-with-deps-2.0.0-cpu.zip"; + url = "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip"; + hash = "sha256-BoZQ2MC1CDVVGfX3SHC3mEpLGWO8XK7AcLcHJXDsXuc="; }; x86_64-linux-cuda = { - name = "libtorch-cxx11-abi-shared-with-deps-1.10.0-cu113.zip"; - url = "https://download.pytorch.org/libtorch/cu113/libtorch-cxx11-abi-shared-with-deps-1.10.0%2Bcu113.zip"; - hash = "sha256-jPylK4j0V8SEQ8cZU+O22P7kQ28wanIB0GkBzRGyTj8="; + name = "libtorch-cxx11-abi-shared-with-deps-2.0.0-cu118.zip"; + url = "https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcu118.zip"; + hash = "sha256-Dpw9kQdA1NI9EOT7JBKwQP4wZT6lizcnKKTQ8WVJCZc="; }; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/libtorch/prefetch.sh b/nixpkgs/pkgs/development/libraries/science/math/libtorch/prefetch.sh index 26b24198e235..5c6d60ae8b20 100755 --- a/nixpkgs/pkgs/development/libraries/science/math/libtorch/prefetch.sh +++ b/nixpkgs/pkgs/development/libraries/science/math/libtorch/prefetch.sh @@ -6,7 +6,7 @@ set -eou pipefail version=$1 bucket="https://download.pytorch.org/libtorch" -CUDA_VERSION=cu113 +CUDA_VERSION=cu116 url_and_key_list=( "x86_64-darwin-cpu $bucket/cpu/libtorch-macos-${version}.zip libtorch-macos-${version}.zip" diff --git a/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix b/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix index 2a46e22b60d2..214f27046527 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix @@ -35,5 +35,7 @@ stdenv.mkDerivation rec { license = licenses.gpl2Plus; maintainers = teams.sage.members; platforms = platforms.unix; + # never built on aarch64-darwin since first introduction in nixpkgs + broken = stdenv.isDarwin && stdenv.isAarch64; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix index 05d7d4fa1842..9eb410595974 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix @@ -1,76 +1,53 @@ -{ lib, stdenv, fetchurl, cmake, gfortran, ninja, cudaPackages, libpthreadstubs, lapack, blas }: +args@{ callPackage +, lib +, ... +}: + +# Type aliases +# Release = { +# version: String +# hash: String +# supportedGpuTargets: List String +# } let - inherit (cudaPackages) cudatoolkit; -in - -assert let majorIs = lib.versions.major cudatoolkit.version; - in majorIs == "9" || majorIs == "10" || majorIs == "11"; - -let - version = "2.6.2"; - - # We define a specific set of CUDA compute capabilities here, - # because CUDA 11 does not support compute capability 3.0. Also, - # we use it to enable newer capabilities that are not enabled - # by magma by default. The list of supported architectures - # can be found in magma's top-level CMakeLists.txt. - cudaCapabilities = rec { - cuda9 = [ - "Kepler" # 3.0, 3.5 - "Maxwell" # 5.0 - "Pascal" # 6.0 - "Volta" # 7.0 - ]; - - cuda10 = [ - "Turing" # 7.5 - ] ++ cuda9; - - cuda11 = [ - "sm_35" # sm_30 is not supported by CUDA 11 - "Maxwell" # 5.0 - "Pascal" # 6.0 - "Volta" # 7.0 - "Turing" # 7.5 - "Ampere" # 8.0 - ]; + inherit (lib) lists strings trivial; + + computeName = version: "magma_${strings.replaceStrings [ "." ] [ "_" ] version}"; + + # buildMagmaPackage :: Release -> Derivation + buildMagmaPackage = magmaRelease: callPackage ./generic.nix ( + (builtins.removeAttrs args [ "callPackage" ]) // { + inherit magmaRelease; + } + ); + + # Reverse the list to have the latest release first + # magmaReleases :: List Release + magmaReleases = lists.reverseList (builtins.import ./releases.nix); + + # The latest release is the first element of the list and will be our default choice + # latestReleaseName :: String + latestReleaseName = computeName (builtins.head magmaReleases).version; + + # Function to transform our releases into build attributes + # toBuildAttrs :: Release -> { name: String, value: Derivation } + toBuildAttrs = release: { + name = computeName release.version; + value = buildMagmaPackage release; }; - capabilityString = lib.strings.concatStringsSep "," - cudaCapabilities."cuda${lib.versions.major cudatoolkit.version}"; + # Add all supported builds as attributes + # allBuilds :: AttrSet String Derivation + allBuilds = builtins.listToAttrs (lists.map toBuildAttrs magmaReleases); -in stdenv.mkDerivation { - pname = "magma"; - inherit version; - src = fetchurl { - url = "https://icl.cs.utk.edu/projectsfiles/magma/downloads/magma-${version}.tar.gz"; - hash = "sha256-dbVU2rAJA+LRC5cskT5Q5/iMvGLzrkMrWghsfk7aCnE="; - name = "magma-${version}.tar.gz"; - }; + # The latest release will be our default build + # defaultBuild :: AttrSet String Derivation + defaultBuild.magma = allBuilds.${latestReleaseName}; - nativeBuildInputs = [ gfortran cmake ninja ]; - - buildInputs = [ cudatoolkit libpthreadstubs lapack blas ]; - - cmakeFlags = [ "-DGPU_TARGET=${capabilityString}" ]; - - doCheck = false; - - preConfigure = '' - export CC=${cudatoolkit.cc}/bin/gcc CXX=${cudatoolkit.cc}/bin/g++ - ''; - - enableParallelBuilding=true; - buildFlags = [ "magma" "magma_sparse" ]; + # builds :: AttrSet String Derivation + builds = allBuilds // defaultBuild; +in - meta = with lib; { - description = "Matrix Algebra on GPU and Multicore Architectures"; - license = licenses.bsd3; - homepage = "http://icl.cs.utk.edu/magma/index.html"; - platforms = platforms.unix; - maintainers = with maintainers; [ tbenst ]; - }; +builds - passthru.cudatoolkit = cudatoolkit; -} diff --git a/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix new file mode 100644 index 000000000000..49efda96829c --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix @@ -0,0 +1,180 @@ +# Type aliases +# Release = { +# version: String +# hash: String +# supportedGpuTargets: List String +# } + +{ blas +, cmake +, cudaPackages + # FIXME: cuda being unfree means ofborg won't eval "magma". + # respecting config.cudaSupport -> false by default + # -> ofborg eval -> throws "no GPU targets specified". + # Probably should delete everything but "magma-cuda" and "magma-hip" + # from all-packages.nix +, cudaSupport ? true +, fetchurl +, gfortran +, cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities +, gpuTargets ? [ ] # Non-CUDA targets, that is HIP +, hip +, hipblas +, hipsparse +, lapack +, lib +, libpthreadstubs +, magmaRelease +, ninja +, openmp +, rocmSupport ? false +, stdenv +, symlinkJoin +}: + + +let + inherit (lib) lists strings trivial; + inherit (cudaPackages) backendStdenv cudaFlags cudaVersion; + inherit (magmaRelease) version hash supportedGpuTargets; + + # NOTE: The lists.subtractLists function is perhaps a bit unintuitive. It subtracts the elements + # of the first list *from* the second list. That means: + # lists.subtractLists a b = b - a + + # For ROCm + # NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like cudaFlags.realArches. + # For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must + # remove it. + rocmArches = lists.map (x: strings.removePrefix "gfx" x) hip.gpuTargets; + supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets; + unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches; + + supportedCustomGpuTargets = lists.intersectLists gpuTargets supportedGpuTargets; + unsupportedCustomGpuTargets = lists.subtractLists supportedCustomGpuTargets gpuTargets; + + # Use trivial.warnIf to print a warning if any unsupported GPU targets are specified. + gpuArchWarner = supported: unsupported: + trivial.throwIf (supported == [ ]) + ( + "No supported GPU targets specified. Requested GPU targets: " + + strings.concatStringsSep ", " unsupported + ) + supported; + + gpuTargetString = strings.concatStringsSep "," ( + if gpuTargets != [ ] then + # If gpuTargets is specified, it always takes priority. + gpuArchWarner supportedCustomGpuTargets unsupportedCustomGpuTargets + else if rocmSupport then + gpuArchWarner supportedRocmArches unsupportedRocmArches + else if cudaSupport then + [ ] # It's important we pass explicit -DGPU_TARGET to reset magma's defaults + else + throw "No GPU targets specified" + ); + + # E.g. [ "80" "86" "90" ] + cudaArchitectures = (builtins.map cudaFlags.dropDot cudaCapabilities); + + cudaArchitecturesString = strings.concatStringsSep ";" cudaArchitectures; + minArch = + let + minArch' = builtins.head (builtins.sort strings.versionOlder cudaArchitectures); + in + # "75" -> "750" Cf. https://bitbucket.org/icl/magma/src/f4ec79e2c13a2347eff8a77a3be6f83bc2daec20/CMakeLists.txt#lines-273 + "${minArch'}0"; + + cuda-common-redist = with cudaPackages; [ + libcublas # cublas_v2.h + libcusparse # cusparse.h + ]; + + # Build-time dependencies + cuda-native-redist = symlinkJoin { + name = "cuda-native-redist-${cudaVersion}"; + paths = with cudaPackages; [ + cuda_cudart # cuda_runtime.h + cuda_nvcc + ] ++ lists.optionals (strings.versionOlder cudaVersion "11.8") [ + cuda_nvprof # <cuda_profiler_api.h> + ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ + cuda_profiler_api # <cuda_profiler_api.h> + ] ++ cuda-common-redist; + }; + + # Run-time dependencies + cuda-redist = symlinkJoin { + name = "cuda-redist-${cudaVersion}"; + paths = cuda-common-redist; + }; +in + +assert (builtins.match "[^[:space:]]*" gpuTargetString) != null; + +stdenv.mkDerivation { + pname = "magma"; + inherit version; + + src = fetchurl { + name = "magma-${version}.tar.gz"; + url = "https://icl.cs.utk.edu/projectsfiles/magma/downloads/magma-${version}.tar.gz"; + inherit hash; + }; + + nativeBuildInputs = [ + cmake + ninja + gfortran + ] ++ lists.optionals cudaSupport [ + cuda-native-redist + ]; + + buildInputs = [ + libpthreadstubs + lapack + blas + ] ++ lists.optionals cudaSupport [ + cuda-redist + ] ++ lists.optionals rocmSupport [ + hip + hipblas + hipsparse + openmp + ]; + + cmakeFlags = [ + "-DGPU_TARGET=${gpuTargetString}" + ] ++ lists.optionals cudaSupport [ + "-DCMAKE_CUDA_ARCHITECTURES=${cudaArchitecturesString}" + "-DMIN_ARCH=${minArch}" # Disarms magma's asserts + "-DCMAKE_C_COMPILER=${backendStdenv.cc}/bin/cc" + "-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++" + "-DMAGMA_ENABLE_CUDA=ON" + ] ++ lists.optionals rocmSupport [ + "-DCMAKE_C_COMPILER=${hip}/bin/hipcc" + "-DCMAKE_CXX_COMPILER=${hip}/bin/hipcc" + "-DMAGMA_ENABLE_HIP=ON" + ]; + + buildFlags = [ + "magma" + "magma_sparse" + ]; + + doCheck = false; + + passthru = { + inherit cudaPackages cudaSupport; + }; + + meta = with lib; { + description = "Matrix Algebra on GPU and Multicore Architectures"; + license = licenses.bsd3; + homepage = "http://icl.cs.utk.edu/magma/index.html"; + platforms = platforms.unix; + maintainers = with maintainers; [ connorbaker ]; + # CUDA and ROCm are mutually exclusive + broken = cudaSupport && rocmSupport || cudaSupport && strings.versionOlder cudaVersion "9"; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/magma/releases.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/releases.nix new file mode 100644 index 000000000000..029f418edce3 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/magma/releases.nix @@ -0,0 +1,69 @@ +# NOTE: Order matters! Put the oldest version first, and the newest version last. +# NOTE: Make sure the supportedGpuTargets are in order of oldest to newest. +# You can update the supportedGpuTargets by looking at the CMakeLists.txt file. +# HIP is here: https://bitbucket.org/icl/magma/src/f4ec79e2c13a2347eff8a77a3be6f83bc2daec20/CMakeLists.txt#lines-386 +# CUDA works around magma's wrappers and uses FindCUDAToolkit directly +[ + { + version = "2.6.2"; + hash = "sha256-dbVU2rAJA+LRC5cskT5Q5/iMvGLzrkMrWghsfk7aCnE="; + supportedGpuTargets = [ + "700" + "701" + "702" + "703" + "704" + "705" + "801" + "802" + "803" + "805" + "810" + "900" + "902" + "904" + "906" + "908" + "909" + "90c" + "1010" + "1011" + "1012" + "1030" + "1031" + "1032" + "1033" + ]; + } + { + version = "2.7.1"; + hash = "sha256-2chxHAR6OMrhbv3nS+4uszMyF/0nEeHpuGBsu7SuGlA="; + supportedGpuTargets = [ + "700" + "701" + "702" + "703" + "704" + "705" + "801" + "802" + "803" + "805" + "810" + "900" + "902" + "904" + "906" + "908" + "909" + "90c" + "1010" + "1011" + "1012" + "1030" + "1031" + "1032" + "1033" + ]; + } +] diff --git a/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix b/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix index dc68abe38c36..585f4c3a14e3 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix @@ -4,7 +4,7 @@ , stdenvNoCC , fetchurl , rpmextract -, undmg +, _7zz , darwin , validatePkgConfig , enableStatic ? stdenv.hostPlatform.isStatic @@ -19,48 +19,47 @@ let # https://registrationcenter.intel.com/en/products/ version = "${mklVersion}.${rel}"; - # Darwin is pinned to 2019.3 because the DMG does not unpack; see here for details: - # https://github.com/matthewbauer/undmg/issues/4 - mklVersion = if stdenvNoCC.isDarwin then "2019.3" else "2021.1.1"; - rel = if stdenvNoCC.isDarwin then "199" else "52"; + mklVersion = "2023.1.0"; + rel = if stdenvNoCC.isDarwin then "43558" else "46342"; # Intel openmp uses its own versioning. - openmpVersion = if stdenvNoCC.isDarwin then "19.0.3" else "19.1.3"; - openmpRel = "189"; + openmpVersion = "2023.1.0"; + openmpRel = "46305"; # Thread Building Blocks release. - tbbRel = "119"; + tbbVersion = "2021.9.0"; + tbbRel = "43484"; shlibExt = stdenvNoCC.hostPlatform.extensions.sharedLibrary; oneapi-mkl = fetchurl { url = "https://yum.repos.intel.com/oneapi/intel-oneapi-mkl-${mklVersion}-${mklVersion}-${rel}.x86_64.rpm"; - hash = "sha256-G2Y7iX3UN2YUJhxcMM2KmhONf0ls9owpGlOo8hHOfqA="; + hash = "sha256-BeI5zB0rrE6C21dezNc7/WSKmTWpjsZbpg0/y0Y87VQ="; }; oneapi-mkl-common = fetchurl { url = "https://yum.repos.intel.com/oneapi/intel-oneapi-mkl-common-${mklVersion}-${mklVersion}-${rel}.noarch.rpm"; - hash = "sha256-HrMt2OcPIRxM8EL8SPjYTyuHJnC7RhPFUrvLhRH+7vc="; + hash = "sha256-NjIqTeFppwjXFlPYHPHfZa/bWBiHJru3atC4fIMXN0w="; }; oneapi-mkl-common-devel = fetchurl { url = "https://yum.repos.intel.com/oneapi/intel-oneapi-mkl-common-devel-${mklVersion}-${mklVersion}-${rel}.noarch.rpm"; - hash = "sha256-XDE2WFJzEcpujFmO2AvqQdipZMvKB6/G+ksBe2sE438="; + hash = "sha256-GX19dlvBWRgwSOCmWcEOrnbmp4S2j0448fWpx+iPVWw="; }; oneapi-mkl-devel = fetchurl { url = "https://yum.repos.intel.com/oneapi/intel-oneapi-mkl-devel-${mklVersion}-${mklVersion}-${rel}.x86_64.rpm"; - hash = "sha256-GhUJZ0Vr/ZXp10maie29/5ryU7zzX3F++wRCuuFcE0s="; + hash = "sha256-F4XxtSPAjNaShEL/l44jJK+JdOOkYI19X/njRB6FkNw="; }; oneapi-openmp = fetchurl { url = "https://yum.repos.intel.com/oneapi/intel-oneapi-openmp-${mklVersion}-${mklVersion}-${openmpRel}.x86_64.rpm"; - hash = "sha256-yP2c4aQAFNRffjLoIZgWXLcNXbiez8smsgu2wXitefU="; + hash = "sha256-1SlkI01DxFvwGPBJ73phs86ka0SmCrniwiXQ9DJwIXw="; }; oneapi-tbb = fetchurl { - url = "https://yum.repos.intel.com/oneapi/intel-oneapi-tbb-${mklVersion}-${mklVersion}-${tbbRel}.x86_64.rpm"; - hash = "sha256-K1BvhGoGVU2Zwy5vg2ZvJWBrSdh5uQwo0znt5039X0A="; + url = "https://yum.repos.intel.com/oneapi/intel-oneapi-tbb-${tbbVersion}-${tbbVersion}-${tbbRel}.x86_64.rpm"; + hash = "sha256-wIktdf1p1SS1KrnUlc8LPkm0r9dhZE6cQNr4ZKTWI6A="; }; in stdenvNoCC.mkDerivation ({ @@ -69,16 +68,22 @@ in stdenvNoCC.mkDerivation ({ dontUnpack = stdenvNoCC.isLinux; + unpackPhase = if stdenvNoCC.isDarwin then '' + 7zz x $src + '' else null; + nativeBuildInputs = [ validatePkgConfig ] ++ (if stdenvNoCC.isDarwin then - [ undmg darwin.cctools ] + [ _7zz darwin.cctools ] else [ rpmextract ]); buildPhase = if stdenvNoCC.isDarwin then '' - for f in Contents/Resources/pkg/*.tgz; do - tar xzvf $f + for f in bootstrapper.app/Contents/Resources/packages/*/cupPayload.cup; do + tar -xf $f done + mkdir -p opt/intel + mv _installdir opt/intel/oneapi '' else '' rpmextract ${oneapi-mkl} rpmextract ${oneapi-mkl-common} @@ -88,32 +93,7 @@ in stdenvNoCC.mkDerivation ({ rpmextract ${oneapi-tbb} ''; - installPhase = if stdenvNoCC.isDarwin then '' - for f in $(find . -name 'mkl*.pc') ; do - bn=$(basename $f) - substituteInPlace $f \ - --replace "prefix=<INSTALLDIR>/mkl" "prefix=$out" \ - --replace $\{MKLROOT} "$out" \ - --replace "lib/intel64_lin" "lib" \ - --replace "lib/intel64" "lib" - done - for f in $(find opt/intel -name 'mkl*iomp.pc') ; do - substituteInPlace $f \ - --replace "../compiler/lib" "lib" - done - - mkdir -p $out/lib - - cp -r compilers_and_libraries_${version}/mac/mkl/include $out/ - - cp -r compilers_and_libraries_${version}/licensing/mkl/en/license.txt $out/lib/ - cp -r compilers_and_libraries_${version}/mac/compiler/lib/* $out/lib/ - cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/ - cp -r compilers_and_libraries_${version}/mac/tbb/lib/* $out/lib/ - - mkdir -p $out/lib/pkgconfig - cp -r compilers_and_libraries_${version}/mac/mkl/bin/pkgconfig/* $out/lib/pkgconfig - '' else '' + installPhase = '' for f in $(find . -name 'mkl*.pc') ; do bn=$(basename $f) substituteInPlace $f \ @@ -128,22 +108,26 @@ in stdenvNoCC.mkDerivation ({ done # License - install -Dm0655 -t $out/share/doc/mkl opt/intel/oneapi/mkl/2021.1.1/licensing/en/license.txt + install -Dm0655 -t $out/share/doc/mkl opt/intel/oneapi/mkl/${mklVersion}/licensing/license.txt # Dynamic libraries - install -Dm0755 -t $out/lib opt/intel/oneapi/mkl/${mklVersion}/lib/intel64/*.so* - install -Dm0755 -t $out/lib opt/intel/oneapi/compiler/2021.1.1/linux/compiler/lib/intel64_lin/*.so* - install -Dm0755 -t $out/lib opt/intel/oneapi/tbb/2021.1.1/lib/intel64/gcc4.8/*.so* + mkdir -p $out/lib + cp -a opt/intel/oneapi/mkl/${mklVersion}/lib/${lib.optionalString stdenvNoCC.isLinux "intel64"}/*${shlibExt}* $out/lib + cp -a opt/intel/oneapi/compiler/${mklVersion}/${if stdenvNoCC.isDarwin then "mac" else "linux"}/compiler/lib/${lib.optionalString stdenvNoCC.isLinux "intel64_lin"}/*${shlibExt}* $out/lib + cp -a opt/intel/oneapi/tbb/${tbbVersion}/lib/${lib.optionalString stdenvNoCC.isLinux "intel64/gcc4.8"}/*${shlibExt}* $out/lib # Headers cp -r opt/intel/oneapi/mkl/${mklVersion}/include $out/ + + # CMake config + cp -r opt/intel/oneapi/mkl/${mklVersion}/lib/cmake $out/lib '' + (if enableStatic then '' - install -Dm0644 -t $out/lib opt/intel/oneapi/mkl/${mklVersion}/lib/intel64/*.a - install -Dm0644 -t $out/lib/pkgconfig opt/intel/oneapi/mkl/2021.1.1/tools/pkgconfig/*.pc + install -Dm0644 -t $out/lib opt/intel/oneapi/mkl/${mklVersion}/lib/${lib.optionalString stdenvNoCC.isLinux "intel64"}/*.a + install -Dm0644 -t $out/lib/pkgconfig opt/intel/oneapi/mkl/${mklVersion}/lib/pkgconfig/*.pc '' else '' - cp opt/intel/oneapi/mkl/${mklVersion}/lib/intel64/*.so* $out/lib - install -Dm0644 -t $out/lib/pkgconfig opt/intel/oneapi/mkl/2021.1.1/tools/pkgconfig/*dynamic*.pc + cp opt/intel/oneapi/mkl/${mklVersion}/lib/${lib.optionalString stdenvNoCC.isLinux "intel64"}/*${shlibExt}* $out/lib + install -Dm0644 -t $out/lib/pkgconfig opt/intel/oneapi/mkl/${mklVersion}/lib/pkgconfig/*dynamic*.pc '') + '' # Setup symlinks for blas / lapack ln -s $out/lib/libmkl_rt${shlibExt} $out/lib/libblas${shlibExt} @@ -165,8 +149,8 @@ in stdenvNoCC.mkDerivation ({ install_name_tool -id $out/lib/$(basename $f) $f || true done install_name_tool -change @rpath/libiomp5.dylib $out/lib/libiomp5.dylib $out/lib/libmkl_intel_thread.dylib - install_name_tool -change @rpath/libtbb.dylib $out/lib/libtbb.dylib $out/lib/libmkl_tbb_thread.dylib - install_name_tool -change @rpath/libtbbmalloc.dylib $out/lib/libtbbmalloc.dylib $out/lib/libtbbmalloc_proxy.dylib + install_name_tool -change @rpath/libtbb.12.dylib $out/lib/libtbb.12.dylib $out/lib/libmkl_tbb_thread.dylib + install_name_tool -change @rpath/libtbbmalloc.2.dylib $out/lib/libtbbmalloc.2.dylib $out/lib/libtbbmalloc_proxy.dylib ''; # Per license agreement, do not modify the binary @@ -196,7 +180,7 @@ in stdenvNoCC.mkDerivation ({ }; } // lib.optionalAttrs stdenvNoCC.isDarwin { src = fetchurl { - url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15235/m_mkl_${version}.dmg"; - sha256 = "14b3ciz7995sqcd6jz7hc8g2x4zwvqxmgxgni46vrlb7n523l62f"; + url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/087a9190-9d96-4b8c-bd2f-79159572ed89/m_onemkl_p_${mklVersion}.${rel}_offline.dmg"; + hash = "sha256-bUaaJPSaLr60fw0DzDCjPvY/UucHlLbCSLyQxyiAi04="; }; }) diff --git a/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix b/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix index 7dd52f3b663d..e48658b19b82 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix @@ -1,30 +1,67 @@ -{ lib, stdenv +{ lib +, stdenv , fetchFromGitHub +, fetchpatch , cmake +, blas }: +let + suitesparseVersion = "7.0.1"; +in stdenv.mkDerivation rec { pname = "mongoose"; - version = "2.0.4"; + version = "3.0.4"; outputs = [ "bin" "out" "dev" ]; src = fetchFromGitHub { - owner = "ScottKolo"; - repo = "Mongoose"; - rev = "v${version}"; - sha256 = "0ymwd4n8p8s0ndh1vcbmjcsm0x2cc2b7v3baww5y6as12873bcrh"; + owner = "DrTimothyAldenDavis"; + repo = "SuiteSparse"; + rev = "v${suitesparseVersion}"; + hash = "sha256-EIreweeOx44YDxlnxnJ7l31Ie1jSx6y87VAyEX+4NsQ="; }; nativeBuildInputs = [ cmake ]; + buildInputs = [ + blas + ]; + + dontUseCmakeConfigure = true; + + cmakeFlags = [ + "-DBLAS_LIBRARIES=${blas}" + "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON" + ]; + + buildPhase = '' + runHook preConfigure + + for f in SuiteSparse_config Mongoose; do + (cd $f && cmakeConfigurePhase && make -j$NIX_BUILD_CORES) + done + + runHook postConfigure + ''; + + installPhase = '' + runHook preInstall + + for f in SuiteSparse_config Mongoose; do + (cd $f/build && make install -j$NIX_BUILD_CORES) + done + + runHook postInstall + ''; + meta = with lib; { description = "Graph Coarsening and Partitioning Library"; - homepage = "https://github.com/ScottKolo/Mongoose"; - license = licenses.gpl3; - maintainers = with maintainers; []; + homepage = "https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/Mongoose"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ wegank ]; platforms = with platforms; unix; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix index 41dddf2391ac..155e863bf21e 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix @@ -1,28 +1,53 @@ -{ lib, stdenv, fetchFromGitHub, which, cudatoolkit, addOpenGLRunpath }: +{ lib +, backendStdenv +, fetchFromGitHub +, which +, cudaPackages ? { } +, addOpenGLRunpath +}: -stdenv.mkDerivation rec { - name = "nccl-${version}-cuda-${cudatoolkit.majorVersion}"; - version = "2.12.10-1"; +with cudaPackages; + +let + # Output looks like "-gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86" + gencode = lib.concatStringsSep " " cudaFlags.gencode; +in +backendStdenv.mkDerivation rec { + name = "nccl-${version}-cuda-${cudaPackages.cudaMajorVersion}"; + version = "2.16.5-1"; src = fetchFromGitHub { owner = "NVIDIA"; repo = "nccl"; rev = "v${version}"; - sha256 = "sha256-QqORzm0gD+QG+P8rId8bQn2oZsxL5YyxCIobUVs85wE="; + hash = "sha256-JyhhYKSVIqUKIbC1rCJozPT1IrIyRLGrTjdPjJqsYaU="; }; outputs = [ "out" "dev" ]; - nativeBuildInputs = [ which addOpenGLRunpath ]; + nativeBuildInputs = [ + which + addOpenGLRunpath + cuda_nvcc + ]; - buildInputs = [ cudatoolkit ]; + buildInputs = [ + cuda_cudart + ] ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0.0") [ + cuda_cccl + ]; preConfigure = '' patchShebangs src/collectives/device/gen_rules.sh + makeFlagsArray+=( + "NVCC_GENCODE=${gencode}" + ) ''; makeFlags = [ - "CUDA_HOME=${cudatoolkit}" + "CUDA_HOME=${cuda_nvcc}" + "CUDA_LIB=${cuda_cudart}/lib64" + "CUDA_INC=${cuda_cudart}/include" "PREFIX=$(out)" ]; @@ -34,12 +59,12 @@ stdenv.mkDerivation rec { addOpenGLRunpath $out/lib/lib*.so ''; - NIX_CFLAGS_COMPILE = [ "-Wno-unused-function" ]; + env.NIX_CFLAGS_COMPILE = toString [ "-Wno-unused-function" ]; enableParallelBuilding = true; passthru = { - inherit cudatoolkit; + inherit cudaPackages; }; meta = with lib; { diff --git a/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix index 8e5d71801158..950402315a9b 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, perl, which +{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, which # 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). @@ -23,9 +23,14 @@ , enableAVX512 ? false , enableStatic ? stdenv.hostPlatform.isStatic , enableShared ? !stdenv.hostPlatform.isStatic -}: -with lib; +# for passthru.tests +, ceres-solver +, giac +, octave +, opencv +, python3 +}: let blas64_ = blas64; in @@ -101,6 +106,13 @@ let DYNAMIC_ARCH = setDynamicArch false; USE_OPENMP = true; }; + + loongarch64-linux = { + BINARY = 64; + TARGET = setTarget "LOONGSONGENERIC"; + DYNAMIC_ARCH = setDynamicArch false; + USE_OPENMP = true; + }; }; in @@ -114,7 +126,7 @@ let blas64 = if blas64_ != null then blas64_ - else hasPrefix "x86_64" stdenv.hostPlatform.system; + else lib.hasPrefix "x86_64" stdenv.hostPlatform.system; # Convert flag values to format OpenBLAS's build expects. # `toString` is almost what we need other than bools, # which we need to map {true -> 1, false -> 0} @@ -122,14 +134,14 @@ let mkMakeFlagValue = val: if !builtins.isBool val then toString val else if val then "1" else "0"; - mkMakeFlagsFromConfig = mapAttrsToList (var: val: "${var}=${mkMakeFlagValue val}"); + mkMakeFlagsFromConfig = lib.mapAttrsToList (var: val: "${var}=${mkMakeFlagValue val}"); shlibExt = stdenv.hostPlatform.extensions.sharedLibrary; in stdenv.mkDerivation rec { pname = "openblas"; - version = "0.3.20"; + version = "0.3.21"; outputs = [ "out" "dev" ]; @@ -137,9 +149,23 @@ stdenv.mkDerivation rec { owner = "xianyi"; repo = "OpenBLAS"; rev = "v${version}"; - sha256 = "sha256-FLPVcepf7tv/es+4kur9Op7o3iVAAayuYN4hY/P4mmQ="; + sha256 = "sha256-F6cXPqQai4kA5zrsa8E0Q7dD9zZHlwZ+B16EOGNXoXs="; }; + patches = lib.optionals stdenv.hostPlatform.isLoongArch64 [ + # https://github.com/xianyi/OpenBLAS/pull/3626 + (fetchpatch { + name = "openblas-0.3.21-fix-loong.patch"; + url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/openblas/files/openblas-0.3.21-fix-loong.patch?id=37ee4c70278eb41181f69e175575b0152b941655"; + hash = "sha256-iWy11l3wEvzNV08LbhOjnSPj1SjPH8RMnb3ORz7V+gc"; + }) + ]; + + postPatch = '' + # cc1: error: invalid feature modifier 'sve2' in '-march=armv8.5-a+sve+sve2+bf16' + substituteInPlace Makefile.arm64 --replace "+sve2+bf16" "" + ''; + inherit blas64; # Some hardening features are disabled due to sporadic failures in @@ -167,10 +193,13 @@ stdenv.mkDerivation rec { buildPackages.stdenv.cc ]; + enableParallelBuilding = true; + makeFlags = mkMakeFlagsFromConfig (config // { FC = "${stdenv.cc.targetPrefix}gfortran"; CC = "${stdenv.cc.targetPrefix}${if stdenv.cc.isClang then "clang" else "cc"}"; PREFIX = placeholder "out"; + OPENBLAS_INCLUDE_DIR = "${placeholder "dev"}/include"; NUM_THREADS = 64; INTERFACE64 = blas64; NO_STATIC = !enableStatic; @@ -184,6 +213,10 @@ stdenv.mkDerivation rec { NO_BINARY_MODE = if stdenv.isx86_64 then toString (stdenv.hostPlatform != stdenv.buildPlatform) else stdenv.hostPlatform != stdenv.buildPlatform; + # This disables automatic build job count detection (which honours neither enableParallelBuilding nor NIX_BUILD_CORES) + # and uses the main make invocation's job count, falling back to 1 if no parallelism is used. + # https://github.com/xianyi/OpenBLAS/blob/v0.3.20/getarch.c#L1781-L1792 + MAKE_NB_JOBS = 0; } // (lib.optionalAttrs singleThreaded { # As described on https://github.com/xianyi/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded USE_THREAD = false; @@ -202,7 +235,7 @@ stdenv.mkDerivation rec { Name: $alias Version: ${version} Description: $alias provided by the OpenBLAS package. -Cflags: -I$out/include +Cflags: -I$dev/include Libs: -L$out/lib -lopenblas EOF done @@ -225,11 +258,16 @@ EOF ln -s $out/lib/libopenblas.a $out/lib/liblapacke.a ''; + passthru.tests = { + inherit (python3.pkgs) numpy scipy; + inherit ceres-solver giac octave opencv; + }; + meta = with lib; { description = "Basic Linear Algebra Subprograms"; license = licenses.bsd3; homepage = "https://github.com/xianyi/OpenBLAS"; - platforms = platforms.unix; + platforms = attrNames configs; maintainers = with maintainers; [ ttuegel ]; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix b/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix index 20978e31cff1..92588307ca57 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix @@ -1,109 +1,114 @@ -{ lib -, stdenv -, fetchFromGitHub -, cmake -, abseil-cpp +{ abseil-cpp , bzip2 -, zlib -, lsb-release -, which -, protobuf , cbc +, cmake +, eigen , ensureNewerSourcesForZipFilesHook +, fetchFromGitHub +, fetchpatch +, glpk +, lib +, pkg-config +, protobuf , python +, re2 +, stdenv , swig4 +, unzip +, zlib }: stdenv.mkDerivation rec { pname = "or-tools"; - version = "9.1"; - disabled = python.pythonOlder "3.6"; # not supported upstream + version = "9.4"; src = fetchFromGitHub { owner = "google"; repo = "or-tools"; rev = "v${version}"; - sha256 = "sha256-dEYMPWpa3J9EqtCq3kubdUYJivNRTOKUpNDx3UC1IcQ="; + sha256 = "sha256-joWonJGuxlgHhXLznRhC1MDltQulXzpo4Do9dec1bLY="; }; - - # The original build system uses cmake which does things like pull - # in dependencies through git and Makefile creation time. We - # obviously don't want to do this so instead we provide the - # dependencies straight from nixpkgs and use the make build method. - - # Cbc is linked against bzip2 and declares this in its pkgs-config file, - # but this makefile doesn't use pkgs-config, so we also have to add lbz2 - configurePhase = '' - substituteInPlace makefiles/Makefile.third_party.unix.mk \ - --replace 'COINUTILS_LNK = $(STATIC_COINUTILS_LNK)' \ - 'COINUTILS_LNK = $(STATIC_COINUTILS_LNK) -lbz2' - - cat <<EOF > Makefile.local - UNIX_ABSL_DIR=${abseil-cpp} - UNIX_PROTOBUF_DIR=${protobuf} - UNIX_CBC_DIR=${cbc} - USE_SCIP=OFF - EOF - ''; - - # Many of these 'samples' (which are really the tests) require using SCIP, and or-tools 8.1 - # will just crash if SCIP is not found because it doesn't fall back to using one of - # the available solvers: https://github.com/google/or-tools/blob/b77bd3ac69b7f3bb02f55b7bab6cbb4bab3917f2/ortools/linear_solver/linear_solver.cc#L427 - # We don't compile with SCIP because it does not have an open source license. - # See https://github.com/google/or-tools/issues/2395 - preBuild = '' - for file in ortools/linear_solver/samples/*.cc; do - if grep -q SCIP_MIXED_INTEGER_PROGRAMMING $file; then - substituteInPlace $file --replace SCIP_MIXED_INTEGER_PROGRAMMING CBC_MIXED_INTEGER_PROGRAMMING - fi; - done - - substituteInPlace ortools/linear_solver/samples/simple_mip_program.cc \ - --replace 'SCIP' 'CBC' - ''; - makeFlags = [ - "prefix=${placeholder "out"}" - "PROTOBUF_PYTHON_DESC=${python.pkgs.protobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py" + patches = [ + # Disable test that requires external input: https://github.com/google/or-tools/issues/3429 + (fetchpatch { + url = "https://github.com/google/or-tools/commit/7072ae92ec204afcbfce17d5360a5884c136ce90.patch"; + hash = "sha256-iWE+atp308q7pC1L1FD6sK8LvWchZ3ofxvXssguozbM="; + }) + # Fix test that broke in parallel builds: https://github.com/google/or-tools/issues/3461 + (fetchpatch { + url = "https://github.com/google/or-tools/commit/a26602f24781e7bfcc39612568aa9f4010bb9736.patch"; + hash = "sha256-gM0rW0xRXMYaCwltPK0ih5mdo3HtX6mKltJDHe4gbLc="; + }) + # Backport fix in cmake test configuration where pip installs newer version from PyPi over local build, + # breaking checkPhase: https://github.com/google/or-tools/issues/3260 + (fetchpatch { + url = "https://github.com/google/or-tools/commit/edd1544375bd55f79168db315151a48faa548fa0.patch"; + hash = "sha256-S//1YM3IoRCp3Ghg8zMF0XXgIpVmaw4gH8cVb9eUbqM="; + }) ]; - buildFlags = [ "cc" "pypi_archive" ]; - doCheck = true; - checkTarget = "test_cc"; - - installTargets = [ "install_cc" ]; - # The upstream install_python target installs to $HOME. - postInstall = '' - mkdir -p "$python/${python.sitePackages}" - (cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python') + # or-tools normally attempts to build Protobuf for the build platform when + # cross-compiling. Instead, just tell it where to find protoc. + postPatch = '' + echo "set(PROTOC_PRG $(type -p protoc))" > cmake/host.cmake ''; - # protobuf generation is not thread safe - enableParallelBuilding = false; - + cmakeFlags = [ + "-DBUILD_DEPS=OFF" + "-DBUILD_PYTHON=ON" + "-DBUILD_pybind11=OFF" + "-DFETCH_PYTHON_DEPS=OFF" + "-DUSE_GLPK=ON" + "-DUSE_SCIP=OFF" + "-DPython3_EXECUTABLE=${python.pythonForBuild.interpreter}" + ] ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_MACOSX_RPATH=OFF" ]; nativeBuildInputs = [ cmake - lsb-release - swig4 - which ensureNewerSourcesForZipFilesHook + pkg-config + python.pythonForBuild + swig4 + unzip + ] ++ (with python.pythonForBuild.pkgs; [ + pip + mypy-protobuf + ]); + buildInputs = [ + bzip2 + cbc + eigen + glpk + python.pkgs.absl-py + python.pkgs.pybind11 python.pkgs.setuptools python.pkgs.wheel - ]; - buildInputs = [ + re2 zlib - bzip2 - python ]; propagatedBuildInputs = [ abseil-cpp protobuf - python.pkgs.protobuf - python.pkgs.six - python.pkgs.absl-py - python.pkgs.mypy-protobuf + python.pkgs.numpy + ]; + nativeCheckInputs = [ + python.pkgs.matplotlib + python.pkgs.pandas + python.pkgs.virtualenv ]; + doCheck = true; + + # This extra configure step prevents the installer from littering + # $out/bin with sample programs that only really function as tests, + # and disables the upstream installation of a zipped Python egg that + # can’t be imported with our Python setup. + installPhase = '' + cmake . -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON=OFF -DBUILD_SAMPLES=OFF + cmake --install . + pip install --prefix="$python" python/ + ''; + outputs = [ "out" "python" ]; meta = with lib; { @@ -113,6 +118,6 @@ stdenv.mkDerivation rec { Google's software suite for combinatorial optimization. ''; maintainers = with maintainers; [ andersk ]; - platforms = with platforms; linux; + platforms = with platforms; linux ++ darwin; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/osi/default.nix b/nixpkgs/pkgs/development/libraries/science/math/osi/default.nix index b61cd8406064..8ee048c2819b 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/osi/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/osi/default.nix @@ -1,19 +1,21 @@ -{ stdenv, lib, fetchurl, gfortran, pkg-config -, blas, zlib, bzip2 +{ stdenv, lib, fetchFromGitHub, gfortran, pkg-config +, blas, zlib, bzip2, coin-utils , withGurobi ? false, gurobi , withCplex ? false, cplex }: stdenv.mkDerivation rec { pname = "osi"; - version = "0.108.6"; + version = "0.108.8"; - src = fetchurl { - url = "https://www.coin-or.org/download/source/Osi/Osi-${version}.tgz"; - sha256 = "1n2jlpq4aikbp0ncs16f7q1pj7yk6kny1bh4fmjaqnwrjw63zvsp"; + src = fetchFromGitHub { + owner = "coin-or"; + repo = "Osi"; + rev = "releases/${version}"; + hash = "sha256-Wyxeyn49QWzGvW6bMwCp39iLkB1eMQUEpIxUgpLcxgA="; }; buildInputs = - [ blas zlib bzip2 ] + [ blas zlib bzip2 coin-utils ] ++ lib.optional withGurobi gurobi ++ lib.optional withCplex cplex; nativeBuildInputs = [ gfortran pkg-config ]; @@ -25,7 +27,7 @@ stdenv.mkDerivation rec { lib.optionalString withCplex "-L${cplex}/cplex/bin/${cplex.libArch}"; # Compile errors - NIX_CFLAGS_COMPILE = "-Wno-cast-qual"; + env.NIX_CFLAGS_COMPILE = "-Wno-cast-qual"; hardeningDisable = [ "format" ]; enableParallelBuilding = true; @@ -35,7 +37,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "An abstract base class to a generic linear programming (LP) solver"; homepage = "https://github.com/coin-or/Osi"; - license = licenses.epl10; + license = licenses.epl20; platforms = platforms.unix; maintainers = with maintainers; [ abbradar ]; }; diff --git a/nixpkgs/pkgs/development/libraries/science/math/osqp/default.nix b/nixpkgs/pkgs/development/libraries/science/math/osqp/default.nix index 485ec06773bb..bf22e1d74d93 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/osqp/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/osqp/default.nix @@ -5,13 +5,13 @@ stdenv.mkDerivation rec { pname = "osqp"; - version = "0.6.2"; + version = "0.6.3"; src = fetchFromGitHub { owner = "oxfordcontrol"; repo = "osqp"; rev = "v${version}"; - sha256 = "sha256-RYk3zuZrJXPcF27eMhdoZAio4DZ+I+nFaUEg1g/aLNk="; + sha256 = "sha256-enkK5EFyAeLaUnHNYS3oq43HsHY5IuSLgsYP0k/GW8c="; fetchSubmodules = true; }; diff --git a/nixpkgs/pkgs/development/libraries/science/math/p4est-sc/default.nix b/nixpkgs/pkgs/development/libraries/science/math/p4est-sc/default.nix index eeb1d14b910a..fbd9db6a419f 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/p4est-sc/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/p4est-sc/default.nix @@ -5,7 +5,7 @@ }: let - dbg = if debugEnable then "-dbg" else ""; + dbg = lib.optionalString debugEnable "-dbg"; debugEnable = p4est-sc-debugEnable; mpiSupport = p4est-sc-mpiSupport; isOpenmpi = mpiSupport && mpi.pname == "openmpi"; @@ -35,7 +35,7 @@ stdenv.mkDerivation { ''; preConfigure = '' echo "2.8.0" > .tarball-version - ${if mpiSupport then "unset CC" else ""} + ${lib.optionalString mpiSupport "unset CC"} ''; configureFlags = [ "--enable-pthread=-pthread" ] diff --git a/nixpkgs/pkgs/development/libraries/science/math/p4est/default.nix b/nixpkgs/pkgs/development/libraries/science/math/p4est/default.nix index 9396a9144423..a55c5fe573bf 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/p4est/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/p4est/default.nix @@ -9,7 +9,7 @@ let inherit (p4est-sc) debugEnable mpiSupport; - dbg = if debugEnable then "-dbg" else ""; + dbg = lib.optionalString debugEnable "-dbg"; withMetis = p4est-withMetis; in stdenv.mkDerivation { diff --git a/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix index e847d1decd24..06494a1dddcb 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix @@ -18,11 +18,11 @@ assert petsc-withp4est -> p4est.mpiSupport; stdenv.mkDerivation rec { pname = "petsc"; - version = "3.17.4"; + version = "3.19.1"; src = fetchurl { url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; - sha256 = "sha256-mcEnSGcio//ZWiaLTOsJdsvyF5JsaBqWMb1yRuq4yyo="; + sha256 = "sha256-dNtgxTyAtI1cOeB7w5qIPsztiLnySl3hfPb0hakD4SA="; }; mpiSupport = !withp4est || p4est.mpiSupport; @@ -42,6 +42,12 @@ stdenv.mkDerivation rec { --replace /usr/bin/install_name_tool ${darwin.cctools}/bin/install_name_tool ''; + # Both OpenMPI and MPICH get confused by the sandbox environment and spew errors like this (both to stdout and stderr): + # [hwloc/linux] failed to find sysfs cpu topology directory, aborting linux discovery. + # [1684747490.391106] [localhost:14258:0] tcp_iface.c:837 UCX ERROR opendir(/sys/class/net) failed: No such file or directory + # These messages contaminate test output, which makes the quicktest suite to fail. The patch adds filtering for these messages. + patches = [ ./filter_mpi_warnings.patch ]; + preConfigure = '' export FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran" patchShebangs ./lib/petsc/bin @@ -55,11 +61,11 @@ stdenv.mkDerivation rec { "--with-fc=mpif90" "--with-mpi=1" ''} - ${if withp4est then '' + ${lib.optionalString withp4est '' "--with-p4est=1" "--with-zlib-include=${zlib.dev}/include" "--with-zlib-lib=-L${zlib}/lib -lz" - '' else ""} + ''} "--with-blas=1" "--with-lapack=1" ) @@ -67,11 +73,6 @@ stdenv.mkDerivation rec { configureScript = "python ./configure"; - # disable stackprotector on aarch64-darwin for now - # https://github.com/NixOS/nixpkgs/issues/158730 - # see https://github.com/NixOS/nixpkgs/issues/127608 for a similar issue - hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; - enableParallelBuilding = true; doCheck = stdenv.hostPlatform == stdenv.buildPlatform; diff --git a/nixpkgs/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch b/nixpkgs/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch new file mode 100644 index 000000000000..590528446f61 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch @@ -0,0 +1,100 @@ +diff --git a/src/snes/tutorials/makefile b/src/snes/tutorials/makefile +index 168febb34b6..71068469066 100644 +--- a/src/snes/tutorials/makefile ++++ b/src/snes/tutorials/makefile +@@ -13,6 +13,7 @@ include ${PETSC_DIR}/lib/petsc/conf/rules + # these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed + testex5f: ex5f.PETSc + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex5f_1.tmp; \ + if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \ + echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \ + else \ +@@ -25,6 +26,7 @@ testex5f: ex5f.PETSc + ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm; + testex19: ex19.PETSc + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \ + else \ +@@ -36,6 +38,7 @@ testex19: ex19.PETSc + ${RM} -f ex19_1.tmp; + testex19_mpi: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \ + else \ +@@ -48,6 +51,7 @@ testex19_mpi: + #use unpreconditioned norm because HYPRE device installations use different AMG parameters + runex19_hypre: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \ + else \ +@@ -57,6 +61,7 @@ runex19_hypre: + ${RM} -f ex19_1.tmp + runex19_hypre_cuda: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -dm_vec_type cuda -dm_mat_type aijcusparse -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \ + else \ +@@ -66,6 +71,7 @@ runex19_hypre_cuda: + ${RM} -f ex19_1.tmp + runex19_hypre_hip: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -dm_vec_type hip -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \ + else \ +@@ -75,6 +81,7 @@ runex19_hypre_hip: + ${RM} -f ex19_1.tmp + runex19_cuda: + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -snes_monitor -dm_mat_type seqaijcusparse -dm_vec_type seqcuda -pc_type gamg -pc_gamg_esteig_ksp_max_it 10 -ksp_monitor -mg_levels_ksp_max_it 3 > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \ + else \ +@@ -84,6 +91,7 @@ runex19_cuda: + ${RM} -f ex19_1.tmp + runex19_ml: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_ml.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \ + else \ +@@ -93,6 +101,7 @@ runex19_ml: + ${RM} -f ex19_1.tmp + runex19_fieldsplit_mumps: + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type SCHUR -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -fieldsplit_0_pc_type lu -fieldsplit_1_pc_type lu -snes_monitor_short -ksp_monitor_short -fieldsplit_0_pc_factor_mat_solver_type mumps -fieldsplit_1_pc_factor_mat_solver_type mumps > ex19_6.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_6.tmp; \ + if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \ + else \ +@@ -102,6 +111,7 @@ runex19_fieldsplit_mumps: + ${RM} -f ex19_6.tmp + runex19_superlu_dist: + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist > ex19.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19.tmp; \ + if (${DIFF} output/ex19_superlu.out ex19.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \ + else \ +@@ -111,6 +121,7 @@ runex19_superlu_dist: + ${RM} -f ex19.tmp + runex19_suitesparse: + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19_1.tmp 2>&1; \ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ + if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \ + else \ +@@ -120,6 +131,7 @@ runex19_suitesparse: + ${RM} -f ex19_1.tmp + runex3k_kokkos: ex3k.PETSc + -@OMP_PROC_BIND=false ${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex3k -view_initial -dm_vec_type kokkos -dm_mat_type aijkokkos -use_gpu_aware_mpi 0 -snes_monitor > ex3k_1.tmp 2>&1 ;\ ++ sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex3k_1.tmp; \ + if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \ + echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \ + else \ diff --git a/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix index c0abcf6da659..0d553376288f 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ cmake ]; - checkInputs = [ openssh ]; + nativeCheckInputs = [ openssh ]; buildInputs = [ blas lapack ]; propagatedBuildInputs = [ mpi ]; hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; diff --git a/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix index 6ccbfb11f51f..087f4787a53b 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix @@ -4,13 +4,13 @@ assert (!blas.isILP64) && (!lapack.isILP64); stdenv.mkDerivation rec { pname = "scs"; - version = "3.2.0"; + version = "3.2.3"; src = fetchFromGitHub { owner = "cvxgrp"; repo = "scs"; rev = version; - sha256 = "sha256-ewn7AGNqTXY3bp5itHTfAQ2Es2ZAIbuRFM5U600Px50="; + sha256 = "sha256-0g0r3DNgkPZgag0qtz79Wk3Cre1I2yaabFi3OgUzgfc="; }; # Actually link and add libgfortran to the rpath diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix index 0d5409c6817d..8a00d9ae521e 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix @@ -6,7 +6,7 @@ stdenv.mkDerivation rec { pname = "suitesparse-graphblas"; - version = "7.2.0"; + version = "7.4.4"; outputs = [ "out" "dev" ]; @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { owner = "DrTimothyAldenDavis"; repo = "GraphBLAS"; rev = "v${version}"; - sha256 = "sha256-N3TBuKWQRisXE5DQ0c+N2cv0darQ8mz4g2oe7pKst9E="; + sha256 = "sha256-4NLYNapIiEXntXHrsyq63jIbuBJxR77X3VbLFbvtT9A="; }; nativeBuildInputs = [ diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix index e734ed8ff35a..95eeaeb8abf3 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { "LAPACK=-llapack" ]; - NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin " -DNTIMER"; + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin " -DNTIMER"; postInstall = '' # Build and install shared library diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix index dcf8a1da2586..51b55592d42e 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { pname = "suitesparse"; - version = "5.11.0"; + version = "5.13.0"; outputs = [ "out" "dev" "doc" ]; @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { owner = "DrTimothyAldenDavis"; repo = "SuiteSparse"; rev = "v${version}"; - sha256 = "sha256-AM16ngJ/CoSV6BOb80Pi9EqWoRILryOO4Rk+S5DffLU="; + sha256 = "sha256-Anen1YtXsSPhk8DpA4JtADIz9m8oXFl9umlkb4iImf8="; }; nativeBuildInputs = [ @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { "CUBLAS_LIB=${cudatoolkit}/lib/libcublas.so" ] ++ lib.optionals stdenv.isDarwin [ # Unless these are set, the build will attempt to use `Accelerate` on darwin, see: - # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v5.11.0/SuiteSparse_config/SuiteSparse_config.mk#L368 + # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v5.13.0/SuiteSparse_config/SuiteSparse_config.mk#L368 "BLAS=-lblas" "LAPACK=-llapack" ] diff --git a/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix b/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix index c31c705d39d0..09ca356ccdc5 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , fetchFromGitLab +, fetchpatch , makeWrapper , which , autoconf @@ -20,7 +21,14 @@ stdenv.mkDerivation rec { sha256 = "132l0xv00ld1svvv9wh99wfra4zzjv2885h2sq0dsl98wiyvi5zl"; }; - patches = [ ./clean-extra-logfile-output-from-pari.patch ]; + patches = [ + ./clean-extra-logfile-output-from-pari.patch + (fetchpatch { + name = "null-terminate-dupdirname.patch"; + url = "https://gitlab.com/rezozer/forks/sympow/-/merge_requests/5.diff"; + sha256 = "sha256-yKjio+qN9teL8L+mb7WOBN/iv545vRIxW20FJU37oO4="; + }) + ]; postUnpack = '' patchShebangs . diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix index cf2346bad271..3426b0149ae0 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix @@ -6,7 +6,6 @@ , fetchpatch , fetchurl , flatbuffers -, hostPlatform , lib , zlib }: @@ -160,7 +159,7 @@ stdenv.mkDerivation rec { mkdir "$out" # copy the static lib and binaries into the output dir - cp -r ./tensorflow/lite/tools/make/gen/linux_${hostPlatform.uname.processor}/{bin,lib} "$out" + cp -r ./tensorflow/lite/tools/make/gen/linux_${stdenv.hostPlatform.uname.processor}/{bin,lib} "$out" find ./tensorflow/lite -type f -name '*.h' | while read f; do path="$out/include/''${f/.\//}" @@ -177,5 +176,28 @@ stdenv.mkDerivation rec { license = licenses.asl20; maintainers = with maintainers; [ cpcloud ]; platforms = [ "x86_64-linux" "aarch64-linux" ]; + knownVulnerabilities = [ + # at least some of + "CVE-2023-27579" + "CVE-2023-25801" + "CVE-2023-25676" + "CVE-2023-25675" + "CVE-2023-25674" + "CVE-2023-25673" + "CVE-2023-25671" + "CVE-2023-25670" + "CVE-2023-25669" + "CVE-2023-25668" + "CVE-2023-25667" + "CVE-2023-25665" + "CVE-2023-25666" + "CVE-2023-25664" + "CVE-2023-25663" + "CVE-2023-25662" + "CVE-2023-25660" + "CVE-2023-25659" + "CVE-2023-25658" + # and many many more + ]; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/bin.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorflow/bin.nix deleted file mode 100644 index 1b769f44eeb1..000000000000 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/bin.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ lib, stdenv -, fetchurl -, addOpenGLRunpath -, cudaSupport ? false, cudaPackages ? {} -, symlinkJoin -}: - -with lib; -let - broken = !stdenv.isLinux && !stdenv.isDarwin; - - inherit (cudaPackages) cudatoolkit cudnn; - - tfType = if cudaSupport then "gpu" else "cpu"; - - system = - if stdenv.isLinux then "linux" - else "darwin"; - - platform = "x86_64"; - - rpath = makeLibraryPath ([stdenv.cc.libc stdenv.cc.cc.lib] - ++ optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn ]); - - packages = import ./binary-hashes.nix; - - patchLibs = - if stdenv.isDarwin - then '' - install_name_tool -id $out/lib/libtensorflow.dylib $out/lib/libtensorflow.dylib - install_name_tool -id $out/lib/libtensorflow_framework.dylib $out/lib/libtensorflow_framework.dylib - '' - else '' - patchelf --set-rpath "${rpath}:$out/lib" $out/lib/libtensorflow.so - patchelf --set-rpath "${rpath}" $out/lib/libtensorflow_framework.so - ${optionalString cudaSupport '' - addOpenGLRunpath $out/lib/libtensorflow.so $out/lib/libtensorflow_framework.so - ''} - ''; - -in stdenv.mkDerivation rec { - pname = "libtensorflow"; - inherit (packages) version; - - src = fetchurl packages."${tfType}-${system}-${platform}"; - - nativeBuildInputs = optional cudaSupport addOpenGLRunpath; - - # Patch library to use our libc, libstdc++ and others - buildCommand = '' - mkdir -pv $out - tar -C $out -xzf $src - chmod -R +w $out - ${patchLibs} - - # Write pkg-config file. - mkdir $out/lib/pkgconfig - cat > $out/lib/pkgconfig/tensorflow.pc << EOF - Name: TensorFlow - Version: ${version} - Description: Library for computation using data flow graphs for scalable machine learning - Requires: - Libs: -L$out/lib -ltensorflow - Cflags: -I$out/include/tensorflow - EOF - ''; - - meta = { - description = "C API for TensorFlow"; - homepage = "https://www.tensorflow.org/install/lang_c"; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = licenses.asl20; - platforms = [ "x86_64-linux" "x86_64-darwin" ]; - }; -} diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix deleted file mode 100644 index b606e45477a9..000000000000 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ -version = "2.4.0"; -"cpu-linux-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.4.0.tar.gz"; - sha256 = "022p5jjwmb8rhyyis3cpk2lw45apl2vz49m2rgxmd75h783x1gjk"; -}; -"gpu-linux-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.4.0.tar.gz"; - sha256 = "1fclvbrn3fs8qmhmh3lzni7s7wl1w30a071b4gzh9ifnxdhip6lq"; -}; -"cpu-darwin-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.4.0.tar.gz"; - sha256 = "09x096nslg04c8sr7bd5v68a5gfinc0f1h36lbzn8bahs8b1agi3"; -}; -} diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh b/nixpkgs/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh deleted file mode 100755 index d571d38f7719..000000000000 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# ./prefetcher.sh 2.4.0 binary-hashes.nix - -version="$1" -hashfile="$2" -rm -f $hashfile -echo "{" >> $hashfile -echo "version = \"$version\";" >> $hashfile -for sys in "linux" "darwin"; do - for tfpref in "cpu" "gpu"; do - for platform in "x86_64"; do - if [ $sys = "darwin" ] && [ $tfpref = "gpu" ]; then - continue - fi - url=https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-$tfpref-$sys-$platform-$version.tar.gz - hash=$(nix-prefetch-url $url) - echo "\"${tfpref}-${sys}-${platform}\" = {" >> $hashfile - echo " url = \"$url\";" >> $hashfile - echo " sha256 = \"$hash\";" >> $hashfile - echo "};" >> $hashfile - done - done -done -echo "}" >> $hashfile - diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorrt/extension.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorrt/extension.nix index 8e9f64885bad..c6596dbaacde 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorrt/extension.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorrt/extension.nix @@ -24,17 +24,90 @@ final: prev: let # Add all supported builds as attributes allBuilds = mapAttrs' (version: file: nameValuePair (computeName version) (buildTensorRTPackage (removeAttrs file ["fileVersionCuda"]))) supportedVersions; # Set the default attributes, e.g. tensorrt = tensorrt_8_4; - defaultBuild = { "tensorrt" = allBuilds.${computeName tensorRTDefaultVersion}; }; - in allBuilds // defaultBuild; + defaultBuild = { "tensorrt" = if allBuilds ? ${computeName tensorRTDefaultVersion} + then allBuilds.${computeName tensorRTDefaultVersion} + else throw "tensorrt-${tensorRTDefaultVersion} does not support your cuda version ${cudaVersion}"; }; + in { + inherit buildTensorRTPackage; + } // allBuilds // defaultBuild; + + tarballURL = + {fullVersion, fileVersionCuda, fileVersionCudnn ? null} : + "TensorRT-${fullVersion}.Linux.x86_64-gnu.cuda-${fileVersionCuda}" + + lib.optionalString (fileVersionCudnn != null) ".cudnn${fileVersionCudnn}" + + ".tar.gz"; tensorRTVersions = { + "8.6.0" = [ + rec { + fileVersionCuda = "11.8"; + fullVersion = "8.6.0.12"; + sha256 = "sha256-wXMqEJPFerefoLaH8GG+Np5EnJwXeStmDzZj7Nj6e2M="; + tarball = tarballURL { inherit fileVersionCuda fullVersion; }; + supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; + } + ]; + "8.5.3" = [ + rec { + fileVersionCuda = "11.8"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.3.1"; + sha256 = "sha256-BNeuOYvPTUAfGxI0DVsNrX6Z/FAB28+SE0ptuGu7YDY="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; + } + rec { + fileVersionCuda = "10.2"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.3.1"; + sha256 = "sha256-WCt6yfOmFbrjqdYCj6AE2+s2uFpISwk6urP+2I0BnGQ="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "10.2" ]; + } + ]; + "8.5.2" = [ + rec { + fileVersionCuda = "11.8"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.2.2"; + sha256 = "sha256-Ov5irNS/JETpEz01FIFNMs9YVmjGHL7lSXmDpgCdgao="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; + } + rec { + fileVersionCuda = "10.2"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.2.2"; + sha256 = "sha256-UruwQShYcHLY5d81lKNG7XaoUsZr245c+PUpUN6pC5E="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "10.2" ]; + } + ]; + "8.5.1" = [ + rec { + fileVersionCuda = "11.8"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.1.7"; + sha256 = "sha256-Ocx/B3BX0TY3lOj/UcTPIaXb7M8RFrACC6Da4PMGMHY="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; + } + rec { + fileVersionCuda = "10.2"; + fileVersionCudnn = "8.6"; + fullVersion = "8.5.1.7"; + sha256 = "sha256-CcFGJhw7nFdPnSYYSxcto2MHK3F84nLQlJYjdIw8dPM="; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; + supportedCudaVersions = [ "10.2" ]; + } + ]; "8.4.0" = [ rec { fileVersionCuda = "11.6"; fileVersionCudnn = "8.3"; fullVersion = "8.4.0.6"; sha256 = "sha256-DNgHHXF/G4cK2nnOWImrPXAkOcNW6Wy+8j0LRpAH/LQ="; - tarball = "TensorRT-${fullVersion}.Linux.x86_64-gnu.cuda-${fileVersionCuda}.cudnn${fileVersionCudnn}.tar.gz"; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" ]; } rec { @@ -42,7 +115,7 @@ final: prev: let fileVersionCudnn = "8.3"; fullVersion = "8.4.0.6"; sha256 = "sha256-aCzH0ZI6BrJ0v+e5Bnm7b8mNltA7NNuIa8qRKzAQv+I="; - tarball = "TensorRT-${fullVersion}.Linux.x86_64-gnu.cuda-${fileVersionCuda}.cudnn${fileVersionCudnn}.tar.gz"; + tarball = tarballURL { inherit fileVersionCuda fileVersionCudnn fullVersion; }; supportedCudaVersions = [ "10.2" ]; } ]; @@ -58,6 +131,8 @@ final: prev: let "11.4" = "8.4.0"; "11.5" = "8.4.0"; "11.6" = "8.4.0"; - }.${cudaVersion}; + "11.7" = "8.5.3"; + "11.8" = "8.5.3"; + }.${cudaVersion} or "8.4.0"; in tensorRTPackages diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorrt/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorrt/generic.nix index 3447087051f1..165c6f356da8 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorrt/generic.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorrt/generic.nix @@ -1,5 +1,5 @@ { lib -, stdenv +, backendStdenv , requireFile , autoPatchelfHook , autoAddOpenGLRunpathHook @@ -9,16 +9,16 @@ }: { fullVersion -, fileVersionCudnn +, fileVersionCudnn ? null , tarball , sha256 , supportedCudaVersions ? [ ] }: -assert lib.assertMsg (lib.strings.versionAtLeast cudnn.version fileVersionCudnn) +assert fileVersionCudnn == null || lib.assertMsg (lib.strings.versionAtLeast cudnn.version fileVersionCudnn) "This version of TensorRT requires at least cuDNN ${fileVersionCudnn} (current version is ${cudnn.version})"; -stdenv.mkDerivation rec { +backendStdenv.mkDerivation rec { pname = "cudatoolkit-${cudatoolkit.majorVersion}-tensorrt"; version = fullVersion; src = requireFile rec { @@ -45,7 +45,7 @@ stdenv.mkDerivation rec { # Used by autoPatchelfHook buildInputs = [ - cudatoolkit.cc.cc.lib # libstdc++ + backendStdenv.cc.cc.lib # libstdc++ cudatoolkit cudnn ]; @@ -74,6 +74,8 @@ stdenv.mkDerivation rec { "$out/lib/libnvinfer_builder_resource.so.${mostOfVersion}" ''; + passthru.stdenv = backendStdenv; + meta = with lib; { # Check that the cudatoolkit version satisfies our min/max constraints (both # inclusive). We mark the package as broken if it fails to satisfies the diff --git a/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix b/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix new file mode 100644 index 000000000000..ef501dfd09a0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix @@ -0,0 +1,152 @@ +{ cmake +, cudaPackages +, fetchFromGitHub +, lib +, ninja +, pkgs +, python3Packages ? { } +, pythonSupport ? false +, stdenv +, symlinkJoin +, which +}: +let + inherit (lib) lists strings; + inherit (cudaPackages) backendStdenv cudaFlags; + + cuda-common-redist = with cudaPackages; [ + libcublas # cublas_v2.h + libcusolver # cusolverDn.h + libcusparse # cusparse.h + ]; + + cuda-native-redist = symlinkJoin { + name = "cuda-redist"; + paths = with cudaPackages; [ + cuda_cudart # cuda_runtime.h + cuda_nvcc + ] ++ cuda-common-redist; + }; + + cuda-redist = symlinkJoin { + name = "cuda-redist"; + paths = cuda-common-redist; + }; +in +stdenv.mkDerivation (finalAttrs: { + name = "tiny-cuda-nn"; + version = "1.6"; + + format = strings.optionalString pythonSupport "setuptools"; + + src = fetchFromGitHub { + owner = "NVlabs"; + repo = finalAttrs.name; + rev = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-qW6Fk2GB71fvZSsfu+mykabSxEKvaikZ/pQQZUycOy0="; + }; + + nativeBuildInputs = [ + cmake + cuda-native-redist + ninja + which + ] ++ lists.optionals pythonSupport (with python3Packages; [ + pip + setuptools + wheel + ]); + + buildInputs = [ + cuda-redist + ] ++ lib.optionals pythonSupport ( + with python3Packages; [ + pybind11 + python + ] + ); + + propagatedBuildInputs = lib.optionals pythonSupport ( + with python3Packages; [ + torch + ] + ); + + # NOTE: We cannot use pythonImportsCheck for this module because it uses torch to immediately + # initailize CUDA and GPU access is not allowed in the nix build environment. + # NOTE: There are no tests for the C++ library or the python bindings, so we just skip the check + # phase -- we're not missing anything. + doCheck = false; + + preConfigure = '' + export TCNN_CUDA_ARCHITECTURES=${ + strings.concatStringsSep ";" (lists.map cudaFlags.dropDot cudaFlags.cudaCapabilities) + } + export CUDA_HOME=${cuda-native-redist} + export LIBRARY_PATH=${cuda-native-redist}/lib/stubs:$LIBRARY_PATH + export CC=${backendStdenv.cc}/bin/cc + export CXX=${backendStdenv.cc}/bin/c++ + ''; + + # When building the python bindings, we cannot re-use the artifacts from the C++ build so we + # skip the CMake confurePhase and the buildPhase. + dontUseCmakeConfigure = pythonSupport; + + # The configurePhase usually puts you in the build directory, so for the python bindings we + # need to change directories to the source directory. + configurePhase = strings.optionalString pythonSupport '' + runHook preConfigure + mkdir -p $NIX_BUILD_TOP/build + cd $NIX_BUILD_TOP/build + runHook postConfigure + ''; + + buildPhase = strings.optionalString pythonSupport '' + runHook preBuild + python -m pip wheel \ + --no-build-isolation \ + --no-clean \ + --no-deps \ + --no-index \ + --verbose \ + --wheel-dir $NIX_BUILD_TOP/build \ + $NIX_BUILD_TOP/source/bindings/torch + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/lib + '' + # Installing the C++ library just requires copying the static library to the output directory + + strings.optionalString (!pythonSupport) '' + cp libtiny-cuda-nn.a $out/lib/ + '' + # Installing the python bindings requires building the wheel and installing it + + strings.optionalString pythonSupport '' + python -m pip install \ + --no-build-isolation \ + --no-cache-dir \ + --no-deps \ + --no-index \ + --no-warn-script-location \ + --prefix="$out" \ + --verbose \ + ./*.whl + '' + '' + runHook postInstall + ''; + + passthru = { + inherit cudaPackages; + }; + + meta = with lib; { + description = "Lightning fast C++/CUDA neural network framework"; + homepage = "https://github.com/NVlabs/tiny-cuda-nn"; + license = licenses.bsd3; + maintainers = with maintainers; [ connorbaker ]; + platforms = platforms.linux; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix b/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix index 3ec97e4a288e..13344db9ebc3 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; - # Tuning (either autotuning or with hand-written paramters) is possible + # Tuning (either autotuning or with hand-written parameters) is possible # but not implemented here. # It seems buggy anyways (see homepage). buildFlags = [ "all" "${libbasename}${libext}" ]; diff --git a/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix b/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix index b9f7946f7161..0eba41234fd5 100644 --- a/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix @@ -53,8 +53,8 @@ stdenv.mkDerivation rec { # ncurses is a hidden dependency of waf when checking python buildInputs = lib.optionals pythonSupport [ castxml ncurses ] - ++ lib.optional enableDoxygen [ doxygen graphviz imagemagick ] - ++ lib.optional withManual [ dia tetex ghostscript texlive.combined.scheme-medium ]; + ++ lib.optionals enableDoxygen [ doxygen graphviz imagemagick ] + ++ lib.optionals withManual [ dia tetex ghostscript texlive.combined.scheme-medium ]; propagatedBuildInputs = [ pythonEnv ]; @@ -101,11 +101,12 @@ stdenv.mkDerivation rec { hardeningDisable = [ "fortify" "strictoverflow"]; meta = with lib; { - broken = (stdenv.isLinux && stdenv.isAarch64); homepage = "http://www.nsnam.org"; license = licenses.gpl3; description = "A discrete time event network simulator"; platforms = with platforms; unix; maintainers = with maintainers; [ teto rgrunbla ]; + # never built on aarch64-darwin since first introduction in nixpkgs + broken = (stdenv.isDarwin && stdenv.isAarch64) || (stdenv.isLinux && stdenv.isAarch64); }; } diff --git a/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix b/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix index b3eed2e326e6..28a38b7056dd 100644 --- a/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix @@ -9,6 +9,10 @@ stdenv.mkDerivation rec { sha256 = "0khrxp43bi5kisr8j4lp9fl4r5marzf7b4inys62ac108sfb28lp"; }; + postPatch = '' + sed -i "1i #include <map>" include/iSpike/YarpConnection.hpp + ''; + nativeBuildInputs = [ cmake ]; buildInputs = [ boost ]; @@ -16,7 +20,7 @@ stdenv.mkDerivation rec { description = "Spiking neural interface between iCub and a spiking neural simulator"; homepage = "https://sourceforge.net/projects/ispike/"; license = lib.licenses.lgpl3; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; maintainers = [ lib.maintainers.nico202 ]; }; } |