diff options
author | Silvan Mosberger <contact@infinisil.com> | 2023-11-26 13:25:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-26 13:25:02 +0100 |
commit | b2f31e717ed69fc3437e0c1bb22f3caf6585e7dd (patch) | |
tree | c33cc71bcc336e963f75162c3b7752c37fd02136 /pkgs/development | |
parent | e42a638befc126efe31a12f3ea20ae6b2ca6f8b0 (diff) | |
parent | cc582d08ed1049314f4766eafe41853dd0fbcea8 (diff) |
Merge pull request #269848 from NixOS/backport-269243-to-release-23.11
[Backport release-23.11] petsc: 3.19.2 -> 3.19.4, fix tests, add more options
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/libraries/science/math/petsc/default.nix | 21 | ||||
-rw-r--r-- | pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch | 24 |
2 files changed, 28 insertions, 17 deletions
diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix index 6589fc0b9b648..c07250c660a33 100644 --- a/pkgs/development/libraries/science/math/petsc/default.nix +++ b/pkgs/development/libraries/science/math/petsc/default.nix @@ -6,11 +6,15 @@ , python3 , blas , lapack +, mpiSupport ? true , mpi # generic mpi dependency , openssh # required for openmpi tests -, petsc-withp4est ? true +, 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 @@ -18,14 +22,14 @@ assert petsc-withp4est -> p4est.mpiSupport; stdenv.mkDerivation rec { pname = "petsc"; - version = "3.19.2"; + version = "3.19.4"; src = fetchurl { url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; - sha256 = "sha256-EU82P3ebsWg5slwOcPiwrg2UfVDnL3xs3csRsAEHmxY="; + sha256 = "sha256-fJQbcb5Sw7dkIU5JLfYBCdEvl/fYVMl6RN8MTZWLOQY="; }; - mpiSupport = !withp4est || p4est.mpiSupport; + inherit mpiSupport; withp4est = petsc-withp4est; strictDeps = true; @@ -49,7 +53,6 @@ stdenv.mkDerivation rec { patches = [ ./filter_mpi_warnings.patch ]; preConfigure = '' - export FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran" patchShebangs ./lib/petsc/bin configureFlagsArray=( $configureFlagsArray @@ -68,6 +71,14 @@ stdenv.mkDerivation rec { ''} "--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' + ''} ) ''; diff --git a/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch b/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch index 590528446f611..6a3c7bee051e6 100644 --- a/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch +++ b/pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch @@ -6,7 +6,7 @@ index 168febb34b6..71068469066 100644 # 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; \ ++ 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 \ @@ -14,7 +14,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -22,7 +22,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -30,7 +30,7 @@ index 168febb34b6..71068469066 100644 #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; \ ++ 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 \ @@ -38,7 +38,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -46,7 +46,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -54,7 +54,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -62,7 +62,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -70,7 +70,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -78,7 +78,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -86,7 +86,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ @@ -94,7 +94,7 @@ index 168febb34b6..71068469066 100644 ${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; \ ++ 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 \ |