xref: /petsc/src/snes/tutorials/makefile (revision 7bb670c6b095b2af062682d621b50e4a531d2a07)
1-include ../../../petscdir.mk
2
3LOCDIR		 = src/snes/tutorials/
4MANSEC           = SNES
5EXAMPLESC	 = ex1.c ex2.c ex3.c  ex5.c ex6.c ex9.c \
6                   ex12.c ex14.c ex15.c ex17.c ex18.c ex19.c ex21.c ex22.c \
7                   ex25.c ex28.c ex30.c ex33.c \
8                   ex35.c ex42.c ex46.c ex48.c \
9                   ex56.c ex58.c ex59.c \
10                   ex62.c ex69.c ex70.c ex77.c ex78.c \
11                   ex47cu.cu
12EXAMPLESF	 = ex1f.F90 ex5f.F90 ex5f90.F90 ex5f90t.F90 ex40f90.F90 ex73f90t.F90
13EXAMPLESCH	 =
14EXAMPLESFH       = ex5f.h
15EXAMPLESMATLAB   = ex5m.m ex29view.m
16DIRS		 = ex10d network
17CLEANFILES       = ex5f90t
18
19include ${PETSC_DIR}/lib/petsc/conf/variables
20include ${PETSC_DIR}/lib/petsc/conf/rules
21
22#-------------------------------------------------------------------------
23
24#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
25testex5f: ex5f.PETSc
26	@if [ "${PETSC_WITH_BATCH}" != "" ]; then \
27           echo "Running with batch filesystem; to test run src/snes/tutorials/ex5f with" ; \
28           echo "your systems batch system"; \
29        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
30           echo "*mpiexec not found*. Please run src/snes/tutorials/ex5f manually"; \
31        elif [ -f ex5f ]; then \
32	   ${MPIEXEC} -n 1 ./ex5f > ex5f_1.tmp 2>&1; \
33	   if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
34           echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
35	   else echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
36           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
37           cat ex5f_1.tmp; fi;  \
38         ${RM} -f ex5f_1.tmp ;\
39         ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm; fi
40
41testex19: ex19.PETSc
42	-@if [ "${PETSC_WITH_BATCH}" != "" ]; then \
43           echo "Running with batch filesystem; to test run src/snes/tutorials/ex19 with" ; \
44           echo "your systems batch system"; \
45        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
46           echo "*mpiexec not found*. Please run src/snes/tutorials/ex19 manually"; \
47	elif [ -f ex19 ]; then \
48           ${MPIEXEC} -n 1 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
49	   if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
50           echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
51	   else echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
52           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
53           cat ex19_1.tmp; fi; \
54	if [ ! "${MPI_IS_MPIUNI}" ]; then \
55           ${MPIEXEC} -n 2 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
56	   if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
57           echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
58	   else echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
59           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
60           cat ex19_1.tmp; fi; fi; \
61        ${RM} -f ex19_1.tmp; fi
62#use unpreconditioned norm because HYPRE device installations use different AMG parameters
63runex19_hypre:
64	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
65	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
66           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \
67           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
68	   ${RM} -f ex19_1.tmp
69runex19_hypre_cuda:
70	-@${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; \
71	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
72           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \
73           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
74	   ${RM} -f ex19_1.tmp
75runex19_hypre_hip:
76	-@${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; \
77	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
78           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \
79           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
80	   ${RM} -f ex19_1.tmp
81runex19_cuda:
82	-@${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; \
83	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
84           echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \
85           else  printf "${PWD}\nPossible problem with ex19 running with cuda, diffs above\n=========================================\n"; fi; \
86	   ${RM} -f ex19_1.tmp
87runex19_ml:
88	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
89	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
90           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \
91           else  printf "${PWD}\nPossible problem with ex19 running with ml, diffs above\n=========================================\n"; fi; \
92           ${RM} -f ex19_1.tmp
93runex19_fieldsplit_mumps:
94	-@${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; \
95	   if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then  \
96           echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \
97           else  printf "${PWD}\nPossible problem with ex19 running with mumps, diffs above\n=========================================\n"; fi; \
98           ${RM} -f ex19_6.tmp
99runex19_superlu_dist:
100	-@${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; \
101	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
102           echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \
103           else  printf "${PWD}\nPossible problem with ex19 running with superlu_dist, diffs above\n=========================================\n"; fi; \
104	   ${RM} -f ex19.tmp
105runex19_suitesparse:
106	-@${MPIEXEC} -n 1 ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19_1.tmp 2>&1; \
107	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
108           echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \
109           else  printf "${PWD}\nPossible problem with ex19 running with suitesparse, diffs above\n=========================================\n"; fi; \
110	   ${RM} -f ex19_1.tmp
111runex3k_kokkos: ex3k.PETSc
112	-@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
113	-@if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
114           echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \
115           else  printf "${PWD}\nPossible problem with ex3k running with kokkos-kernels, diffs above\n=========================================\n"; \
116        fi; \
117	${RM} -f ex3k_1.tm
118
119include ${PETSC_DIR}/lib/petsc/conf/test
120