petsc: 3.17.4 -> 3.19.1, fixed build

PETSc versions earlier than 3.18.6 are broken because of incorrect make
option generation.

+108 -2
+8 -2
pkgs/development/libraries/science/math/petsc/default.nix
··· 18 19 stdenv.mkDerivation rec { 20 pname = "petsc"; 21 - version = "3.17.4"; 22 23 src = fetchurl { 24 url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; 25 - sha256 = "sha256-mcEnSGcio//ZWiaLTOsJdsvyF5JsaBqWMb1yRuq4yyo="; 26 }; 27 28 mpiSupport = !withp4est || p4est.mpiSupport; ··· 41 substituteInPlace config/install.py \ 42 --replace /usr/bin/install_name_tool ${darwin.cctools}/bin/install_name_tool 43 ''; 44 45 preConfigure = '' 46 export FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran"
··· 18 19 stdenv.mkDerivation rec { 20 pname = "petsc"; 21 + version = "3.19.1"; 22 23 src = fetchurl { 24 url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; 25 + sha256 = "sha256-dNtgxTyAtI1cOeB7w5qIPsztiLnySl3hfPb0hakD4SA="; 26 }; 27 28 mpiSupport = !withp4est || p4est.mpiSupport; ··· 41 substituteInPlace config/install.py \ 42 --replace /usr/bin/install_name_tool ${darwin.cctools}/bin/install_name_tool 43 ''; 44 + 45 + # Both OpenMPI and MPICH get confused by the sandbox environment and spew errors like this (both to stdout and stderr): 46 + # [hwloc/linux] failed to find sysfs cpu topology directory, aborting linux discovery. 47 + # [1684747490.391106] [localhost:14258:0] tcp_iface.c:837 UCX ERROR opendir(/sys/class/net) failed: No such file or directory 48 + # These messages contaminate test output, which makes the quicktest suite to fail. The patch adds filtering for these messages. 49 + patches = [ ./filter_mpi_warnings.patch ]; 50 51 preConfigure = '' 52 export FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran"
+100
pkgs/development/libraries/science/math/petsc/filter_mpi_warnings.patch
···
··· 1 + diff --git a/src/snes/tutorials/makefile b/src/snes/tutorials/makefile 2 + index 168febb34b6..71068469066 100644 3 + --- a/src/snes/tutorials/makefile 4 + +++ b/src/snes/tutorials/makefile 5 + @@ -13,6 +13,7 @@ include ${PETSC_DIR}/lib/petsc/conf/rules 6 + # these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed 7 + testex5f: ex5f.PETSc 8 + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \ 9 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex5f_1.tmp; \ 10 + if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \ 11 + echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \ 12 + else \ 13 + @@ -25,6 +26,7 @@ testex5f: ex5f.PETSc 14 + ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm; 15 + testex19: ex19.PETSc 16 + -@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres > ex19_1.tmp 2>&1; \ 17 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 18 + if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \ 19 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \ 20 + else \ 21 + @@ -36,6 +38,7 @@ testex19: ex19.PETSc 22 + ${RM} -f ex19_1.tmp; 23 + testex19_mpi: 24 + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres > ex19_1.tmp 2>&1; \ 25 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 26 + if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \ 27 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \ 28 + else \ 29 + @@ -48,6 +51,7 @@ testex19_mpi: 30 + #use unpreconditioned norm because HYPRE device installations use different AMG parameters 31 + runex19_hypre: 32 + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \ 33 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 34 + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ 35 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \ 36 + else \ 37 + @@ -57,6 +61,7 @@ runex19_hypre: 38 + ${RM} -f ex19_1.tmp 39 + runex19_hypre_cuda: 40 + -@${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; \ 41 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 42 + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ 43 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \ 44 + else \ 45 + @@ -66,6 +71,7 @@ runex19_hypre_cuda: 46 + ${RM} -f ex19_1.tmp 47 + runex19_hypre_hip: 48 + -@${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; \ 49 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 50 + if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \ 51 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \ 52 + else \ 53 + @@ -75,6 +81,7 @@ runex19_hypre_hip: 54 + ${RM} -f ex19_1.tmp 55 + runex19_cuda: 56 + -@${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; \ 57 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 58 + if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \ 59 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \ 60 + else \ 61 + @@ -84,6 +91,7 @@ runex19_cuda: 62 + ${RM} -f ex19_1.tmp 63 + runex19_ml: 64 + -@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \ 65 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 66 + if (${DIFF} output/ex19_ml.out ex19_1.tmp) then \ 67 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \ 68 + else \ 69 + @@ -93,6 +101,7 @@ runex19_ml: 70 + ${RM} -f ex19_1.tmp 71 + runex19_fieldsplit_mumps: 72 + -@${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; \ 73 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_6.tmp; \ 74 + if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then \ 75 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \ 76 + else \ 77 + @@ -102,6 +111,7 @@ runex19_fieldsplit_mumps: 78 + ${RM} -f ex19_6.tmp 79 + runex19_superlu_dist: 80 + -@${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; \ 81 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19.tmp; \ 82 + if (${DIFF} output/ex19_superlu.out ex19.tmp) then \ 83 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \ 84 + else \ 85 + @@ -111,6 +121,7 @@ runex19_superlu_dist: 86 + ${RM} -f ex19.tmp 87 + runex19_suitesparse: 88 + -@${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; \ 89 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex19_1.tmp; \ 90 + if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \ 91 + echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \ 92 + else \ 93 + @@ -120,6 +131,7 @@ runex19_suitesparse: 94 + ${RM} -f ex19_1.tmp 95 + runex3k_kokkos: ex3k.PETSc 96 + -@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 ;\ 97 + + sed -i '/\[hwloc\/linux\]/d ; /ERROR opendir(\/sys\/class\/net) failed/d' ex3k_1.tmp; \ 98 + if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \ 99 + echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \ 100 + else \