xref: /petsc/src/snes/tutorials/makefile (revision a3626c831c8ad33dac310f161c37f0478206e703)
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
9da4996e5SSatish Balayex55: ex55k.o
10337d88fcSJunchao Zhang
11c4762a1bSJed Brown#-------------------------------------------------------------------------
12*a3626c83SSatish Balayifeq ($(PETSC_PRECISION),__fp16)
13*a3626c83SSatish Balay  TESTEX19OUT = output/ex19_fp16.testout
14*a3626c83SSatish Balayelse
15*a3626c83SSatish Balay  TESTEX19OUT = output/ex19_1.testout
16*a3626c83SSatish Balayendif
17c4762a1bSJed Brown
18c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
19c4762a1bSJed Browntestex5f: ex5f.PETSc
2064f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \
21c4762a1bSJed Brown        if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
22c4762a1bSJed Brown          echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
2327cb8d94SBarry Smith        else \
2427cb8d94SBarry Smith          echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
25d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
2627cb8d94SBarry Smith          cat ex5f_1.tmp; \
2781b9c2c9SBarry Smith          touch ../../../check_error;\
2827cb8d94SBarry Smith        fi;  \
29c4762a1bSJed Brown        ${RM} -f ex5f_1.tmp ;\
3027cb8d94SBarry Smith        ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm;
31c4762a1bSJed Browntestex19: ex19.PETSc
3264f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
33*a3626c83SSatish Balay        if (${DIFF} ${TESTEX19OUT} ex19_1.tmp > /dev/null 2>&1) then \
34c4762a1bSJed Brown          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
3527cb8d94SBarry Smith        else \
3627cb8d94SBarry Smith          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
37d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
3827cb8d94SBarry Smith          cat ex19_1.tmp;\
3981b9c2c9SBarry Smith          touch ../../../check_error;\
4027cb8d94SBarry Smith        fi;\
4127cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
4227cb8d94SBarry Smithtestex19_mpi:
43*a3626c83SSatish Balay	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres -snes_type newtontrdc  > ex19_1.tmp 2>&1; \
44*a3626c83SSatish Balay        if (${DIFF} ${TESTEX19OUT} ex19_1.tmp > /dev/null 2>&1) 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/";\
4927cb8d94SBarry Smith          cat ex19_1.tmp; \
5081b9c2c9SBarry Smith          touch ../../../check_error;\
5127cb8d94SBarry Smith        fi;\
5227cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
53263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
54c4762a1bSJed Brownrunex19_hypre:
5564f7b273SJunchao Zhang	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
56c4762a1bSJed Brown          if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
57b3b5ef4dSPierre Jolivet            echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE"; \
5827cb8d94SBarry Smith          else  \
59b3b5ef4dSPierre Jolivet            printf "${PWD}\nPossible problem with ex19 running with HYPRE, diffs above\n=========================================\n";\
6081b9c2c9SBarry Smith            touch ../../../check_error;\
6127cb8d94SBarry Smith          fi; \
62c4762a1bSJed Brown          ${RM} -f ex19_1.tmp
63263f2b91SStefano Zampinirunex19_hypre_cuda:
6464f7b273SJunchao Zhang	-@${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_1.tmp 2>&1; \
65263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
66b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/CUDA"; \
6727cb8d94SBarry Smith           else  \
68b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with HYPRE/CUDA, diffs above\n=========================================\n"; \
6981b9c2c9SBarry Smith             touch ../../../check_error;\
7027cb8d94SBarry Smith             fi; \
71263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
72263f2b91SStefano Zampinirunex19_hypre_hip:
735beb4b7aSJunchao Zhang	-@${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_1.tmp 2>&1; \
74263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
75b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with HYPRE/HIP"; \
7627cb8d94SBarry Smith           else \
77b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with HYPRE/HIP, diffs above\n=========================================\n";\
7881b9c2c9SBarry Smith             touch ../../../check_error;\
7927cb8d94SBarry Smith           fi; \
80263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
81e57d7714SBarry Smithrunex19_cuda:
82d4adc10fSMark Adams	-@${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_1.tmp 2>&1; \
83e57d7714SBarry Smith	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
84b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with CUDA"; \
8527cb8d94SBarry Smith           else  \
86b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with CUDA, diffs above\n=========================================\n"; \
8781b9c2c9SBarry Smith             touch ../../../check_error;\
8827cb8d94SBarry Smith           fi; \
89e57d7714SBarry Smith	   ${RM} -f ex19_1.tmp
903e0e9f3fSSatish Balayrunex19_hip:
913e0e9f3fSSatish Balay	-@${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_1.tmp 2>&1; \
923e0e9f3fSSatish Balay	   if (${DIFF} output/ex19_hip_1.out ex19_1.tmp) then \
933e0e9f3fSSatish Balay           echo "C/C++ example src/snes/tutorials/ex19 run successfully with HIP"; \
943e0e9f3fSSatish Balay           else  \
953e0e9f3fSSatish Balay             printf "${PWD}\nPossible problem with ex19 running with HIP, diffs above\n=========================================\n"; \
963e0e9f3fSSatish Balay             touch ../../../check_error;\
973e0e9f3fSSatish Balay           fi; \
983e0e9f3fSSatish Balay	   ${RM} -f ex19_1.tmp
99c4762a1bSJed Brownrunex19_ml:
10064f7b273SJunchao Zhang	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
101c4762a1bSJed Brown	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
102b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ML"; \
10327cb8d94SBarry Smith           else \
104b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with ML, diffs above\n=========================================\n"; \
10581b9c2c9SBarry Smith             touch ../../../check_error;\
10627cb8d94SBarry Smith           fi; \
107c4762a1bSJed Brown           ${RM} -f ex19_1.tmp
108c4762a1bSJed Brownrunex19_fieldsplit_mumps:
10964f7b273SJunchao Zhang	-@${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_6.tmp 2>&1; \
110c4762a1bSJed Brown	   if (${DIFF} output/ex19_fieldsplit_5.out ex19_6.tmp) then  \
111b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with MUMPS"; \
11227cb8d94SBarry Smith           else  \
113b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with MUMPS, diffs above\n=========================================\n";\
11481b9c2c9SBarry Smith             touch ../../../check_error;\
11527cb8d94SBarry Smith           fi; \
116c4762a1bSJed Brown           ${RM} -f ex19_6.tmp
117c4762a1bSJed Brownrunex19_superlu_dist:
11864f7b273SJunchao Zhang	-@${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 2>&1; \
119c4762a1bSJed Brown	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
120b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuperLU_DIST"; \
12127cb8d94SBarry Smith           else  \
122b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with SuperLU_DIST, diffs above\n=========================================\n"; \
12381b9c2c9SBarry Smith             touch ../../../check_error;\
12427cb8d94SBarry Smith           fi; \
125c4762a1bSJed Brown	   ${RM} -f ex19.tmp
126c4762a1bSJed Brownrunex19_suitesparse:
12764f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type lu -pc_factor_mat_solver_type umfpack > ex19_1.tmp 2>&1; \
128c4762a1bSJed Brown	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
129b3b5ef4dSPierre Jolivet           echo "C/C++ example src/snes/tutorials/ex19 run successfully with SuiteSparse"; \
13027cb8d94SBarry Smith           else \
131b3b5ef4dSPierre Jolivet             printf "${PWD}\nPossible problem with ex19 running with SuiteSparse, diffs above\n=========================================\n"; \
13281b9c2c9SBarry Smith             touch ../../../check_error;\
13327cb8d94SBarry Smith           fi; \
134c4762a1bSJed Brown	   ${RM} -f ex19_1.tmp
135ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
13617c5bdc1SStefano Zampini	-@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_1.tmp 2>&1 ;\
137b37f3694SRichard Tran Mills	if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
138b3b5ef4dSPierre Jolivet          echo "C/C++ example src/snes/tutorials/ex3k run successfully with Kokkos Kernels"; \
13927cb8d94SBarry Smith        else \
140b3b5ef4dSPierre Jolivet          printf "${PWD}\nPossible problem with ex3k running with Kokkos Kernels, diffs above\n=========================================\n"; \
14181b9c2c9SBarry Smith          touch ../../../check_error;\
14227cb8d94SBarry Smith        fi; \
143b37f3694SRichard Tran Mills	${RM} -f ex3k_1.tmp
144c4762a1bSJed Brown
145