xref: /petsc/src/snes/tutorials/makefile (revision a03c41070b004a876398f11afc0585b944a2f8f6)
1cdb0f33dSPierre Jolivet-include ../../../petscdir.mk
2f97672e5SBarry Smith
349762cbcSSatish BalayEXAMPLESMATLAB   = ex5m.m ex29view.m
407c315cfSMartin DiehlCLEANFILES       = ex5f90t
5c4762a1bSJed Brown
6c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/variables
7c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/rules
8c4762a1bSJed Brown
9*a03c4107SJunchao ZhangV ?= 0
10*a03c4107SJunchao ZhangQUIET = $(shell [ "$(V)" = "0" ] && echo @)
11*a03c4107SJunchao Zhang
12da4996e5SSatish Balayex55: ex55k.o
13337d88fcSJunchao Zhang
14c4762a1bSJed Brown#-------------------------------------------------------------------------
15c4762a1bSJed Brown
16c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
17c4762a1bSJed Browntestex5f: ex5f.PETSc
18*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f.tmp 2>&1;
19*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex5f_1.testout ex5f.tmp > ex5f.dtmp;
20*a03c4107SJunchao Zhang	-@if [ ! -s ex5f.dtmp ];  then \
21c4762a1bSJed Brown		echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
2227cb8d94SBarry Smith	else \
2327cb8d94SBarry Smith		echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
24d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
25*a03c4107SJunchao Zhang		cat ex5f.tmp; \
2681b9c2c9SBarry Smith		touch ../../../check_error;\
2727cb8d94SBarry Smith	fi; \
28*a03c4107SJunchao Zhang	${RM} -f ex5f.tmp ex5f.dtmp;
29c4762a1bSJed Browntestex19: ex19.PETSc
30*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19.tmp 2>&1;
31*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_1.testout ex19.tmp > ex19.dtmp;
32*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
33c4762a1bSJed Brown		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
3427cb8d94SBarry Smith	else \
3527cb8d94SBarry Smith		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
36d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
37*a03c4107SJunchao Zhang		cat ex19.tmp;\
3881b9c2c9SBarry Smith		touch ../../../check_error;\
3927cb8d94SBarry Smith	fi; \
40*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
4127cb8d94SBarry Smithtestex19_mpi:
42*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19.tmp 2>&1;
43*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_1.testout ex19.tmp > ex19.dtmp;
44*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
45c4762a1bSJed Brown		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
4627cb8d94SBarry Smith	else \
4727cb8d94SBarry Smith		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
48d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
49*a03c4107SJunchao Zhang		cat ex19.tmp; \
5081b9c2c9SBarry Smith		touch ../../../check_error;\
5127cb8d94SBarry Smith	fi; \
52*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
53263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
54c4762a1bSJed Brownrunex19_hypre:
55*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19.tmp 2>&1;
56*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
57*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
58b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE"; \
5927cb8d94SBarry Smith	else  \
60b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE, diffs above\n=========================================\n";\
6181b9c2c9SBarry Smith		touch ../../../check_error;\
6227cb8d94SBarry Smith	fi; \
63*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
64263f2b91SStefano Zampinirunex19_hypre_cuda:
65*a03c4107SJunchao Zhang	-${QUIET}${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.tmp;
66*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
67*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
68b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/CUDA"; \
6927cb8d94SBarry Smith	else  \
70b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE/CUDA, diffs above\n=========================================\n"; \
7181b9c2c9SBarry Smith		touch ../../../check_error;\
7227cb8d94SBarry Smith	fi; \
73*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
74263f2b91SStefano Zampinirunex19_hypre_hip:
75*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -dm_vec_type hip -dm_mat_type aijhipsparse -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19.tmp;
76*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
77*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
78b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/HIP"; \
7927cb8d94SBarry Smith	else \
80b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE/HIP, diffs above\n=========================================\n";\
8181b9c2c9SBarry Smith		touch ../../../check_error;\
8227cb8d94SBarry Smith	fi; \
83*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
84e57d7714SBarry Smithrunex19_cuda:
85*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -snes_monitor -dm_mat_type seqaijcusparse -dm_vec_type seqcuda -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 > ex19.tmp;
86*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_cuda_1.out ex19.tmp > ex19.dtmp;
87*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
88b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with CUDA"; \
8927cb8d94SBarry Smith	else  \
90b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with CUDA, diffs above\n=========================================\n"; \
9181b9c2c9SBarry Smith		touch ../../../check_error;\
9227cb8d94SBarry Smith	fi; \
93*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
943e0e9f3fSSatish Balayrunex19_hip:
95*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -snes_monitor -dm_mat_type mpiaijhipsparse -dm_vec_type hip -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 > ex19.tmp;
96*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hip_1.out ex19.tmp > ex19.dtmp;
97*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
983e0e9f3fSSatish Balay		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HIP"; \
993e0e9f3fSSatish Balay	else  \
1003e0e9f3fSSatish Balay		printf "${PWD}\nPossible problem with ex19 running with HIP, diffs above\n=========================================\n"; \
1013e0e9f3fSSatish Balay		touch ../../../check_error;\
1023e0e9f3fSSatish Balay	fi; \
103*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
104c4762a1bSJed Brownrunex19_ml:
105*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19.tmp;
106*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_ml.out ex19.tmp > ex19.dtmp;
107*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
108b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with ML"; \
10927cb8d94SBarry Smith	else \
110b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with ML, diffs above\n=========================================\n"; \
11181b9c2c9SBarry Smith		touch ../../../check_error;\
11227cb8d94SBarry Smith	fi; \
113*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
114c4762a1bSJed Brownrunex19_fieldsplit_mumps:
115*a03c4107SJunchao Zhang	-${QUIET}${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.tmp;
116*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_fieldsplit_5.out ex19.tmp > ex19.dtmp;
117*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
118b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with MUMPS"; \
11927cb8d94SBarry Smith	else  \
120b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with MUMPS, diffs above\n=========================================\n";\
12181b9c2c9SBarry Smith		touch ../../../check_error;\
12227cb8d94SBarry Smith	fi; \
123*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
124c4762a1bSJed Brownrunex19_superlu_dist:
125*a03c4107SJunchao Zhang	-${QUIET}${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;
126*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_superlu.out ex19.tmp > ex19.dtmp;
127*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
128b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuperLU_DIST"; \
12927cb8d94SBarry Smith	else  \
130b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with SuperLU_DIST, diffs above\n=========================================\n"; \
13181b9c2c9SBarry Smith		touch ../../../check_error;\
13227cb8d94SBarry Smith	fi; \
133*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
134c4762a1bSJed Brownrunex19_suitesparse:
135*a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19.tmp;
136*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_suitesparse.out ex19.tmp > ex19.dtmp;
137*a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
138b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuiteSparse"; \
13927cb8d94SBarry Smith	else \
140b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with SuiteSparse, diffs above\n=========================================\n"; \
14181b9c2c9SBarry Smith		touch ../../../check_error;\
14227cb8d94SBarry Smith	fi; \
143*a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
144ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
145*a03c4107SJunchao Zhang	-${QUIET}KOKKOS_DISABLE_WARNINGS=1 ${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex3k -view_initial -dm_vec_type kokkos -dm_mat_type aijkokkos -use_gpu_aware_mpi 0 -snes_monitor > ex3k.tmp;
146*a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex3k_1.out ex3k.tmp > ex3k.dtmp;
147*a03c4107SJunchao Zhang	-@if [ ! -s ex3k.dtmp ];  then \
148b3b5ef4dSPierre Jolivet    echo "C/C++ example src/snes/tutorials/ex3k run successfully with Kokkos Kernels"; \
14927cb8d94SBarry Smith  else \
150b3b5ef4dSPierre Jolivet    printf "${PWD}\nPossible problem with ex3k running with Kokkos Kernels, diffs above\n=========================================\n"; \
15181b9c2c9SBarry Smith    touch ../../../check_error;\
15227cb8d94SBarry Smith  fi; \
153*a03c4107SJunchao Zhang	${RM} -f ex3k.tmp ex3k.dtmp;
154