xref: /petsc/src/snes/tutorials/makefile (revision 47c84c5acc69ca2c78267fc7dfb4d7203bd055c8)
1-include ../../../petscdir.mk
2
3EXAMPLESMATLAB   = ex5m.m ex29view.m
4CLEANFILES       = ex5f90t
5
6include ${PETSC_DIR}/lib/petsc/conf/variables
7include ${PETSC_DIR}/lib/petsc/conf/rules
8
9V ?= 0
10QUIET = $(shell [ "$(V)" = "0" ] && echo @)
11
12ex55: ex55k.o
13
14#-------------------------------------------------------------------------
15ifeq ($(PETSC_PRECISION),__fp16)
16  TESTEX19OUT = output/ex19_fp16.testout
17else
18  TESTEX19OUT = output/ex19_1.testout
19endif
20
21#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
22testex5f: ex5f.PETSc
23	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f.tmp 2>&1;
24	-${QUIET}${DIFF} output/ex5f_1.testout ex5f.tmp > ex5f.dtmp;
25	-@if [ ! -s ex5f.dtmp ];  then \
26		echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
27	else \
28		echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
29		echo "See https://petsc.org/release/faq/";\
30		cat ex5f.tmp; \
31		touch ../../../check_error;\
32	fi; \
33	${RM} -f ex5f.tmp ex5f.dtmp;
34testex19: ex19.PETSc
35	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19.tmp 2>&1;
36	-${QUIET}${DIFF} ${TESTEX19OUT} ex19.tmp > ex19.dtmp;
37	-@if [ ! -s ex19.dtmp ];  then \
38		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
39	else \
40		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
41		echo "See https://petsc.org/release/faq/";\
42		cat ex19.tmp;\
43		touch ../../../check_error;\
44	fi; \
45	${RM} -f ex19.tmp ex19.dtmp;
46testex19_mpi:
47	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres -snes_type newtontrdc  > ex19.tmp 2>&1;
48	-${QUIET}${DIFF} ${TESTEX19OUT} ex19.tmp > ex19.dtmp;
49	-@if [ ! -s ex19.dtmp ];  then \
50		echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
51	else \
52		echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
53		echo "See https://petsc.org/release/faq/";\
54		cat ex19.tmp; \
55		touch ../../../check_error;\
56	fi; \
57	${RM} -f ex19.tmp ex19.dtmp;
58#use unpreconditioned norm because HYPRE device installations use different AMG parameters
59runex19_hypre:
60	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19.tmp 2>&1;
61	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
62	-@if [ ! -s ex19.dtmp ];  then \
63		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE"; \
64	else  \
65		printf "${PWD}\nPossible problem with ex19 running with HYPRE, diffs above\n=========================================\n";\
66		touch ../../../check_error;\
67	fi; \
68	${RM} -f ex19.tmp ex19.dtmp;
69runex19_hypre_cuda:
70	-${QUIET}USE_DEVICE=$$(echo $${CUDA_VISIBLE_DEVICES:-0} | cut -d ',' -f 1); \
71	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;
72	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
73	-@if [ ! -s ex19.dtmp ];  then \
74		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/CUDA"; \
75	else  \
76		printf "${PWD}\nPossible problem with ex19 running with HYPRE/CUDA, diffs above\n=========================================\n"; \
77		touch ../../../check_error;\
78	fi; \
79	${RM} -f ex19.tmp ex19.dtmp;
80runex19_hypre_hip:
81	-${QUIET}USE_DEVICE=$$(echo $${HIP_VISIBLE_DEVICES:-0} | cut -d ',' -f 1); \
82	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;
83	-${QUIET}${DIFF} output/ex19_hypre.out ex19.tmp > ex19.dtmp;
84	-@if [ ! -s ex19.dtmp ];  then \
85		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/HIP"; \
86	else \
87		printf "${PWD}\nPossible problem with ex19 running with HYPRE/HIP, diffs above\n=========================================\n";\
88		touch ../../../check_error;\
89	fi; \
90	${RM} -f ex19.tmp ex19.dtmp;
91runex19_cuda:
92	-${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;
93	-${QUIET}${DIFF} output/ex19_cuda_1.out ex19.tmp > ex19.dtmp;
94	-@if [ ! -s ex19.dtmp ];  then \
95		echo "C/C++ example src/snes/tutorials/ex19 run successfully with CUDA"; \
96	else  \
97		printf "${PWD}\nPossible problem with ex19 running with CUDA, diffs above\n=========================================\n"; \
98		touch ../../../check_error;\
99	fi; \
100	${RM} -f ex19.tmp ex19.dtmp;
101runex19_hip:
102	-${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;
103	-${QUIET}${DIFF} output/ex19_hip_1.out ex19.tmp > ex19.dtmp;
104	-@if [ ! -s ex19.dtmp ];  then \
105		echo "C/C++ example src/snes/tutorials/ex19 run successfully with HIP"; \
106	else  \
107		printf "${PWD}\nPossible problem with ex19 running with HIP, diffs above\n=========================================\n"; \
108		touch ../../../check_error;\
109	fi; \
110	${RM} -f ex19.tmp ex19.dtmp;
111runex19_ml:
112	-${QUIET}${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19.tmp;
113	-${QUIET}${DIFF} output/ex19_ml.out ex19.tmp > ex19.dtmp;
114	-@if [ ! -s ex19.dtmp ];  then \
115		echo "C/C++ example src/snes/tutorials/ex19 run successfully with ML"; \
116	else \
117		printf "${PWD}\nPossible problem with ex19 running with ML, diffs above\n=========================================\n"; \
118		touch ../../../check_error;\
119	fi; \
120	${RM} -f ex19.tmp ex19.dtmp;
121runex19_fieldsplit_mumps:
122	-${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;
123	-${QUIET}${DIFF} output/ex19_fieldsplit_5.out ex19.tmp > ex19.dtmp;
124	-@if [ ! -s ex19.dtmp ];  then \
125		echo "C/C++ example src/snes/tutorials/ex19 run successfully with MUMPS"; \
126	else  \
127		printf "${PWD}\nPossible problem with ex19 running with MUMPS, diffs above\n=========================================\n";\
128		touch ../../../check_error;\
129	fi; \
130	${RM} -f ex19.tmp ex19.dtmp;
131runex19_superlu_dist:
132	-${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;
133	-${QUIET}${DIFF} output/ex19_superlu.out ex19.tmp > ex19.dtmp;
134	-@if [ ! -s ex19.dtmp ];  then \
135		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuperLU_DIST"; \
136	else  \
137		printf "${PWD}\nPossible problem with ex19 running with SuperLU_DIST, diffs above\n=========================================\n"; \
138		touch ../../../check_error;\
139	fi; \
140	${RM} -f ex19.tmp ex19.dtmp;
141runex19_suitesparse:
142	-${QUIET}${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19.tmp;
143	-${QUIET}${DIFF} output/ex19_suitesparse.out ex19.tmp > ex19.dtmp;
144	-@if [ ! -s ex19.dtmp ];  then \
145		echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuiteSparse"; \
146	else \
147		printf "${PWD}\nPossible problem with ex19 running with SuiteSparse, diffs above\n=========================================\n"; \
148		touch ../../../check_error;\
149	fi; \
150	${RM} -f ex19.tmp ex19.dtmp;
151runex3k_kokkos: ex3k.PETSc
152	-${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;
153	-${QUIET}${DIFF} output/ex3k_1.out ex3k.tmp > ex3k.dtmp;
154	-@if [ ! -s ex3k.dtmp ];  then \
155    echo "C/C++ example src/snes/tutorials/ex3k run successfully with Kokkos Kernels"; \
156  else \
157    printf "${PWD}\nPossible problem with ex3k running with Kokkos Kernels, diffs above\n=========================================\n"; \
158    touch ../../../check_error;\
159  fi; \
160	${RM} -f ex3k.tmp ex3k.dtmp;
161