summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/science/math')
-rw-r--r--pkgs/development/libraries/science/math/amd-blis/default.nix16
-rw-r--r--pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff34
-rw-r--r--pkgs/development/libraries/science/math/amd-libflame/default.nix66
-rw-r--r--pkgs/development/libraries/science/math/arpack/default.nix25
-rw-r--r--pkgs/development/libraries/science/math/blis/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/bonmin/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/coin-utils/default.nix15
-rw-r--r--pkgs/development/libraries/science/math/cudnn/generic.nix10
-rw-r--r--pkgs/development/libraries/science/math/ipopt/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/libtorch/bin.nix2
-rw-r--r--pkgs/development/libraries/science/math/magma/generic.nix24
-rw-r--r--pkgs/development/libraries/science/math/nccl/default.nix12
-rw-r--r--pkgs/development/libraries/science/math/nccl/tests.nix40
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix13
-rw-r--r--pkgs/development/libraries/science/math/openspecfun/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/or-tools/default.nix9
-rw-r--r--pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch36
-rw-r--r--pkgs/development/libraries/science/math/osi/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/scalapack/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/superlu/default.nix7
-rw-r--r--pkgs/development/libraries/science/math/zn_poly/default.nix2
22 files changed, 181 insertions, 158 deletions
diff --git a/pkgs/development/libraries/science/math/amd-blis/default.nix b/pkgs/development/libraries/science/math/amd-blis/default.nix
index 962e8e8e6ac..f6d00411221 100644
--- a/pkgs/development/libraries/science/math/amd-blis/default.nix
+++ b/pkgs/development/libraries/science/math/amd-blis/default.nix
@@ -6,10 +6,10 @@
 # Enable BLAS interface with 64-bit integer width.
 , blas64 ? false
 
-# Target architecture. "amd64" compiles kernels for all Zen
+# Target architecture. "amdzen" compiles kernels for all Zen
 # generations. To build kernels for specific Zen generations,
-# use "zen", "zen2", or "zen3".
-, withArchitecture ? "amd64"
+# use "zen", "zen2", "zen3", or "zen4".
+, withArchitecture ? "amdzen"
 
 # Enable OpenMP-based threading.
 , withOpenMP ? true
@@ -18,15 +18,16 @@
 let
   threadingSuffix = lib.optionalString withOpenMP "-mt";
   blasIntSize = if blas64 then "64" else "32";
+
 in stdenv.mkDerivation rec {
   pname = "amd-blis";
-  version = "3.0";
+  version = "4.1";
 
   src = fetchFromGitHub {
     owner = "amd";
     repo = "blis";
     rev = version;
-    hash = "sha256-bbbeo1yOKse9pzbsB6lQ7pULKdzu3G7zJzTUgPXiMZY=";
+    hash = "sha256-1vd4uBg/+Vufqsr+MnAWSUW/THkribHNSMeq1/is8K4=";
   };
 
   inherit blas64;
@@ -54,8 +55,9 @@ in stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    ln -s $out/lib/libblis${threadingSuffix}.so.3 $out/lib/libblas.so.3
-    ln -s $out/lib/libblis${threadingSuffix}.so.3 $out/lib/libcblas.so.3
+    ls $out/lib
+    ln -s $out/lib/libblis${threadingSuffix}.so $out/lib/libblas.so.3
+    ln -s $out/lib/libblis${threadingSuffix}.so $out/lib/libcblas.so.3
     ln -s $out/lib/libblas.so.3 $out/lib/libblas.so
     ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
   '';
diff --git a/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff b/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff
deleted file mode 100644
index 3e3ef1e60ff..00000000000
--- a/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/Makefile b/Makefile
-index 5549ce30..ac2ee51e 100644
---- a/Makefile
-+++ b/Makefile
-@@ -583,14 +583,14 @@ endif
- 
- # --- Shared library linker rules ---
- 
--$(LIBFLAME_SO_PATH): $(MK_ALL_FLAMEC_OBJS)
-+$(LIBFLAME_SO_PATH): $(MK_ALL_FLAMEC_OBJS) $(LAPACKE_A_PATH)
- ifeq ($(ENABLE_VERBOSE),yes)
- ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes)
- 	$(CAT) $(AR_OBJ_LIST_FILE) | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A)
- ifeq ($(OS_NAME),Darwin)
--	$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS)
-+	$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A),$(LAPACKE_A_PATH) $(LDFLAGS)
- else
--	$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),--no-whole-archive $(LDFLAGS)
-+	$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),$(LAPACKE_A_PATH)--no-whole-archive $(LDFLAGS)
- endif
- else
- #	NOTE: Can't use $^ automatic variable as long as $(AR_OBJ_LIST_FILE) is in
-@@ -602,9 +602,9 @@ else
- ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes)
- 	@$(CAT) $(AR_OBJ_LIST_FILE) | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A)
- ifeq ($(OS_NAME),Darwin)
--	@$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS)
-+	@$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A),$(LAPACKE_A_PATH) $(LDFLAGS)
- else
--	@$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),--no-whole-archive $(LDFLAGS)
-+	@$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),$(LAPACKE_A_PATH),--no-whole-archive $(LDFLAGS)
- endif
- else
- #	NOTE: Can't use $^ automatic variable as long as $(AR_OBJ_LIST_FILE) is in
diff --git a/pkgs/development/libraries/science/math/amd-libflame/default.nix b/pkgs/development/libraries/science/math/amd-libflame/default.nix
index a5b65737941..b03352c54e8 100644
--- a/pkgs/development/libraries/science/math/amd-libflame/default.nix
+++ b/pkgs/development/libraries/science/math/amd-libflame/default.nix
@@ -1,78 +1,62 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, cmake
 , gfortran
 , python3
 , amd-blis
