xref: /petsc/src/snes/tutorials/makefile (revision 47c84c5acc69ca2c78267fc7dfb4d7203bd055c8)
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
9a03c4107SJunchao ZhangV ?= 0
10a03c4107SJunchao ZhangQUIET = $(shell [ "$(V)" = "0" ] && echo @)
11a03c4107SJunchao Zhang
12da4996e5SSatish Balayex55: ex55k.o
13337d88fcSJunchao Zhang
14c4762a1bSJed Brown#-------------------------------------------------------------------------
15a3626c83SSatish Balayifeq ($(PETSC_PRECISION),__fp16)
16a3626c83SSatish Balay  TESTEX19OUT = output/ex19_fp16.testout
17a3626c83SSatish Balayelse
18a3626c83SSatish Balay  TESTEX19OUT = output/ex19_1.testout
19a3626c83SSatish Balayendif
20c4762a1bSJed Brown
21c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
22c4762a1bSJed Browntestex5f: ex5f.PETSc
23a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f.tmp 2>&1;
24a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex5f_1.testout ex5f.tmp > ex5f.dtmp;
25a03c4107SJunchao Zhang	-@if [ ! -s ex5f.dtmp ];  then \
26c4762a1bSJed Brown		echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
2727cb8d94SBarry Smith	else \
2827cb8d94SBarry Smith		echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
29d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
30a03c4107SJunchao Zhang		cat ex5f.tmp; \
3181b9c2c9SBarry Smith		touch ../../../check_error;\
3227cb8d94SBarry Smith	fi; \
33a03c4107SJunchao Zhang	${RM} -f ex5f.tmp ex5f.dtmp;
34c4762a1bSJed Browntestex19: ex19.PETSc
35a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19.tmp 2>&1;
36e14e8d21SSatish Balay	-${QUIET}${DIFF} ${TESTEX19OUT} ex19.tmp > ex19.dtmp;
37a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
38c4762a1bSJed Brown		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
3927cb8d94SBarry Smith	else \
4027cb8d94SBarry Smith		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
41d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
42a03c4107SJunchao Zhang		cat ex19.tmp;\
4381b9c2c9SBarry Smith		touch ../../../check_error;\
4427cb8d94SBarry Smith	fi; \
45a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
4627cb8d94SBarry Smithtestex19_mpi:
47e14e8d21SSatish Balay	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres -snes_type newtontrdc  > ex19.tmp 2>&1;
48e14e8d21SSatish Balay	-${QUIET}${DIFF} ${TESTEX19OUT} ex19.tmp > ex19.dtmp;
49a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
50c4762a1bSJed Brown		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
5127cb8d94SBarry Smith	else \
5227cb8d94SBarry Smith		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
53d30b464cSBarry Smith		echo "See https://petsc.org/release/faq/";\
54a03c4107SJunchao Zhang		cat ex19.tmp; \
5581b9c2c9SBarry Smith		touch ../../../check_error;\
5627cb8d94SBarry Smith	fi; \
57a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
58263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
59c4762a1bSJed Brownrunex19_hypre:
60a03c4107SJunchao 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;
61a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
62a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
63b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE"; \
6427cb8d94SBarry Smith	else  \
65b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE, diffs above\n=========================================\n";\
6681b9c2c9SBarry Smith		touch ../../../check_error;\
6727cb8d94SBarry Smith	fi; \
68a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
69263f2b91SStefano Zampinirunex19_hypre_cuda:
70*955c50dbSJunchao Zhang	-${QUIET}USE_DEVICE=$$(echo $${CUDA_VISIBLE_DEVICES:-0} | cut -d ',' -f 1); \
71*955c50dbSJunchao Zhang	CUDA_VISIBLE_DEVICES=$$USE_DEVICE ${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -petsc_ci -dm_vec_type cuda -dm_mat_type aijcusparse -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19.tmp;
72a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
73a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
74b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/CUDA"; \
7527cb8d94SBarry Smith	else  \
76b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE/CUDA, diffs above\n=========================================\n"; \
7781b9c2c9SBarry Smith		touch ../../../check_error;\
7827cb8d94SBarry Smith	fi; \
79a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
80263f2b91SStefano Zampinirunex19_hypre_hip:
81*955c50dbSJunchao Zhang	-${QUIET}USE_DEVICE=$$(echo $${HIP_VISIBLE_DEVICES:-0} | cut -d ',' -f 1); \
82*955c50dbSJunchao Zhang	HIP_VISIBLE_DEVICES=$$USE_DEVICE ${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -petsc_ci -dm_vec_type hip -dm_mat_type aijhipsparse -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19.tmp;
83a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
84a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
85b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/HIP"; \
8627cb8d94SBarry Smith	else \
87b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with HYPRE/HIP, diffs above\n=========================================\n";\
8881b9c2c9SBarry Smith		touch ../../../check_error;\
8927cb8d94SBarry Smith	fi; \
90a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
91e57d7714SBarry Smithrunex19_cuda:
92a03c4107SJunchao 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;
93a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_cuda_1.out ex19.tmp > ex19.dtmp;
94a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
95b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with CUDA"; \
9627cb8d94SBarry Smith	else  \
97b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with CUDA, diffs above\n=========================================\n"; \
9881b9c2c9SBarry Smith		touch ../../../check_error;\
9927cb8d94SBarry Smith	fi; \
100a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
1013e0e9f3fSSatish Balayrunex19_hip:
102a03c4107SJunchao 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;
103a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_hip_1.out ex19.tmp > ex19.dtmp;
104a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
1053e0e9f3fSSatish Balay		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HIP"; \
1063e0e9f3fSSatish Balay	else  \
1073e0e9f3fSSatish Balay		printf "${PWD}\nPossible problem with ex19 running with HIP, diffs above\n=========================================\n"; \
1083e0e9f3fSSatish Balay		touch ../../../check_error;\
1093e0e9f3fSSatish Balay	fi; \
110a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
111c4762a1bSJed Brownrunex19_ml:
112a03c4107SJunchao Zhang	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19.tmp;
113a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_ml.out ex19.tmp > ex19.dtmp;
114a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
115b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with ML"; \
11627cb8d94SBarry Smith	else \
117b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with ML, diffs above\n=========================================\n"; \
11881b9c2c9SBarry Smith		touch ../../../check_error;\
11927cb8d94SBarry Smith	fi; \
120a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
121c4762a1bSJed Brownrunex19_fieldsplit_mumps:
122a03c4107SJunchao 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;
123a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_fieldsplit_5.out ex19.tmp > ex19.dtmp;
124a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
125b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with MUMPS"; \
12627cb8d94SBarry Smith	else  \
127b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with MUMPS, diffs above\n=========================================\n";\
12881b9c2c9SBarry Smith		touch ../../../check_error;\
12927cb8d94SBarry Smith	fi; \
130a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
131c4762a1bSJed Brownrunex19_superlu_dist:
132a03c4107SJunchao 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;
133a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_superlu.out ex19.tmp > ex19.dtmp;
134a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
135b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuperLU_DIST"; \
13627cb8d94SBarry Smith	else  \
137b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with SuperLU_DIST, diffs above\n=========================================\n"; \
13881b9c2c9SBarry Smith		touch ../../../check_error;\
13927cb8d94SBarry Smith	fi; \
140a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
141c4762a1bSJed Brownrunex19_suitesparse:
142a03c4107SJunchao 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;
143a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex19_suitesparse.out ex19.tmp > ex19.dtmp;
144a03c4107SJunchao Zhang	-@if [ ! -s ex19.dtmp ];  then \
145b3b5ef4dSPierre Jolivet		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuiteSparse"; \
14627cb8d94SBarry Smith	else \
147b3b5ef4dSPierre Jolivet		printf "${PWD}\nPossible problem with ex19 running with SuiteSparse, diffs above\n=========================================\n"; \
14881b9c2c9SBarry Smith		touch ../../../check_error;\
14927cb8d94SBarry Smith	fi; \
150a03c4107SJunchao Zhang	${RM} -f ex19.tmp ex19.dtmp;
151ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
152a03c4107SJunchao 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;
153a03c4107SJunchao Zhang	-${QUIET}${DIFF} output/ex3k_1.out ex3k.tmp > ex3k.dtmp;
154a03c4107SJunchao Zhang	-@if [ ! -s ex3k.dtmp ];  then \
155b3b5ef4dSPierre Jolivet    echo "C/C++ example src/snes/tutorials/ex3k run successfully with Kokkos Kernels"; \
15627cb8d94SBarry Smith  else \
157b3b5ef4dSPierre Jolivet    printf "${PWD}\nPossible problem with ex3k running with Kokkos Kernels, diffs above\n=========================================\n"; \
15881b9c2c9SBarry Smith    touch ../../../check_error;\
15927cb8d94SBarry Smith  fi; \
160a03c4107SJunchao Zhang	${RM} -f ex3k.tmp ex3k.dtmp;
161