xref: /petsc/src/snes/tutorials/makefile (revision 73f7197e5d8d8845fd240922373df513c2201a82)
1cdb0f33dSPierre Jolivet-include ../../../petscdir.mk
2c4762a1bSJed BrownCFLAGS           =
3c4762a1bSJed BrownFFLAGS		 =
4c4762a1bSJed BrownCPPFLAGS         =
5c4762a1bSJed BrownFPPFLAGS         =
6c4762a1bSJed BrownLOCDIR		 = src/snes/tutorials/
7c4762a1bSJed BrownMANSEC           = SNES
8c4421ceaSFande KongEXAMPLESC	 = ex1.c ex2.c ex3.c  ex5.c ex6.c ex9.c \
906ad4722SPatrick Sanan                   ex12.c ex14.c ex15.c ex17.c ex18.c ex19.c ex21.c ex22.c \
10c4762a1bSJed Brown                   ex25.c ex28.c ex30.c ex33.c \
11c4762a1bSJed Brown                   ex35.c ex42.c ex46.c ex48.c \
12c4762a1bSJed Brown                   ex56.c ex58.c ex59.c \
134e2f9904SMatthew G. Knepley                   ex62.c ex69.c ex70.c ex77.c ex78.c \
14c4762a1bSJed Brown                   ex47cu.cu
15c4762a1bSJed BrownEXAMPLESF	 = ex1f.F90 ex5f.F90 ex5f90.F90 ex5f90t.F90 ex40f90.F90 ex73f90t.F90
16c4762a1bSJed BrownEXAMPLESCH	 =
17c4762a1bSJed BrownEXAMPLESFH       = ex5f.h
18c4762a1bSJed BrownEXAMPLESMATLAB   = ex5m.m  ex61genm.m ex61m.m
19c4762a1bSJed BrownDIRS		 = ex10d network
2007c315cfSMartin DiehlCLEANFILES       = ex5f90t
21c4762a1bSJed Brown
22c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/variables
23c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/rules
24c4762a1bSJed Brown
25c4762a1bSJed Brown#-------------------------------------------------------------------------
26c4762a1bSJed Brown
27c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
28c4762a1bSJed Browntestex5f: ex5f.PETSc
29c4762a1bSJed Brown	@if [ "${PETSC_WITH_BATCH}" != "" ]; then \
30c4762a1bSJed Brown           echo "Running with batch filesystem; to test run src/snes/tutorials/ex5f with" ; \
31c4762a1bSJed Brown           echo "your systems batch system"; \
32c4762a1bSJed Brown        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
33c4762a1bSJed Brown           echo "*mpiexec not found*. Please run src/snes/tutorials/ex5f manually"; \
34c4762a1bSJed Brown        elif [ -f ex5f ]; then \
35c4762a1bSJed Brown	   ${MPIEXEC} -n 1 ./ex5f > ex5f_1.tmp 2>&1; \
36c4762a1bSJed Brown	   if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
37c4762a1bSJed Brown           echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
38c4762a1bSJed Brown	   else echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
39c4762a1bSJed Brown           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
40c4762a1bSJed Brown           cat ex5f_1.tmp; fi;  \
41c4762a1bSJed Brown         ${RM} -f ex5f_1.tmp ;\
42c4762a1bSJed Brown         ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm; fi
43c4762a1bSJed Brown
44c4762a1bSJed Browntestex19: ex19.PETSc
45c4762a1bSJed Brown	-@if [ "${PETSC_WITH_BATCH}" != "" ]; then \
46c4762a1bSJed Brown           echo "Running with batch filesystem; to test run src/snes/tutorials/ex19 with" ; \
47c4762a1bSJed Brown           echo "your systems batch system"; \
48c4762a1bSJed Brown        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
49c4762a1bSJed Brown           echo "*mpiexec not found*. Please run src/snes/tutorials/ex19 manually"; \
50c4762a1bSJed Brown	elif [ -f ex19 ]; then \
51c4762a1bSJed Brown           ${MPIEXEC} -n 1 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
52c4762a1bSJed Brown	   if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
53c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
54c4762a1bSJed Brown	   else echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
55c4762a1bSJed Brown           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
56c4762a1bSJed Brown           cat ex19_1.tmp; fi; \
57c4762a1bSJed Brown	if [ ! "${MPI_IS_MPIUNI}" ]; then \
58c4762a1bSJed Brown           ${MPIEXEC} -n 2 ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
59c4762a1bSJed Brown	   if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
60c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
61c4762a1bSJed Brown	   else echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
62c4762a1bSJed Brown           echo "See http://www.mcs.anl.gov/petsc/documentation/faq.html";\
63c4762a1bSJed Brown           cat ex19_1.tmp; fi; fi; \
64c4762a1bSJed Brown        ${RM} -f ex19_1.tmp; fi
65263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
66c4762a1bSJed Brownrunex19_hypre:
67263f2b91SStefano Zampini	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
68c4762a1bSJed Brown	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
69c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \
70c4762a1bSJed Brown           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
71c4762a1bSJed Brown	   ${RM} -f ex19_1.tmp
72263f2b91SStefano Zampinirunex19_hypre_cuda:
73263f2b91SStefano 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; \
74263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
75263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \
76263f2b91SStefano Zampini           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
77263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
78263f2b91SStefano Zampinirunex19_hypre_hip:
79263f2b91SStefano 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; \
80263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
81263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \
82263f2b91SStefano Zampini           else  printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n"; fi; \
83263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
84e57d7714SBarry Smithrunex19_cuda:
85*73f7197eSJed 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; \
86e57d7714SBarry Smith	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
87e57d7714SBarry Smith           echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \
88e57d7714SBarry Smith           else  printf "${PWD}\nPossible problem with ex19 running with cuda, diffs above\n=========================================\n"; fi; \
89e57d7714SBarry Smith	   ${RM} -f ex19_1.tmp
90c4762a1bSJed Brownrunex19_ml:
91c4762a1bSJed Brown	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
92c4762a1bSJed Brown	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
93c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \
94c4762a1bSJed Brown           else  printf "${PWD}\nPossible problem with ex19 running with ml, diffs above\n=========================================\n"; fi; \
95c4762a1bSJed Brown           ${RM} -f ex19_1.tmp
96c4762a1bSJed Brownrunex19_fieldsplit_mumps:
97c4762a1bSJed 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; \
98c4762a1bSJed Brown	   if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then  \
99c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with mumps"; \
100c4762a1bSJed Brown           else  printf "${PWD}\nPossible problem with ex19 running with mumps, diffs above\n=========================================\n"; fi; \
101c4762a1bSJed Brown           ${RM} -f ex19_6.tmp
102c4762a1bSJed Brownrunex19_superlu_dist:
103c4762a1bSJed 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; \
104c4762a1bSJed Brown	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
105c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \
106c4762a1bSJed Brown           else  printf "${PWD}\nPossible problem with ex19 running with superlu_dist, diffs above\n=========================================\n"; fi; \
107c4762a1bSJed Brown	   ${RM} -f ex19.tmp
108c4762a1bSJed Brownrunex19_suitesparse:
109c4762a1bSJed 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; \
110c4762a1bSJed Brown	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
111c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \
112c4762a1bSJed Brown           else  printf "${PWD}\nPossible problem with ex19 running with suitesparse, diffs above\n=========================================\n"; fi; \
113c4762a1bSJed Brown	   ${RM} -f ex19_1.tmp
114ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
1152fd11365SJunchao 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
116c0558f20SBarry Smith	-@if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
117ef9bfa9fSSatish Balay           echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \
118ef9bfa9fSSatish Balay           else  printf "${PWD}\nPossible problem with ex3k running with kokkos-kernels, diffs above\n=========================================\n"; \
119c0558f20SBarry Smith        fi; \
120c0558f20SBarry Smith	${RM} -f ex3k_1.tm
121c4762a1bSJed Brown
122c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/test
123