xref: /petsc/src/snes/tutorials/makefile (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
1-include ../../../petscdir.mk
2
3LOCDIR		 = src/snes/tutorials/
4MANSEC           = SNES
5EXAMPLESMATLAB   = ex5m.m ex29view.m
6DIRS		 = ex10d network
7CLEANFILES       = ex5f90t
8
9include ${PETSC_DIR}/lib/petsc/conf/variables
10include ${PETSC_DIR}/lib/petsc/conf/rules
11
12#-------------------------------------------------------------------------
13
14#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
15testex5f: ex5f.PETSc
16	-@${MPIEXEC} -n 1 ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \
17        if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
18          echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
19        else \
20          echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
21          echo "See https://petsc.org/release/faq/";\
22          cat ex5f_1.tmp; \
23          touch ${PETSC_DIR}/check_error;\
24        fi;  \
25        ${RM} -f ex5f_1.tmp ;\
26        ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm;
27testex19: ex19.PETSc
28	-@${MPIEXEC} -n 1 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
29        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
30          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
31        else \
32          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
33          echo "See https://petsc.org/release/faq/";\
34          cat ex19_1.tmp;\
35          touch ${PETSC_DIR}/check_error;\
36        fi;\
37        ${RM} -f ex19_1.tmp;
38testex19_mpi:
39	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
40        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
41          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
42        else \
43          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
44          echo "See https://petsc.org/release/faq/";\
45          cat ex19_1.tmp; \
46          touch ${PETSC_DIR}/check_error;\
47        fi;\
48        ${RM} -f ex19_1.tmp;
49#use unpreconditioned norm because HYPRE device installations use different AMG parameters
50runex19_hypre:
51	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
52          if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
53            echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \
54          else  \
55            printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n";\
56            touch ${PETSC_DIR}/check_error;\
57          fi; \
58          ${RM} -f ex19_1.tmp
59runex19_hypre_cuda:
60	-@${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; \
61	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
62           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \
63           else  \
64             printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; \
65             touch ${PETSC_DIR}/check_error;\
66             fi; \
67	   ${RM} -f ex19_1.tmp
68runex19_hypre_hip:
69	-@${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; \
70	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
71           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \
72           else \
73             printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n";\
74             touch ${PETSC_DIR}/check_error;\
75           fi; \
76	   ${RM} -f ex19_1.tmp
77runex19_cuda:
78	-@${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; \
79	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
80           echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \
81           else  \
82             printf "${PWD}\nPossible problem with ex19 running with cuda, diffs above\n=========================================\n"; \
83             touch ${PETSC_DIR}/check_error;\
84           fi; \
85	   ${RM} -f ex19_1.tmp
86runex19_ml:
87	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
88	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
89           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \
90           else \
91             printf "${PWD}\nPossible problem with ex19 running with ml, diffs above\n=========================================\n"; \
92             touch ${PETSC_DIR}/check_error;\
93           fi; \
94           ${RM} -f ex19_1.tmp
95runex19_fieldsplit_mumps:
96	-@${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; \
97	   if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then  \
98           echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \
99           else  \
100             printf "${PWD}\nPossible problem with ex19 running with mumps, diffs above\n=========================================\n";\
101             touch ${PETSC_DIR}/check_error;\
102           fi; \
103           ${RM} -f ex19_6.tmp
104runex19_superlu_dist:
105	-@${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; \
106	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
107           echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \
108           else  \
109             printf "${PWD}\nPossible problem with ex19 running with superlu_dist, diffs above\n=========================================\n"; \
110             touch ${PETSC_DIR}/check_error;\
111           fi; \
112	   ${RM} -f ex19.tmp
113runex19_suitesparse:
114	-@${MPIEXEC} -n 1 ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19_1.tmp 2>&1; \
115	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
116           echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \
117           else \
118             printf "${PWD}\nPossible problem with ex19 running with suitesparse, diffs above\n=========================================\n"; \
119             touch ${PETSC_DIR}/check_error;\
120           fi; \
121	   ${RM} -f ex19_1.tmp
122runex3k_kokkos: ex3k.PETSc
123	-@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 ;\
124	if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
125          echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \
126        else \
127          printf "${PWD}\nPossible problem with ex3k running with kokkos-kernels, diffs above\n=========================================\n"; \
128          touch ${PETSC_DIR}/check_error;\
129        fi; \
130	${RM} -f ex3k_1.tmp
131
132include ${PETSC_DIR}/lib/petsc/conf/test
133