about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science/math')
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff34
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/amd-libflame/default.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix3
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch36
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix2
9 files changed, 98 insertions, 109 deletions
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 962e8e8e6ace..f6d00411221c 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/amd-blis/default.nix
+++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff b/nixpkgs/pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff
deleted file mode 100644
index 3e3ef1e60ff5..000000000000
--- a/nixpkgs/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/nixpkgs/pkgs/development/libraries/science/math/amd-libflame/default.nix b/nixpkgs/pkgs/development/libraries/science/math/amd-libflame/default.nix
index a5b657379411..2ed35d26b907 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/amd-libflame/default.nix
+++ b/nixpkgs/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 ? false
 }:
 
-# 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"
+    "-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) "ENABLE_MULTITHREADING=OFF"
+  ++ lib.optional blas64 "ENABLE_ILP64=ON"
+  ++ lib.optional withAMDOpt "ENABLE_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/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix
index a418df7050eb..744d565eddcd 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix
+++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix
index b3753a63339a..27509ee99339 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix
+++ b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix
@@ -18,15 +18,12 @@
 , gfortran
 , cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities
 , gpuTargets ? [ ] # Non-CUDA targets, that is HIP
-, hip
-, hipblas
-, hipsparse
+, rocmPackages
 , lapack
 , lib
 , libpthreadstubs
 , magmaRelease
 , ninja
-, openmp
 , rocmSupport ? false
 , static ? false
 , stdenv
@@ -47,7 +44,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 +121,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 +141,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/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix
index 4422a908838f..14befd6d11fe 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix
+++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix b/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix
index 55438c63a5e0..8f0c930eff62 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix
+++ b/nixpkgs/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
diff --git a/nixpkgs/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch b/nixpkgs/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch
new file mode 100644
index 000000000000..760ab80a38e4
--- /dev/null
+++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix
index e2a5e76c5586..81bcec504473 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix
+++ b/nixpkgs/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 ];