+, aocl-utils
 
 , withOpenMP ? true
 , blas64 ? false
+, withAMDOpt ? true
 }:
 
-# right now only LP64 is supported
-assert !blas64;
-
 stdenv.mkDerivation rec {
   pname = "amd-libflame";
-  version = "3.0";
+  version = "4.1";
 
   src = fetchFromGitHub {
     owner = "amd";
     repo = "libflame";
     rev = version;
-    hash = "sha256-jESae5NqANw90RBbIHH2oGEq5/mudc4IONv50P/AeQ0=";
+    hash = "sha256-SZk11oOAnvn1vb7ucX6U9b0YtAJNxl3tQu4ExHpwwoo=";
   };
 
-  patches = [
-    # The LAPACKE interface is compiled as a separate static library,
-    # we want the main dynamic library to provide LAPACKE symbols.
-    # This patch adds lapacke.a to the shared library as well.
-    ./add-lapacke.diff
-  ];
-
-  passthru = { inherit blas64; };
-
-  nativeBuildInputs = [ gfortran python3 ];
+  postPatch = ''
+    patchShebangs build
 
-  buildInputs = [ amd-blis ];
+    # Enforce reproducible build compiler flags
+    substituteInPlace CMakeLists.txt --replace '-mtune=native' ""
+  '';
 
-  configureFlags = [
-    # Build a dynamic library with a LAPACK interface.
-    "--disable-static-build"
-    "--enable-dynamic-build"
-    "--enable-lapack2flame"
+  passthru = { inherit blas64; };
 
-    # Use C BLAS interface.
-    "--enable-cblas-interfaces"
+  nativeBuildInputs = [ cmake gfortran python3 ];
 
-    # Avoid overloading maximum number of arguments.
-    "--enable-max-arg-list-hack"
+  buildInputs = [ amd-blis aocl-utils ];
 
-    # libflame by default leaves BLAS symbols unresolved and leaves it
-    # up to the application to explicitly link to a BLAS. This is
-    # problematic for us, since then the BLAS library becomes an
-    # implicit dependency. Moreover, since the point of the AMD forks
-    # is to optimized for recent AMD CPUs, link against AMD BLIS.
-    "LDFLAGS=-lcblas"
+  cmakeFlags = [
+    "-DLIBAOCLUTILS_LIBRARY_PATH=${lib.getLib aocl-utils}/lib/libaoclutils${stdenv.hostPlatform.extensions.sharedLibrary}"
+    "-DLIBAOCLUTILS_INCLUDE_PATH=${lib.getDev aocl-utils}/include"
+    "-DENABLE_BUILTIN_LAPACK2FLAME=ON"
+    "-DENABLE_CBLAS_INTERFACES=ON"
+    "-DENABLE_EXT_LAPACK_INTERFACE=ON"
   ]
-  ++ lib.optionals withOpenMP [ "--enable-multithreading=openmp" ];
-
-  enableParallelBuilding = true;
-
-  postPatch = ''
-    patchShebangs build
-  '';
+  ++ lib.optional (!withOpenMP) "-DENABLE_MULTITHREADING=OFF"
+  ++ lib.optional blas64 "-DENABLE_ILP64=ON"
+  ++ lib.optional withAMDOpt "-DENABLE_AMD_OPT=ON";
 
   postInstall = ''
-    ln -s $out/lib/libflame.so.${version} $out/lib/liblapack.so.3
-    ln -s $out/lib/libflame.so.${version} $out/lib/liblapacke.so.3
+    ln -s $out/lib/libflame.so $out/lib/liblapack.so.3
+    ln -s $out/lib/libflame.so $out/lib/liblapacke.so.3
   '';
 
   meta = with lib; {
     description = "LAPACK-compatible linear algebra library optimized for AMD CPUs";
     homepage = "https://developer.amd.com/amd-aocl/blas-library/";
     license = licenses.bsd3;
-    maintainers = with maintainers; [ ];
+    maintainers = [ maintainers.markuskowa ];
     platforms = [ "x86_64-linux" ];
   };
 }
diff --git a/pkgs/development/libraries/science/math/arpack/default.nix b/pkgs/development/libraries/science/math/arpack/default.nix
index a418df7050e..744d565eddc 100644
--- a/pkgs/development/libraries/science/math/arpack/default.nix
+++ b/pkgs/development/libraries/science/math/arpack/default.nix
@@ -1,8 +1,9 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , gfortran, blas, lapack, eigen
 , useMpi ? false
 , mpi
 , openssh
+, igraph
 }:
 
 # MPI version can only be built with LP64 interface.
