xref: /petsc/src/snes/tutorials/makefile (revision 27cb8d94dc15eb45ef255ad788555826b9151a56)
1cdb0f33dSPierre Jolivet-include ../../../petscdir.mk
2f97672e5SBarry Smith
3c4762a1bSJed BrownLOCDIR		 = src/snes/tutorials/
4c4762a1bSJed BrownMANSEC           = SNES
549762cbcSSatish BalayEXAMPLESMATLAB   = ex5m.m ex29view.m
6c4762a1bSJed BrownDIRS		 = ex10d network
707c315cfSMartin DiehlCLEANFILES       = ex5f90t
8c4762a1bSJed Brown
9c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/variables
10c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/rules
11c4762a1bSJed Brown
12c4762a1bSJed Brown#-------------------------------------------------------------------------
13c4762a1bSJed Brown
14c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
15c4762a1bSJed Browntestex5f: ex5f.PETSc
16*27cb8d94SBarry Smith	-@${MPIEXEC} -n 1 ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \
17c4762a1bSJed Brown        if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
18c4762a1bSJed Brown          echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
19*27cb8d94SBarry Smith        else \
20*27cb8d94SBarry Smith          echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
21d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
22*27cb8d94SBarry Smith          cat ex5f_1.tmp; \
23*27cb8d94SBarry Smith          touch ${PETSC_DIR}/check_error;\
24*27cb8d94SBarry Smith        fi;  \
25c4762a1bSJed Brown        ${RM} -f ex5f_1.tmp ;\
26*27cb8d94SBarry Smith        ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm;
27c4762a1bSJed Browntestex19: ex19.PETSc
28*27cb8d94SBarry Smith	-@${MPIEXEC} -n 1 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
29c4762a1bSJed Brown        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
30c4762a1bSJed Brown          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
31*27cb8d94SBarry Smith        else \
32*27cb8d94SBarry Smith          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
33d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
34*27cb8d94SBarry Smith          cat ex19_1.tmp;\
35*27cb8d94SBarry Smith          touch ${PETSC_DIR}/check_error;\
36*27cb8d94SBarry Smith        fi;\
37*27cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
38*27cb8d94SBarry Smithtestex19_mpi:
39*27cb8d94SBarry Smith	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
40c4762a1bSJed Brown        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
41c4762a1bSJed Brown          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
42*27cb8d94SBarry Smith        else \
43*27cb8d94SBarry Smith          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
44d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
45*27cb8d94SBarry Smith          cat ex19_1.tmp; \
46*27cb8d94SBarry Smith          touch ${PETSC_DIR}/check_error;\
47*27cb8d94SBarry Smith        fi;\
48*27cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
49263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
50c4762a1bSJed Brownrunex19_hypre:
51263f2b91SStefano Zampini	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
52c4762a1bSJed Brown          if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
53c4762a1bSJed Brown            echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \
54*27cb8d94SBarry Smith          else  \
55*27cb8d94SBarry Smith            printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n";\
56*27cb8d94SBarry Smith            touch ${PETSC_DIR}/check_error;\
57*27cb8d94SBarry Smith          fi; \
58c4762a1bSJed Brown          ${RM} -f ex19_1.tmp
59263f2b91SStefano Zampinirunex19_hypre_cuda:
60263f2b91SStefano Zampini	-@${MPIEXEC} -n 2 ./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; \
61263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
62263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \
63*27cb8d94SBarry Smith           else  \
64*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; \
65*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
66*27cb8d94SBarry Smith             fi; \
67263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
68263f2b91SStefano Zampinirunex19_hypre_hip:
69263f2b91SStefano Zampini	-@${MPIEXEC} -n 2 ./ex19 -dm_vec_type hip -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
70263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
71263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \
72*27cb8d94SBarry Smith           else \
73*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n";\
74*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
75*27cb8d94SBarry Smith           fi; \
76263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
77e57d7714SBarry Smithrunex19_cuda:
7873f7197eSJed Brown	-@${MPIEXEC} -n 1 ./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; \
79e57d7714SBarry Smith	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
80e57d7714SBarry Smith           echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \
81*27cb8d94SBarry Smith           else  \
82*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with cuda, diffs above\n=========================================\n"; \
83*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
84*27cb8d94SBarry Smith           fi; \
85e57d7714SBarry Smith	   ${RM} -f ex19_1.tmp
86c4762a1bSJed Brownrunex19_ml:
87c4762a1bSJed Brown	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
88c4762a1bSJed Brown	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
89c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \
90*27cb8d94SBarry Smith           else \
91*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with ml, diffs above\n=========================================\n"; \
92*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
93*27cb8d94SBarry Smith           fi; \
94c4762a1bSJed Brown           ${RM} -f ex19_1.tmp
95c4762a1bSJed Brownrunex19_fieldsplit_mumps:
96c4762a1bSJed Brown	-@${MPIEXEC} -n 2 ./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; \
97c4762a1bSJed Brown	   if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then  \
98c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \
99*27cb8d94SBarry Smith           else  \
100*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with mumps, diffs above\n=========================================\n";\
101*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
102*27cb8d94SBarry Smith           fi; \
103c4762a1bSJed Brown           ${RM} -f ex19_6.tmp
104c4762a1bSJed Brownrunex19_superlu_dist:
105c4762a1bSJed Brown	-@${MPIEXEC} -n 1 ./ex19 -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist > ex19.tmp 2>&1; \
106c4762a1bSJed Brown	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
107c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \
108*27cb8d94SBarry Smith           else  \
109*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with superlu_dist, diffs above\n=========================================\n"; \
110*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
111*27cb8d94SBarry Smith           fi; \
112c4762a1bSJed Brown	   ${RM} -f ex19.tmp
113c4762a1bSJed Brownrunex19_suitesparse:
114c4762a1bSJed Brown	-@${MPIEXEC} -n 1 ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19_1.tmp 2>&1; \
115c4762a1bSJed Brown	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
116c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \
117*27cb8d94SBarry Smith           else \
118*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with suitesparse, diffs above\n=========================================\n"; \
119*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
120*27cb8d94SBarry Smith           fi; \
121c4762a1bSJed Brown	   ${RM} -f ex19_1.tmp
122ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
1232fd11365SJunchao Zhang	-@export OMP_PROC_BIND=false && ${MPIEXEC} -n 2 ./ex3k -view_initial -dm_vec_type kokkos -dm_mat_type aijkokkos -use_gpu_aware_mpi 0 -snes_monitor > ex3k_1.tmp 2>&1
124c0558f20SBarry Smith	-@if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
125ef9bfa9fSSatish Balay           echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \
126*27cb8d94SBarry Smith           else \
127*27cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex3k running with kokkos-kernels, diffs above\n=========================================\n"; \
128*27cb8d94SBarry Smith             touch ${PETSC_DIR}/check_error;\
129*27cb8d94SBarry Smith           fi; \
130c0558f20SBarry Smith        fi; \
131c0558f20SBarry Smith	${RM} -f ex3k_1.tm
132c4762a1bSJed Brown
133c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/test
134