xref: /petsc/src/snes/tutorials/makefile (revision 337d88fc23457d78161f856ffd7b1bfa81776487)
1cdb0f33dSPierre Jolivet-include ../../../petscdir.mk
2f97672e5SBarry Smith
3c4762a1bSJed BrownMANSEC           = SNES
449762cbcSSatish BalayEXAMPLESMATLAB   = ex5m.m ex29view.m
5c4762a1bSJed BrownDIRS		 = ex10d network
607c315cfSMartin DiehlCLEANFILES       = ex5f90t
7c4762a1bSJed Brown
8c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/variables
9c4762a1bSJed Browninclude ${PETSC_DIR}/lib/petsc/conf/rules
10c4762a1bSJed Brown
11*337d88fcSJunchao Zhangex55: ex55.o ex55k.o
12*337d88fcSJunchao Zhang
13c4762a1bSJed Brown#-------------------------------------------------------------------------
14c4762a1bSJed Brown
15c4762a1bSJed Brown#  these tests are used by the makefile in PETSC_DIR for basic tests of the install and should not be removed
16c4762a1bSJed Browntestex5f: ex5f.PETSc
1764f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex5f -snes_rtol 1e-4 > ex5f_1.tmp 2>&1; \
18c4762a1bSJed Brown        if (${DIFF} output/ex5f_1.testout ex5f_1.tmp > /dev/null 2>&1) then \
19c4762a1bSJed Brown          echo "Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process"; \
2027cb8d94SBarry Smith        else \
2127cb8d94SBarry Smith          echo "Possible error running Fortran example src/snes/tutorials/ex5f with 1 MPI process"; \
22d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
2327cb8d94SBarry Smith          cat ex5f_1.tmp; \
2481b9c2c9SBarry Smith          touch ../../../check_error;\
2527cb8d94SBarry Smith        fi;  \
26c4762a1bSJed Brown        ${RM} -f ex5f_1.tmp ;\
2727cb8d94SBarry Smith        ${MAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex5f.rm;
28c4762a1bSJed Browntestex19: ex19.PETSc
2964f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
30c4762a1bSJed Brown        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
31c4762a1bSJed Brown          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process"; \
3227cb8d94SBarry Smith        else \
3327cb8d94SBarry Smith          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 1 MPI process"; \
34d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
3527cb8d94SBarry Smith          cat ex19_1.tmp;\
3681b9c2c9SBarry Smith          touch ../../../check_error;\
3727cb8d94SBarry Smith        fi;\
3827cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
3927cb8d94SBarry Smithtestex19_mpi:
4064f7b273SJunchao Zhang	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -pc_type mg -ksp_type fgmres  > ex19_1.tmp 2>&1; \
41c4762a1bSJed Brown        if (${DIFF} output/ex19_1.testout ex19_1.tmp > /dev/null 2>&1) then \
42c4762a1bSJed Brown          echo "C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes"; \
4327cb8d94SBarry Smith        else \
4427cb8d94SBarry Smith          echo "Possible error running C/C++ src/snes/tutorials/ex19 with 2 MPI processes"; \
45d30b464cSBarry Smith          echo "See https://petsc.org/release/faq/";\
4627cb8d94SBarry Smith          cat ex19_1.tmp; \
4781b9c2c9SBarry Smith          touch ../../../check_error;\
4827cb8d94SBarry Smith        fi;\
4927cb8d94SBarry Smith        ${RM} -f ex19_1.tmp;
50263f2b91SStefano Zampini#use unpreconditioned norm because HYPRE device installations use different AMG parameters
51c4762a1bSJed Brownrunex19_hypre:
5264f7b273SJunchao 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; \
53c4762a1bSJed Brown          if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
54c4762a1bSJed Brown            echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre"; \
5527cb8d94SBarry Smith          else  \
5627cb8d94SBarry Smith            printf "${PWD}\nPossible problem with ex19 running with hypre, diffs above\n=========================================\n";\
5781b9c2c9SBarry Smith            touch ../../../check_error;\
5827cb8d94SBarry Smith          fi; \
59c4762a1bSJed Brown          ${RM} -f ex19_1.tmp
60263f2b91SStefano Zampinirunex19_hypre_cuda:
6164f7b273SJunchao 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; \
62263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
63263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/cuda"; \
6427cb8d94SBarry Smith           else  \
6547354645SJacob Faibussowitsch             printf "${PWD}\nPossible problem with ex19 running with hypre/cuda, diffs above\n=========================================\n"; \
6681b9c2c9SBarry Smith             touch ../../../check_error;\
6727cb8d94SBarry Smith             fi; \
68263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
69263f2b91SStefano Zampinirunex19_hypre_hip:
7064f7b273SJunchao Zhang	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -dm_vec_type hip -da_refine 3 -snes_monitor_short -ksp_norm_type unpreconditioned -pc_type hypre > ex19_1.tmp 2>&1; \
71263f2b91SStefano Zampini	   if (${DIFF} output/ex19_hypre.out ex19_1.tmp) then \
72263f2b91SStefano Zampini           echo "C/C++ example src/snes/tutorials/ex19 run successfully with hypre/hip"; \
7327cb8d94SBarry Smith           else \
7447354645SJacob Faibussowitsch             printf "${PWD}\nPossible problem with ex19 running with hypre/hip, diffs above\n=========================================\n";\
7581b9c2c9SBarry Smith             touch ../../../check_error;\
7627cb8d94SBarry Smith           fi; \
77263f2b91SStefano Zampini	   ${RM} -f ex19_1.tmp
78e57d7714SBarry Smithrunex19_cuda:
7964f7b273SJunchao Zhang	-@${MPIEXEC} -n 1 ${MPIEXEC_TAIL} ./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; \
80e57d7714SBarry Smith	   if (${DIFF} output/ex19_cuda_1.out ex19_1.tmp) then \
81e57d7714SBarry Smith           echo "C/C++ example src/snes/tutorials/ex19 run successfully with cuda"; \
8227cb8d94SBarry Smith           else  \
8327cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with cuda, diffs above\n=========================================\n"; \
8481b9c2c9SBarry Smith             touch ../../../check_error;\
8527cb8d94SBarry Smith           fi; \
86e57d7714SBarry Smith	   ${RM} -f ex19_1.tmp
87c4762a1bSJed Brownrunex19_ml:
8864f7b273SJunchao Zhang	-@${MPIEXEC} -n 2 ${MPIEXEC_TAIL} ./ex19 -da_refine 3 -snes_monitor_short -pc_type ml > ex19_1.tmp 2>&1; \
89c4762a1bSJed Brown	   if (${DIFF} output/ex19_ml.out ex19_1.tmp) then  \
90c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with ml"; \
9127cb8d94SBarry Smith           else \
9227cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with ml, diffs above\n=========================================\n"; \
9381b9c2c9SBarry Smith             touch ../../../check_error;\
9427cb8d94SBarry Smith           fi; \
95c4762a1bSJed Brown           ${RM} -f ex19_1.tmp
96c4762a1bSJed Brownrunex19_fieldsplit_mumps:
9764f7b273SJunchao 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; \
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"; \
10027cb8d94SBarry Smith           else  \
10127cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with mumps, diffs above\n=========================================\n";\
10281b9c2c9SBarry Smith             touch ../../../check_error;\
10327cb8d94SBarry Smith           fi; \
104c4762a1bSJed Brown           ${RM} -f ex19_6.tmp
105c4762a1bSJed Brownrunex19_superlu_dist:
10664f7b273SJunchao 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; \
107c4762a1bSJed Brown	   if (${DIFF} output/ex19_superlu.out ex19.tmp) then \
108c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with superlu_dist"; \
10927cb8d94SBarry Smith           else  \
11027cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with superlu_dist, diffs above\n=========================================\n"; \
11181b9c2c9SBarry Smith             touch ../../../check_error;\
11227cb8d94SBarry Smith           fi; \
113c4762a1bSJed Brown	   ${RM} -f ex19.tmp
114c4762a1bSJed Brownrunex19_suitesparse:
11564f7b273SJunchao 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; \
116c4762a1bSJed Brown	   if (${DIFF} output/ex19_suitesparse.out ex19_1.tmp) then \
117c4762a1bSJed Brown           echo "C/C++ example src/snes/tutorials/ex19 run successfully with suitesparse"; \
11827cb8d94SBarry Smith           else \
11927cb8d94SBarry Smith             printf "${PWD}\nPossible problem with ex19 running with suitesparse, diffs above\n=========================================\n"; \
12081b9c2c9SBarry Smith             touch ../../../check_error;\
12127cb8d94SBarry Smith           fi; \
122c4762a1bSJed Brown	   ${RM} -f ex19_1.tmp
123ef9bfa9fSSatish Balayrunex3k_kokkos: ex3k.PETSc
12464f7b273SJunchao Zhang	-@OMP_PROC_BIND=false ${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 ;\
125b37f3694SRichard Tran Mills	if (${DIFF} output/ex3k_1.out ex3k_1.tmp) then \
126ef9bfa9fSSatish Balay          echo "C/C++ example src/snes/tutorials/ex3k run successfully with kokkos-kernels"; \
12727cb8d94SBarry Smith        else \
12827cb8d94SBarry Smith          printf "${PWD}\nPossible problem with ex3k running with kokkos-kernels, diffs above\n=========================================\n"; \
12981b9c2c9SBarry Smith          touch ../../../check_error;\
13027cb8d94SBarry Smith        fi; \
131b37f3694SRichard Tran Mills	${RM} -f ex3k_1.tmp
132c4762a1bSJed Brown
133