@@ -11,25 +12,15 @@ assert useMpi -> !blas.isILP64;
 
 stdenv.mkDerivation rec {
   pname = "arpack";
-  version = "3.8.0";
+  version = "3.9.1";
 
   src = fetchFromGitHub {
     owner = "opencollab";
     repo = "arpack-ng";
     rev = version;
-    sha256 = "sha256-nc710iLRqy/p3EaVgbEoCRzNJ9GpKqqQp33tbn7R6lA=";
+    sha256 = "sha256-HCvapLba8oLqx9I5+KDAU0s/dTmdWOEilS75i4gyfC0=";
   };
 
-  patches = [
-    # https://github.com/opencollab/arpack-ng/pull/301
-    (fetchpatch {
-      name = "pkg-config-paths.patch";
-      url = "https://github.com/opencollab/arpack-ng/commit/47fc83cb371a9cc8a8c058097de5e0298cd548f5.patch";
-      excludes = [ "CHANGES" ];
-      sha256 = "1aijvrfsxkgzqmkzq2dmaj8q3jdpg2hwlqpfl8ddk9scv17gh9m8";
-    })
-  ];
-
   nativeBuildInputs = [ cmake gfortran ];
   buildInputs = assert (blas.isILP64 == lapack.isILP64); [
     blas
@@ -56,10 +47,16 @@ stdenv.mkDerivation rec {
     install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libarpack.dylib
   '';
 
-  passthru = { inherit (blas) isILP64; };
+  passthru = {
+    inherit (blas) isILP64;
+    tests = {
+      inherit igraph;
+    };
+  };
 
   meta = {
     homepage = "https://github.com/opencollab/arpack-ng";
+    changelog = "https://github.com/opencollab/arpack-ng/blob/${src.rev}/CHANGES";
     description = ''
       A collection of Fortran77 subroutines to solve large scale eigenvalue
       problems.
diff --git a/pkgs/development/libraries/science/math/blis/default.nix b/pkgs/development/libraries/science/math/blis/default.nix
index 5b78afc15ed..2c9aa745ba1 100644
--- a/pkgs/development/libraries/science/math/blis/default.nix
+++ b/pkgs/development/libraries/science/math/blis/default.nix
@@ -48,8 +48,8 @@ in stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    ln -s $out/lib/libblis.so.3 $out/lib/libblas.so.3
-    ln -s $out/lib/libblis.so.3 $out/lib/libcblas.so.3
+    ln -s $out/lib/libblis.so.4 $out/lib/libblas.so.3
+    ln -s $out/lib/libblis.so.4 $out/lib/libcblas.so.3
     ln -s $out/lib/libblas.so.3 $out/lib/libblas.so
     ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
   '';
diff --git a/pkgs/development/libraries/science/math/bonmin/default.nix b/pkgs/development/libraries/science/math/bonmin/default.nix
index 7f494b245c3..5a736f97695 100644
--- a/pkgs/development/libraries/science/math/bonmin/default.nix
+++ b/pkgs/development/libraries/science/math/bonmin/default.nix
@@ -17,13 +17,13 @@ assert (!blas.isILP64) && (!lapack.isILP64);
 
 stdenv.mkDerivation rec {
   pname = "bonmin";
-  version = "1.8.8";
+  version = "1.8.9";
 
   src = fetchFromGitHub {
     owner = "coin-or";
     repo = "Bonmin";
     rev = "releases/${version}";
-    sha256 = "sha256-HU25WjvG01oL3U1wG6ivTcYaN51MMxgLdKZ3AkDNe2Y=";
+    sha256 = "sha256-nqjAQ1NdNJ/T4p8YljEWRt/uy2aDwyBeAsag0TmRc5Q=";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/development/libraries/science/math/coin-utils/default.nix b/pkgs/development/libraries/science/math/coin-utils/default.nix
index 6cb7666e568..60b9de0ab33 100644
--- a/pkgs/development/libraries/science/math/coin-utils/default.nix
+++ b/pkgs/development/libraries/science/math/coin-utils/default.nix
@@ -1,16 +1,25 @@
-{ lib, stdenv, fetchFromGitHub, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch }:
 
 stdenv.mkDerivation rec {
-  version = "2.11.9";
+  version = "2.11.10";
   pname = "coinutils";
 
   src = fetchFromGitHub {
     owner = "coin-or";
     repo = "CoinUtils";
     rev = "releases/${version}";
-    hash = "sha256-DgHVbcXd36WW6JQbiq1MUHAiKLs8CTau87rs0T76sGs=";
+    hash = "sha256-Rbm45HRbRKQ6Cdup+gvKJ1xkK1HKG3irR5AIjhLer7g=";
   };
 
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/coin-or/CoinUtils/commit/1700ed92c2bc1562aabe65dee3b4885bd5c87fb9.patch";
+      stripLen = 1;
+      extraPrefix = "CoinUtils/";
+      hash = "sha256-8S6XteZvoJlL+5MWiOrW7HXsdcnzpuEFTyzX9qg7OUY=";
+    })
+  ];
+
   doCheck = true;
 
   meta = with lib; {
diff --git a/pkgs/development/libraries/science/math/cudnn/generic.nix b/pkgs/development/libraries/science/math/cudnn/generic.nix
index b1e03e35df1..b9f101d80fa 100644
--- a/pkgs/development/libraries/science/math/cudnn/generic.nix
+++ b/pkgs/development/libraries/science/math/cudnn/generic.nix
@@ -153,8 +153,14 @@ in
       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;
+      license = {
+        shortName = "cuDNN EULA";
+        fullName = "NVIDIA cuDNN Software License Agreement (EULA)";
+        url = "https://docs.nvidia.com/deeplearning/sdk/cudnn-sla/index.html#supplement";
+        free = false;
+      } // lib.optionalAttrs (!useCudatoolkitRunfile) {
+        redistributable = true;
+      };
       platforms = ["x86_64-linux"];
       maintainers = with maintainers; [mdaiter samuela];
       # Force the use of the default, fat output by default (even though `dev` exists, which
diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix
index 9b26b352cda..cea4d5b4c6f 100644
--- a/pkgs/development/libraries/science/math/ipopt/default.nix
+++ b/pkgs/development/libraries/science/math/ipopt/default.nix
@@ -12,13 +12,13 @@ assert (!blas.isILP64) && (!lapack.isILP64);
 
 stdenv.mkDerivation rec {
   pname = "ipopt";
-  version = "3.14.12";
+  version = "3.14.13";
 
   src = fetchFromGitHub {
     owner = "coin-or";
     repo = "Ipopt";
     rev = "releases/${version}";
-    sha256 = "sha256-cyV3tgmZz5AExxxdGJ12r+PPXn7v2AEhxb9icBxolS8=";
+    sha256 = "sha256-51isH1hlzgbD0JVtGp3NuaGY5l2CeS1S7oVeRYG+vWI=";
   };
 
   CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ];
diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix
index a47d8260714..47a6249ebdc 100644
--- a/pkgs/development/libraries/science/math/libtorch/bin.nix
+++ b/pkgs/development/libraries/science/math/libtorch/bin.nix
@@ -26,7 +26,7 @@ in stdenv.mkDerivation {
   inherit version;
   pname = "libtorch";
 
-  src = fetchzip srcs."${stdenv.targetPlatform.system}-${device}" or unavailable;
+  src = fetchzip srcs."${stdenv.hostPlatform.system}-${device}" or unavailable;
 
   nativeBuildInputs =
     if stdenv.isDarwin then [ fixDarwinDylibNames ]
diff --git a/pkgs/development/libraries/science/math/magma/generic.nix b/pkgs/development/libraries/science/math/magma/generic.nix
index b3753a63339..6b8588207dc 100644
--- a/pkgs/development/libraries/science/math/magma/generic.nix
+++ b/pkgs/development/libraries/science/math/magma/generic.nix
@@ -18,16 +18,14 @@
 , gfortran
 , cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities
 , gpuTargets ? [ ] # Non-CUDA targets, that is HIP
-, hip
-, hipblas
-, hipsparse
+, rocmPackages
 , lapack
 , lib
 , libpthreadstubs
 , magmaRelease
 , ninja
-, openmp
-, rocmSupport ? false
+, config
+, rocmSupport ? config.rocmSupport
 , static ? false
 , stdenv
 , symlinkJoin
@@ -47,7 +45,7 @@ let
   # 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;
+  rocmArches = lists.map (x: strings.removePrefix "gfx" x) rocmPackages.clr.gpuTargets;
   supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets;
   unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches;
 
@@ -124,11 +122,13 @@ stdenv.mkDerivation {
     cuda_nvprof.dev # <cuda_profiler_api.h>
   ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [
     cuda_profiler_api.dev # <cuda_profiler_api.h>
+  ] ++ lists.optionals (strings.versionAtLeast cudaVersion "12.0") [
+    cuda_cccl.dev # <nv/target>
   ]) ++ lists.optionals rocmSupport [
-    hip
-    hipblas
-    hipsparse
-    openmp
+    rocmPackages.clr
+    rocmPackages.hipblas
+    rocmPackages.hipsparse
+    rocmPackages.llvm.openmp
   ];
 
   cmakeFlags = [
@@ -142,8 +142,8 @@ stdenv.mkDerivation {
     "-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"
+    "-DCMAKE_C_COMPILER=${rocmPackages.clr}/bin/hipcc"
+    "-DCMAKE_CXX_COMPILER=${rocmPackages.clr}/bin/hipcc"
     "-DMAGMA_ENABLE_HIP=ON"
   ];
 
diff --git a/pkgs/development/libraries/science/math/nccl/default.nix b/pkgs/development/libraries/science/math/nccl/default.nix
index c5c7b7e6427..d1df2645644 100644
--- a/pkgs/development/libraries/science/math/nccl/default.nix
+++ b/pkgs/development/libraries/science/math/nccl/default.nix
@@ -1,6 +1,7 @@
 { lib
 , backendStdenv
 , fetchFromGitHub
+, python3
 , which
 , autoAddOpenGLRunpathHook
 , cuda_cccl
@@ -17,13 +18,13 @@ let
 in
 backendStdenv.mkDerivation (finalAttrs: {
   pname = "nccl";
-  version = "2.18.5-1";
+  version = "2.19.3-1";
 
   src = fetchFromGitHub {
     owner = "NVIDIA";
     repo = finalAttrs.pname;
     rev = "v${finalAttrs.version}";
-    hash = "sha256-vp2WitKateEt1AzSeeEvY/wM4NnUmV7XgL/gfPRUObY=";
+    hash = "sha256-59FlOKM5EB5Vkm4dZBRCkn+IgIcdQehE+FyZAdTCT/A=";
   };
 
   outputs = [ "out" "dev" ];
@@ -32,6 +33,7 @@ backendStdenv.mkDerivation (finalAttrs: {
     which
     autoAddOpenGLRunpathHook
     cuda_nvcc
+    python3
   ];
 
   buildInputs = [
@@ -46,7 +48,7 @@ backendStdenv.mkDerivation (finalAttrs: {
   ];
 
   preConfigure = ''
-    patchShebangs src/collectives/device/gen_rules.sh
+    patchShebangs ./src/device/generate.py
     makeFlagsArray+=(
       "NVCC_GENCODE=${gencode}"
     )
@@ -77,7 +79,7 @@ backendStdenv.mkDerivation (finalAttrs: {
     description = "Multi-GPU and multi-node collective communication primitives for NVIDIA GPUs";
     homepage = "https://developer.nvidia.com/nccl";
     license = licenses.bsd3;
-    platforms = [ "x86_64-linux" ];
-    maintainers = with maintainers; [ mdaiter orivej ];
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ mdaiter orivej ] ++ teams.cuda.members;
   };
 })
diff --git a/pkgs/development/libraries/science/math/nccl/tests.nix b/pkgs/development/libraries/science/math/nccl/tests.nix
index 69e45a6aee0..9d826b92f16 100644
--- a/pkgs/development/libraries/science/math/nccl/tests.nix
+++ b/pkgs/development/libraries/science/math/nccl/tests.nix
@@ -1,40 +1,47 @@
-{ config
-, cudaPackages
+{ backendStdenv
+, config
+, cuda_cccl
+, cuda_cudart
+, cuda_nvcc
+, cudaVersion
 , fetchFromGitHub
+, gitUpdater
 , lib
-, mpiSupport ? false
 , mpi
-, stdenv
+, mpiSupport ? false
+, nccl
 , which
 }:
 
-cudaPackages.backendStdenv.mkDerivation (finalAttrs: {
+backendStdenv.mkDerivation (finalAttrs: {
 
   pname = "nccl-tests";
-  version = "2.13.6";
+  version = "2.13.8";
 
   src = fetchFromGitHub {
     owner = "NVIDIA";
     repo = finalAttrs.pname;
     rev = "v${finalAttrs.version}";
-    hash = "sha256-3gSBQ0g6mnQ/MFXGflE+BqqrIUoiBgp8+fWRQOvLVkw=";
+    hash = "sha256-dxLoflsTHDBnZRTzoXdm30OyKpLlRa73b784YWALBHg=";
   };
 
   strictDeps = true;
 
   nativeBuildInputs = [
-    cudaPackages.cuda_nvcc
+    cuda_nvcc
     which
   ];
 
   buildInputs = [
-    cudaPackages.cuda_cudart
-    cudaPackages.nccl
+    cuda_cudart
+    nccl
+  ] ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [
+    cuda_cccl.dev # <nv/target>
   ] ++ lib.optional mpiSupport mpi;
 
   makeFlags = [
-    "CUDA_HOME=${cudaPackages.cuda_nvcc}"
-    "NCCL_HOME=${cudaPackages.nccl}"
+    "CUDA_HOME=${cuda_nvcc}"
+    "NCCL_HOME=${nccl}"
   ] ++ lib.optionals mpiSupport [
     "MPI=1"
   ];
@@ -46,12 +53,17 @@ cudaPackages.backendStdenv.mkDerivation (finalAttrs: {
     cp -r build/* $out/bin/
   '';
 
+  passthru.updateScript = gitUpdater {
+    inherit (finalAttrs) pname version;
+    rev-prefix = "v";
+  };
+
   meta = with lib; {
     description = "Tests to check both the performance and the correctness of NVIDIA NCCL operations";
     homepage = "https://github.com/NVIDIA/nccl-tests";
-    platforms = [ "x86_64-linux" ];
+    platforms = platforms.linux;
     license = licenses.bsd3;
     broken = !config.cudaSupport || (mpiSupport && mpi == null);
-    maintainers = with maintainers; [ jmillerpdt ];
+    maintainers = with maintainers; [ jmillerpdt ] ++ teams.cuda.members;
   };
 })
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index 950402315a9..3fc533e848d 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -141,7 +141,7 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "openblas";
-  version = "0.3.21";
+  version = "0.3.24";
 
   outputs = [ "out" "dev" ];
 
@@ -149,18 +149,9 @@ stdenv.mkDerivation rec {
     owner = "xianyi";
     repo = "OpenBLAS";
     rev = "v${version}";
-    sha256 = "sha256-F6cXPqQai4kA5zrsa8E0Q7dD9zZHlwZ+B16EOGNXoXs=";
+    sha256 = "sha256-IuXhrZRB3o7kbnivv/6En/aAeF2F18sQw9pKs1WEJc4=";
   };
 
-  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" ""
diff --git a/pkgs/development/libraries/science/math/openspecfun/default.nix b/pkgs/development/libraries/science/math/openspecfun/default.nix
index 4422a908838..14befd6d11f 100644
--- a/pkgs/development/libraries/science/math/openspecfun/default.nix
+++ b/pkgs/development/libraries/science/math/openspecfun/default.nix
@@ -2,12 +2,12 @@
 
 stdenv.mkDerivation rec {
   pname = "openspecfun";
-  version = "0.5.5";
+  version = "0.5.6";
   src = fetchFromGitHub {
     owner = "JuliaLang";
     repo = "openspecfun";
     rev = "v${version}";
-    sha256 = "sha256-fX2wc8LHUcF5nN/hiA60ZZ7emRTs0SznOm/0q6lD+Ko=";
+    sha256 = "sha256-4MPoRMtDTkdvDfhNXKk/80pZjXRNEPcysLNTb5ohxWk=";
   };
 
   makeFlags = [ "prefix=$(out)" ];
diff --git a/pkgs/development/libraries/science/math/or-tools/default.nix b/pkgs/development/libraries/science/math/or-tools/default.nix
index 55438c63a5e..5cbc2358989 100644
--- a/pkgs/development/libraries/science/math/or-tools/default.nix
+++ b/pkgs/development/libraries/science/math/or-tools/default.nix
@@ -45,6 +45,9 @@ stdenv.mkDerivation rec {
       url = "https://github.com/google/or-tools/commit/edd1544375bd55f79168db315151a48faa548fa0.patch";
       hash = "sha256-S//1YM3IoRCp3Ghg8zMF0XXgIpVmaw4gH8cVb9eUbqM=";
     })
+    # Don't use non-existent member of string_view. Partial patch from commit
+    # https://github.com/google/or-tools/commit/c5a2fa1eb673bf652cb9ad4f5049d054b8166e17.patch
+    ./fix-stringview-compile.patch
   ];
 
   # or-tools normally attempts to build Protobuf for the build platform when
@@ -60,16 +63,16 @@ stdenv.mkDerivation rec {
     "-DFETCH_PYTHON_DEPS=OFF"
     "-DUSE_GLPK=ON"
     "-DUSE_SCIP=OFF"
-    "-DPython3_EXECUTABLE=${python.pythonForBuild.interpreter}"
+    "-DPython3_EXECUTABLE=${python.pythonOnBuildForHost.interpreter}"
   ] ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_MACOSX_RPATH=OFF" ];
   nativeBuildInputs = [
     cmake
     ensureNewerSourcesForZipFilesHook
     pkg-config
-    python.pythonForBuild
+    python.pythonOnBuildForHost
     swig4
     unzip
-  ] ++ (with python.pythonForBuild.pkgs; [
+  ] ++ (with python.pythonOnBuildForHost.pkgs; [
     pip
     mypy-protobuf
   ]);
diff --git a/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch b/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch
new file mode 100644
index 00000000000..760ab80a38e
--- /dev/null
+++ b/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch
@@ -0,0 +1,36 @@
+diff --git a/ortools/lp_data/lp_parser.cc b/ortools/lp_data/lp_parser.cc
+index 58286306e5..bd26c019ab 100644
+--- a/ortools/lp_data/lp_parser.cc
++++ b/ortools/lp_data/lp_parser.cc
+@@ -185,7 +185,7 @@ bool LPParser::ParseIntegerVariablesList(StringPiece line) {
+ 
+ bool LPParser::ParseConstraint(StringPiece constraint) {
+   const StatusOr<ParsedConstraint> parsed_constraint_or_status =
+-      ::operations_research::glop::ParseConstraint(constraint.as_string());
++      ::operations_research::glop::ParseConstraint(constraint);
+   if (!parsed_constraint_or_status.ok()) return false;
+   const ParsedConstraint& parsed_constraint =
+       parsed_constraint_or_status.value();
+@@ -342,10 +342,9 @@ TokenType LPParser::ConsumeToken(StringPiece* sp) {
+ 
+ }  // namespace
+ 
+-StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
++StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint) {
+   ParsedConstraint parsed_constraint;
+   // Get the name, if present.
+-  StringPiece constraint{constraint_view};
+   StringPiece constraint_copy{constraint};
+   std::string consumed_name;
+   Fractional consumed_coeff;
+@@ -413,8 +412,8 @@ StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
+     right_bound = consumed_coeff;
+     if (ConsumeToken(&constraint, &consumed_name, &consumed_coeff) !=
+         TokenType::END) {
+-      return absl::InvalidArgumentError(absl::StrCat(
+-          "End of input was expected, found: ", constraint.as_string()));
++      return absl::InvalidArgumentError(
++          absl::StrCat("End of input was expected, found: ", constraint));
+     }
+   }
+ 
diff --git a/pkgs/development/libraries/science/math/osi/default.nix b/pkgs/development/libraries/science/math/osi/default.nix
index 8ee048c2819..a6bc5a08625 100644
--- a/pkgs/development/libraries/science/math/osi/default.nix
+++ b/pkgs/development/libraries/science/math/osi/default.nix
@@ -5,13 +5,13 @@
 
 stdenv.mkDerivation rec {
   pname = "osi";
-  version = "0.108.8";
+  version = "0.108.9";
 
   src = fetchFromGitHub {
     owner = "coin-or";
     repo = "Osi";
     rev = "releases/${version}";
-    hash = "sha256-Wyxeyn49QWzGvW6bMwCp39iLkB1eMQUEpIxUgpLcxgA=";
+    hash = "sha256-ueIa9CL4K5ygKpkMRvfuWR0emEG6omg65ZKCsConWsw=";
   };
 
   buildInputs =
diff --git a/pkgs/development/libraries/science/math/scalapack/default.nix b/pkgs/development/libraries/science/math/scalapack/default.nix
index e2a5e76c558..81bcec50447 100644
--- a/pkgs/development/libraries/science/math/scalapack/default.nix
+++ b/pkgs/development/libraries/science/math/scalapack/default.nix
@@ -34,6 +34,8 @@ stdenv.mkDerivation rec {
     sed -i '/xssep/d;/xsgsep/d;/xssyevr/d' TESTING/CMakeLists.txt
   '';
 
+  outputs = [ "out" "dev" ];
+
   nativeBuildInputs = [ cmake ];
   nativeCheckInputs = [ openssh mpiCheckPhaseHook ];
   buildInputs = [ blas lapack ];
diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix
index 67dfef186e7..dd2eb9478f7 100644
--- a/pkgs/development/libraries/science/math/suitesparse/default.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/default.nix
@@ -60,6 +60,12 @@ stdenv.mkDerivation rec {
   ]
   ;
 
+  env = lib.optionalAttrs stdenv.isDarwin {
+    # Ensure that there is enough space for the `fixDarwinDylibNames` hook to
+    # update the install names of the output dylibs.
+    NIX_LDFLAGS = "-headerpad_max_install_names";
+  };
+
   buildFlags = [
     # Build individual shared libraries, not demos
     "library"
diff --git a/pkgs/development/libraries/science/math/superlu/default.nix b/pkgs/development/libraries/science/math/superlu/default.nix
index 26dd00d9606..f99e86ffe47 100644
--- a/pkgs/development/libraries/science/math/superlu/default.nix
+++ b/pkgs/development/libraries/science/math/superlu/default.nix
@@ -21,6 +21,13 @@ stdenv.mkDerivation rec {
     "-DUSE_XSDK_DEFAULTS=true"
   ];
 
+  env = lib.optionalAttrs stdenv.cc.isClang {
+    NIX_CFLAGS_COMPILE = toString [
+      "-Wno-error=implicit-function-declaration"
+      "-Wno-error=implicit-int"
+    ];
+  };
+
   patches = [
     ./add-superlu-lib-as-dependency-for-the-unit-tests.patch
   ];
diff --git a/pkgs/development/libraries/science/math/zn_poly/default.nix b/pkgs/development/libraries/science/math/zn_poly/default.nix
index 13344db9ebc..bdaf6e6284e 100644
--- a/pkgs/development/libraries/science/math/zn_poly/default.nix
+++ b/pkgs/development/libraries/science/math/zn_poly/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   # name of library file ("libzn_poly.so")
   libbasename = "libzn_poly";
-  libext = stdenv.targetPlatform.extensions.sharedLibrary;
+  libext = stdenv.hostPlatform.extensions.sharedLibrary;
 
   makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];