diff options
Diffstat (limited to 'pkgs/development/libraries/science/math')
8 files changed, 37 insertions, 242 deletions
diff --git a/pkgs/development/libraries/science/math/clblast/default.nix b/pkgs/development/libraries/science/math/clblast/default.nix index a7c8d8faee4c0..3bf38086ca2fa 100644 --- a/pkgs/development/libraries/science/math/clblast/default.nix +++ b/pkgs/development/libraries/science/math/clblast/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation rec { pname = "clblast"; - version = "1.6.2"; + version = "1.6.3"; src = fetchFromGitHub { owner = "CNugteren"; repo = "CLBlast"; rev = version; - hash = "sha256-S25g25Il6rzkpU9IqOFDDeEr3uYyt/uewZZAl09YSts="; + hash = "sha256-fzenYFCAQ0B2NQgh5OaErv/yNEzjznB6ogRapqfL6P4="; }; nativeBuildInputs = [ diff --git a/pkgs/development/libraries/science/math/faiss/default.nix b/pkgs/development/libraries/science/math/faiss/default.nix index 5af73735fdf60..1dfe814427889 100644 --- a/pkgs/development/libraries/science/math/faiss/default.nix +++ b/pkgs/development/libraries/science/math/faiss/default.nix @@ -33,19 +33,15 @@ let stdenv = if cudaSupport then backendStdenv else inputs.stdenv; - cudaJoined = symlinkJoin { - name = "cuda-packages-unsplit"; - paths = with cudaPackages; [ - cuda_cudart # cuda_runtime.h - libcublas - libcurand - 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 - ]; - }; + cudaComponents = with cudaPackages; [ + cuda_cudart # cuda_runtime.h + libcublas + libcurand + cuda_cccl + + # cuda_profiler_api.h + (cudaPackages.cuda_profiler_api or cudaPackages.cuda_nvprof) + ]; in stdenv.mkDerivation { inherit pname version; @@ -68,9 +64,7 @@ stdenv.mkDerivation { pythonPackages.wheel ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp - ] ++ lib.optionals cudaSupport [ - cudaJoined - ]; + ] ++ lib.optionals cudaSupport cudaComponents; propagatedBuildInputs = lib.optionals pythonSupport [ pythonPackages.numpy @@ -93,7 +87,6 @@ stdenv.mkDerivation { "-DFAISS_OPT_LEVEL=${optLevel}" ] ++ lib.optionals cudaSupport [ "-DCMAKE_CUDA_ARCHITECTURES=${flags.cmakeCudaArchitecturesString}" - "-DCUDAToolkit_INCLUDE_DIR=${cudaJoined}/include" ]; buildFlags = [ diff --git a/pkgs/development/libraries/science/math/magma/generic.nix b/pkgs/development/libraries/science/math/magma/generic.nix index a675142f361d4..08dac598f7d91 100644 --- a/pkgs/development/libraries/science/math/magma/generic.nix +++ b/pkgs/development/libraries/science/math/magma/generic.nix @@ -134,19 +134,15 @@ stdenv.mkDerivation { blas python3 ] ++ lists.optionals cudaSupport (with effectiveCudaPackages; [ - cuda_cudart.dev # cuda_runtime.h - cuda_cudart.lib # cudart - cuda_cudart.static # cudart_static - libcublas.dev # cublas_v2.h - libcublas.lib # cublas - libcusparse.dev # cusparse.h - libcusparse.lib # cusparse + cuda_cudart # cuda_runtime.h + libcublas # cublas_v2.h + libcusparse # cusparse.h ] ++ lists.optionals (cudaOlder "11.8") [ - cuda_nvprof.dev # <cuda_profiler_api.h> + cuda_nvprof # <cuda_profiler_api.h> ] ++ lists.optionals (cudaAtLeast "11.8") [ - cuda_profiler_api.dev # <cuda_profiler_api.h> + cuda_profiler_api # <cuda_profiler_api.h> ] ++ lists.optionals (cudaAtLeast "12.0") [ - cuda_cccl.dev # <nv/target> + cuda_cccl # <nv/target> ]) ++ lists.optionals rocmSupport [ rocmPackages.clr rocmPackages.hipblas diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 842bc3af9834a..e36c92d60b67b 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -181,6 +181,10 @@ stdenv.mkDerivation rec { "strictoverflow" # don't interfere with dynamic target detection "relro" "bindnow" + ] ++ lib.optionals stdenv.hostPlatform.isAarch64 [ + # "__builtin_clear_padding not supported for variable length aggregates" + # in aarch64-specific code + "trivialautovarinit" ]; nativeBuildInputs = [ diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix deleted file mode 100644 index c07250c660a33..0000000000000 --- a/pkgs/development/libraries/science/math/petsc/default.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ lib -, stdenv -, fetchurl -, darwin -, gfortran -, python3 -, blas -, lapack -, mpiSupport ? true -, mpi # generic mpi dependency -, openssh # required for openmpi tests -, petsc-withp4est ? false -, p4est -, zlib # propagated by p4est but required by petsc -, petsc-optimized ? false -, petsc-scalar-type ? "real" -, petsc-precision ? "double" -}: - -# This version of PETSc does not support a non-MPI p4est build -assert petsc-withp4est -> p4est.mpiSupport; - -stdenv.mkDerivation rec { - pname = "petsc"; - version = "3.19.4"; - - src = fetchurl { - url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; - sha256 = "sha256-fJQbcb5Sw7dkIU5JLfYBCdEvl/fYVMl6RN8MTZWLOQY="; - }; - - inherit mpiSupport; - withp4est = petsc-withp4est; - - strictDeps = true; - nativeBuildInputs = [ python3 gfortran ] - ++ lib.optional mpiSupport mpi - ++ lib.optional (mpiSupport && mpi.pname == "openmpi") openssh - ; - buildInputs = [ blas lapack ] - ++ lib.optional withp4est p4est - ; - - prePatch = lib.optionalString stdenv.isDarwin '' - substituteInPlace config/install.py \ - --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 = '' - patchShebangs ./lib/petsc/bin - configureFlagsArray=( - $configureFlagsArray - ${if !mpiSupport then '' - "--with-mpi=0" - '' else '' - "--CC=mpicc" - "--with-cxx=mpicxx" - "--with-fc=mpif90" - "--with-mpi=1" - ''} - ${lib.optionalString withp4est '' - "--with-p4est=1" - "--with-zlib-include=${zlib.dev}/include" - "--with-zlib-lib=-L${zlib}/lib -lz" - ''} - "--with-blas=1" - "--with-lapack=1" - "--with-scalar-type=${petsc-scalar-type}" - "--with-precision=${petsc-precision}" - ${lib.optionalString petsc-optimized '' - "--with-debugging=0" - COPTFLAGS='-g -O3' - FOPTFLAGS='-g -O3' - CXXOPTFLAGS='-g -O3' - ''} - ) - ''; - - configureScript = "python ./configure"; - - enableParallelBuilding = true; - doCheck = stdenv.hostPlatform == stdenv.buildPlatform; - - meta = with lib; { - description = "Portable Extensible Toolkit for Scientific computation"; - homepage = "https://www.mcs.anl.gov/petsc/index.html"; - license = licenses.bsd2; - maintainers = with maintainers; [ cburstedde ]; - }; -} diff --git a/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch b/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch deleted file mode 100644 index f3a34de9304e3..0000000000000 --- a/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch +++ /dev/null @@ -1,100 +0,0 @@ -diff --git a/src/snes/tutorials/makefile b/src/snes/tutorials/makefile -index 672a62a..a5fd1c4 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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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 scandir(\/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/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index fcfd9b56a1b14..43623e8604b9b 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -36,17 +36,15 @@ stdenv.mkDerivation rec { buildInputs = assert (blas.isILP64 == lapack.isILP64); [ blas lapack metis - gfortran.cc.lib + (lib.getLib gfortran.cc) gmp mpfr ] ++ lib.optionals stdenv.cc.isClang [ openmp ] ++ lib.optionals enableCuda [ - cudaPackages.cuda_cudart.dev - cudaPackages.cuda_cudart.lib - cudaPackages.cuda_cccl.dev - cudaPackages.libcublas.dev - cudaPackages.libcublas.lib + cudaPackages.cuda_cudart + cudaPackages.cuda_cccl + cudaPackages.libcublas ]; preConfigure = '' @@ -63,8 +61,8 @@ stdenv.mkDerivation rec { "CFLAGS=-DBLAS64" ] ++ lib.optionals enableCuda [ "CUDA_PATH=${cudaPackages.cuda_nvcc}" - "CUDART_LIB=${cudaPackages.cuda_cudart.lib}/lib/libcudart.so" - "CUBLAS_LIB=${cudaPackages.libcublas.lib}/lib/libcublas.so" + "CUDART_LIB=${lib.getLib cudaPackages.cuda_cudart}/lib/libcudart.so" + "CUBLAS_LIB=${lib.getLib cudaPackages.libcublas}/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.13.0/SuiteSparse_config/SuiteSparse_config.mk#L368 diff --git a/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix b/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix index e9367d416e325..e20365b215dcc 100644 --- a/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix +++ b/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix @@ -14,15 +14,15 @@ inherit (cudaPackages) backendStdenv flags; cuda-common-redist = with cudaPackages; [ - cuda_cudart.dev # cuda_runtime.h - cuda_cudart.lib - cuda_cccl.dev # <nv/target> - libcublas.dev # cublas_v2.h - libcublas.lib - libcusolver.dev # cusolverDn.h - libcusolver.lib - libcusparse.dev # cusparse.h - libcusparse.lib + (lib.getDev cuda_cudart) # cuda_runtime.h + (lib.getLib cuda_cudart) + (lib.getDev cuda_cccl) # <nv/target> + (lib.getDev libcublas) # cublas_v2.h + (lib.getLib libcublas) + (lib.getDev libcusolver) # cusolverDn.h + (lib.getLib libcusolver) + (lib.getDev libcusparse) # cusparse.h + (lib.getLib libcusparse) ]; cuda-native-redist = symlinkJoin { |