Actual source code: ex76.c
1: #include <petscksp.h>
2: #include "petsc/private/petscimpl.h"
4: static char help[] = "Solves a linear system using PCHPDDM.\n\n";
6: int main(int argc, char **args)
7: {
8: Vec b; /* computed solution and RHS */
9: Mat A, aux, X, B; /* linear system matrix */
10: KSP ksp; /* linear solver context */
11: PC pc;
12: IS is, sizes;
13: const PetscInt *idx;
14: PetscMPIInt rank, size;
15: PetscInt m, N = 1;
16: PetscViewer viewer;
17: char dir[PETSC_MAX_PATH_LEN], name[PETSC_MAX_PATH_LEN], type[256];
18: PetscBool3 share = PETSC_BOOL3_UNKNOWN;
19: PetscBool flg, set;
20: #if defined(PETSC_USE_LOG)
21: PetscLogEvent event;
22: #endif
23: PetscEventPerfInfo info1, info2;
25: PetscFunctionBeginUser;
26: PetscCall(PetscInitialize(&argc, &args, NULL, help));
27: PetscCall(PetscLogIsActive(&flg));
28: if (!flg) PetscCall(PetscLogDefaultBegin());
29: PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD, &size));
30: PetscCheck(size == 4, PETSC_COMM_WORLD, PETSC_ERR_USER, "This example requires 4 processes");
31: PetscCall(PetscOptionsGetInt(NULL, NULL, "-rhs", &N, NULL));
32: PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &rank));
33: PetscCall(MatCreate(PETSC_COMM_WORLD, &A));
34: PetscCall(MatCreate(PETSC_COMM_SELF, &aux));
35: PetscCall(ISCreate(PETSC_COMM_SELF, &is));
36: PetscCall(PetscStrncpy(dir, ".", sizeof(dir)));
37: PetscCall(PetscOptionsGetString(NULL, NULL, "-load_dir", dir, sizeof(dir), NULL));
38: /* loading matrices */
39: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/sizes_%d_%d.dat", dir, rank, size));
40: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
41: PetscCall(ISCreate(PETSC_COMM_SELF, &sizes));
42: PetscCall(ISLoad(sizes, viewer));
43: PetscCall(ISGetIndices(sizes, &idx));
44: PetscCall(MatSetSizes(A, idx[0], idx[1], idx[2], idx[3]));
45: PetscCall(MatSetUp(A));
46: PetscCall(ISRestoreIndices(sizes, &idx));
47: PetscCall(ISDestroy(&sizes));
48: PetscCall(PetscViewerDestroy(&viewer));
49: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/A.dat", dir));
50: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD, name, FILE_MODE_READ, &viewer));
51: PetscCall(MatLoad(A, viewer));
52: PetscCall(PetscViewerDestroy(&viewer));
53: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/is_%d_%d.dat", dir, rank, size));
54: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
55: PetscCall(ISLoad(is, viewer));
56: PetscCall(ISSetBlockSize(is, 2));
57: PetscCall(PetscViewerDestroy(&viewer));
58: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/Neumann_%d_%d.dat", dir, rank, size));
59: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
60: PetscCall(MatLoad(aux, viewer));
61: PetscCall(PetscViewerDestroy(&viewer));
62: flg = PETSC_FALSE;
63: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_levels_1_st_share_sub_ksp", &flg, &set));
64: if (flg) { /* PETSc LU/Cholesky is struggling numerically for bs > 1 */
65: /* only set the proper bs for the geneo_share_* tests, 1 otherwise */
66: PetscCall(MatSetBlockSizesFromMats(aux, A, A));
67: share = PETSC_BOOL3_TRUE;
68: } else if (set) share = PETSC_BOOL3_FALSE;
69: PetscCall(MatSetOption(A, MAT_SYMMETRIC, PETSC_TRUE));
70: PetscCall(MatSetOption(aux, MAT_SYMMETRIC, PETSC_TRUE));
71: /* ready for testing */
72: PetscOptionsBegin(PETSC_COMM_WORLD, "", "", "");
73: PetscCall(PetscStrncpy(type, MATAIJ, sizeof(type)));
74: PetscCall(PetscOptionsFList("-mat_type", "Matrix type", "MatSetType", MatList, type, type, 256, &flg));
75: PetscOptionsEnd();
76: PetscCall(MatConvert(A, type, MAT_INPLACE_MATRIX, &A));
77: PetscCall(MatConvert(aux, type, MAT_INPLACE_MATRIX, &aux));
78: PetscCall(KSPCreate(PETSC_COMM_WORLD, &ksp));
79: PetscCall(KSPSetOperators(ksp, A, A));
80: PetscCall(KSPGetPC(ksp, &pc));
81: PetscCall(PCSetType(pc, PCHPDDM));
82: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
83: flg = PETSC_FALSE;
84: PetscCall(PetscOptionsGetBool(NULL, NULL, "-reset", &flg, NULL));
85: if (flg) {
86: PetscCall(PetscOptionsSetValue(NULL, "-pc_hpddm_block_splitting", "true"));
87: PetscCall(PCSetFromOptions(pc));
88: PetscCall(PCSetUp(pc));
89: PetscCall(PetscOptionsClearValue(NULL, "-pc_hpddm_block_splitting"));
90: }
91: PetscCall(PCHPDDMSetAuxiliaryMat(pc, is, aux, NULL, NULL));
92: PetscCall(PCHPDDMHasNeumannMat(pc, PETSC_FALSE)); /* PETSC_TRUE is fine as well, just testing */
93: if (share == PETSC_BOOL3_UNKNOWN) PetscCall(PCHPDDMSetSTShareSubKSP(pc, PetscBool3ToBool(share)));
94: flg = PETSC_FALSE;
95: PetscCall(PetscOptionsGetBool(NULL, NULL, "-set_rhs", &flg, NULL));
96: if (flg) { /* user-provided RHS for concurrent generalized eigenvalue problems */
97: Mat a, c, P; /* usually assembled automatically in PCHPDDM, this is solely for testing PCHPDDMSetRHSMat() */
98: PetscInt rstart, rend, location;
99: PetscCall(MatDuplicate(aux, MAT_DO_NOT_COPY_VALUES, &B)); /* duplicate so that MatStructure is SAME_NONZERO_PATTERN */
100: PetscCall(MatGetDiagonalBlock(A, &a));
101: PetscCall(MatGetOwnershipRange(A, &rstart, &rend));
102: PetscCall(ISGetLocalSize(is, &m));
103: PetscCall(MatCreateSeqAIJ(PETSC_COMM_SELF, rend - rstart, m, 1, NULL, &P));
104: for (m = rstart; m < rend; ++m) {
105: PetscCall(ISLocate(is, m, &location));
106: PetscCheck(location >= 0, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "IS of the auxiliary Mat does not include all local rows of A");
107: PetscCall(MatSetValue(P, m - rstart, location, 1.0, INSERT_VALUES));
108: }
109: PetscCall(MatAssemblyBegin(P, MAT_FINAL_ASSEMBLY));
110: PetscCall(MatAssemblyEnd(P, MAT_FINAL_ASSEMBLY));
111: PetscCall(PetscObjectTypeCompare((PetscObject)a, MATSEQAIJ, &flg));
112: if (flg) PetscCall(MatPtAP(a, P, MAT_INITIAL_MATRIX, 1.0, &X)); /* MatPtAP() is used to extend diagonal blocks with zeros on the overlap */
113: else { /* workaround for MatPtAP() limitations with some types */ PetscCall(MatConvert(a, MATSEQAIJ, MAT_INITIAL_MATRIX, &c));
114: PetscCall(MatPtAP(c, P, MAT_INITIAL_MATRIX, 1.0, &X));
115: PetscCall(MatDestroy(&c));
116: }
117: PetscCall(MatDestroy(&P));
118: PetscCall(MatAXPY(B, 1.0, X, SUBSET_NONZERO_PATTERN));
119: PetscCall(MatDestroy(&X));
120: PetscCall(MatSetOption(B, MAT_SYMMETRIC, PETSC_TRUE));
121: PetscCall(PCHPDDMSetRHSMat(pc, B));
122: PetscCall(MatDestroy(&B));
123: }
124: #else
125: (void)share;
126: #endif
127: PetscCall(MatDestroy(&aux));
128: PetscCall(KSPSetFromOptions(ksp));
129: PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCASM, &flg));
130: if (flg) {
131: flg = PETSC_FALSE;
132: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_define_subdomains", &flg, NULL));
133: if (flg) {
134: IS rows;
135: PetscCall(MatGetOwnershipIS(A, &rows, NULL));
136: PetscCall(PCASMSetLocalSubdomains(pc, 1, &is, &rows));
137: PetscCall(ISDestroy(&rows));
138: }
139: }
140: PetscCall(ISDestroy(&is));
141: PetscCall(MatCreateVecs(A, NULL, &b));
142: PetscCall(VecSet(b, 1.0));
143: PetscCall(KSPSolve(ksp, b, b));
144: PetscCall(VecGetLocalSize(b, &m));
145: PetscCall(VecDestroy(&b));
146: if (N > 1) {
147: KSPType type;
148: PetscCall(PetscOptionsClearValue(NULL, "-ksp_converged_reason"));
149: PetscCall(KSPSetFromOptions(ksp));
150: PetscCall(MatCreateDense(PETSC_COMM_WORLD, m, PETSC_DECIDE, PETSC_DECIDE, N, NULL, &B));
151: PetscCall(MatCreateDense(PETSC_COMM_WORLD, m, PETSC_DECIDE, PETSC_DECIDE, N, NULL, &X));
152: PetscCall(MatSetRandom(B, NULL));
153: /* this is algorithmically optimal in the sense that blocks of vectors are coarsened or interpolated using matrix--matrix operations */
154: /* PCHPDDM however heavily relies on MPI[S]BAIJ format for which there is no efficient MatProduct implementation */
155: PetscCall(KSPMatSolve(ksp, B, X));
156: PetscCall(KSPGetType(ksp, &type));
157: PetscCall(PetscStrcmp(type, KSPHPDDM, &flg));
158: #if defined(PETSC_HAVE_HPDDM)
159: if (flg) {
160: PetscReal norm;
161: KSPHPDDMType type;
162: PetscCall(KSPHPDDMGetType(ksp, &type));
163: if (type == KSP_HPDDM_TYPE_PREONLY || type == KSP_HPDDM_TYPE_CG || type == KSP_HPDDM_TYPE_GMRES || type == KSP_HPDDM_TYPE_GCRODR) {
164: Mat C;
165: PetscCall(MatDuplicate(X, MAT_DO_NOT_COPY_VALUES, &C));
166: PetscCall(KSPSetMatSolveBatchSize(ksp, 1));
167: PetscCall(KSPMatSolve(ksp, B, C));
168: PetscCall(MatAYPX(C, -1.0, X, SAME_NONZERO_PATTERN));
169: PetscCall(MatNorm(C, NORM_INFINITY, &norm));
170: PetscCall(MatDestroy(&C));
171: PetscCheck(norm <= 100 * PETSC_MACHINE_EPSILON, PetscObjectComm((PetscObject)pc), PETSC_ERR_PLIB, "KSPMatSolve() and KSPSolve() difference has nonzero norm %g with pseudo-block KSPHPDDMType %s", (double)norm, KSPHPDDMTypes[type]);
172: }
173: }
174: #endif
175: PetscCall(MatDestroy(&X));
176: PetscCall(MatDestroy(&B));
177: }
178: PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCHPDDM, &flg));
179: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
180: if (flg) PetscCall(PCHPDDMGetSTShareSubKSP(pc, &flg));
181: #endif
182: if (flg && PetscDefined(USE_LOG)) {
183: PetscCall(PetscLogEventRegister("MatLUFactorSym", PC_CLASSID, &event));
184: PetscCall(PetscLogEventGetPerfInfo(PETSC_DETERMINE, event, &info1));
185: PetscCall(PetscLogEventRegister("MatLUFactorNum", PC_CLASSID, &event));
186: PetscCall(PetscLogEventGetPerfInfo(PETSC_DETERMINE, event, &info2));
187: if (!info1.count && !info2.count) {
188: PetscCall(PetscLogEventRegister("MatCholFctrSym", PC_CLASSID, &event));
189: PetscCall(PetscLogEventGetPerfInfo(PETSC_DETERMINE, event, &info1));
190: PetscCall(PetscLogEventRegister("MatCholFctrNum", PC_CLASSID, &event));
191: PetscCall(PetscLogEventGetPerfInfo(PETSC_DETERMINE, event, &info2));
192: PetscCheck(info2.count > info1.count, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Cholesky numerical factorization (%d) not called more times than Cholesky symbolic factorization (%d), broken -pc_hpddm_levels_1_st_share_sub_ksp", info2.count, info1.count);
193: } else PetscCheck(info2.count > info1.count, PETSC_COMM_SELF, PETSC_ERR_PLIB, "LU numerical factorization (%d) not called more times than LU symbolic factorization (%d), broken -pc_hpddm_levels_1_st_share_sub_ksp", info2.count, info1.count);
194: }
195: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
196: if (N == 1) {
197: flg = PETSC_FALSE;
198: PetscCall(PetscOptionsGetBool(NULL, NULL, "-successive_solves", &flg, NULL));
199: if (flg) {
200: KSPConvergedReason reason[2];
201: PetscInt iterations[3];
202: PetscCall(KSPGetConvergedReason(ksp, reason));
203: PetscCall(KSPGetTotalIterations(ksp, iterations));
204: PetscCall(PetscOptionsClearValue(NULL, "-ksp_converged_reason"));
205: flg = PETSC_FALSE;
206: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_block_splitting", &flg, NULL));
207: if (!flg) {
208: PetscCall(MatCreate(PETSC_COMM_SELF, &aux));
209: PetscCall(ISCreate(PETSC_COMM_SELF, &is));
210: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/is_%d_%d.dat", dir, rank, size));
211: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
212: PetscCall(ISLoad(is, viewer));
213: PetscCall(ISSetBlockSize(is, 2));
214: PetscCall(PetscViewerDestroy(&viewer));
215: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/Neumann_%d_%d.dat", dir, rank, size));
216: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
217: PetscCall(MatLoad(aux, viewer));
218: PetscCall(PetscViewerDestroy(&viewer));
219: PetscCall(MatSetBlockSizesFromMats(aux, A, A));
220: PetscCall(MatSetOption(aux, MAT_SYMMETRIC, PETSC_TRUE));
221: PetscCall(MatConvert(aux, type, MAT_INPLACE_MATRIX, &aux));
222: }
223: PetscCall(MatCreateVecs(A, NULL, &b));
224: PetscCall(PetscObjectStateIncrease((PetscObject)A));
225: if (!flg) PetscCall(PCHPDDMSetAuxiliaryMat(pc, NULL, aux, NULL, NULL));
226: PetscCall(VecSet(b, 1.0));
227: PetscCall(KSPSolve(ksp, b, b));
228: PetscCall(KSPGetConvergedReason(ksp, reason + 1));
229: PetscCall(KSPGetTotalIterations(ksp, iterations + 1));
230: iterations[1] -= iterations[0];
231: PetscCheck(reason[0] == reason[1] && PetscAbs(iterations[0] - iterations[1]) <= 3, PetscObjectComm((PetscObject)ksp), PETSC_ERR_PLIB, "Successive calls to KSPSolve() did not converge for the same reason (%s v. %s) or with the same number of iterations (+/- 3, %" PetscInt_FMT " v. %" PetscInt_FMT ")", KSPConvergedReasons[reason[0]], KSPConvergedReasons[reason[1]], iterations[0], iterations[1]);
232: PetscCall(PetscObjectStateIncrease((PetscObject)A));
233: if (!flg) PetscCall(PCHPDDMSetAuxiliaryMat(pc, is, aux, NULL, NULL));
234: PetscCall(PCSetFromOptions(pc));
235: PetscCall(VecSet(b, 1.0));
236: PetscCall(KSPSolve(ksp, b, b));
237: PetscCall(KSPGetConvergedReason(ksp, reason + 1));
238: PetscCall(KSPGetTotalIterations(ksp, iterations + 2));
239: iterations[2] -= iterations[0] + iterations[1];
240: PetscCheck(reason[0] == reason[1] && PetscAbs(iterations[0] - iterations[2]) <= 3, PetscObjectComm((PetscObject)ksp), PETSC_ERR_PLIB, "Successive calls to KSPSolve() did not converge for the same reason (%s v. %s) or with the same number of iterations (+/- 3, %" PetscInt_FMT " v. %" PetscInt_FMT ")", KSPConvergedReasons[reason[0]], KSPConvergedReasons[reason[1]], iterations[0], iterations[2]);
241: PetscCall(VecDestroy(&b));
242: PetscCall(ISDestroy(&is));
243: PetscCall(MatDestroy(&aux));
244: }
245: }
246: #endif
247: PetscCall(KSPDestroy(&ksp));
248: PetscCall(MatDestroy(&A));
249: PetscCall(PetscFinalize());
250: return 0;
251: }
253: /*TEST
255: test:
256: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
257: nsize: 4
258: args: -ksp_rtol 1e-3 -ksp_converged_reason -pc_type {{bjacobi hpddm}shared output} -pc_hpddm_coarse_sub_pc_type lu -sub_pc_type lu -options_left no -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
260: test:
261: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
262: suffix: define_subdomains
263: nsize: 4
264: args: -ksp_rtol 1e-3 -ksp_converged_reason -pc_type {{asm hpddm}shared output} -pc_hpddm_coarse_sub_pc_type lu -sub_pc_type lu -pc_hpddm_define_subdomains -options_left no -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
266: testset:
267: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
268: nsize: 4
269: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_coarse_pc_type redundant -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
270: test:
271: suffix: geneo
272: args: -pc_hpddm_coarse_p {{1 2}shared output} -pc_hpddm_levels_1_st_pc_type cholesky -pc_hpddm_levels_1_eps_nev {{5 15}separate output} -mat_type {{aij baij sbaij}shared output}
273: test:
274: suffix: geneo_block_splitting
275: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-15.out
276: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[6-9]/Linear solve converged due to CONVERGED_RTOL iterations 11/g"
277: args: -pc_hpddm_coarse_p 2 -pc_hpddm_levels_1_eps_nev 15 -pc_hpddm_block_splitting -pc_hpddm_levels_1_st_pc_type lu -pc_hpddm_levels_1_eps_gen_non_hermitian -mat_type {{aij baij}shared output} -successive_solves
278: test:
279: suffix: geneo_share
280: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-5.out
281: args: -pc_hpddm_levels_1_st_pc_type cholesky -pc_hpddm_levels_1_eps_nev 5 -pc_hpddm_levels_1_st_share_sub_ksp -reset {{false true}shared output}
283: testset:
284: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
285: nsize: 4
286: args: -ksp_converged_reason -ksp_max_it 150 -pc_type hpddm -pc_hpddm_levels_1_eps_nev 5 -pc_hpddm_coarse_p 1 -pc_hpddm_coarse_pc_type redundant -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO -pc_hpddm_define_subdomains
287: test:
288: suffix: geneo_share_cholesky
289: output_file: output/ex76_geneo_share.out
290: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
291: args: -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_st_pc_type cholesky -mat_type {{aij sbaij}shared output} -pc_hpddm_levels_1_eps_gen_non_hermitian -pc_hpddm_has_neumann -pc_hpddm_levels_1_st_share_sub_ksp {{false true}shared output} -successive_solves
292: test:
293: suffix: geneo_share_cholesky_matstructure
294: output_file: output/ex76_geneo_share.out
295: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
296: args: -pc_hpddm_levels_1_sub_pc_type cholesky -mat_type {{baij sbaij}shared output} -pc_hpddm_levels_1_eps_gen_non_hermitian -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_st_matstructure same -set_rhs {{false true} shared output}
297: test:
298: requires: mumps
299: suffix: geneo_share_lu
300: output_file: output/ex76_geneo_share.out
301: # extra -pc_factor_mat_solver_type mumps needed to avoid failures with PETSc LU
302: args: -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_st_pc_type lu -mat_type baij -pc_hpddm_levels_1_st_pc_factor_mat_solver_type mumps -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type mumps -pc_hpddm_has_neumann -pc_hpddm_levels_1_st_share_sub_ksp {{false true}shared output}
303: test:
304: requires: mumps
305: suffix: geneo_share_lu_matstructure
306: output_file: output/ex76_geneo_share.out
307: # extra -pc_factor_mat_solver_type mumps needed to avoid failures with PETSc LU
308: args: -pc_hpddm_levels_1_sub_pc_type lu -mat_type aij -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type mumps -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_st_matstructure {{same different}shared output} -pc_hpddm_levels_1_st_pc_type lu -pc_hpddm_levels_1_st_pc_factor_mat_solver_type mumps -successive_solves -pc_hpddm_levels_1_eps_target 1e-5
309: test:
310: suffix: geneo_share_not_asm
311: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-5.out
312: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
313: args: -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_st_pc_type cholesky -pc_hpddm_levels_1_eps_gen_non_hermitian -pc_hpddm_has_neumann -pc_hpddm_levels_1_st_share_sub_ksp true -pc_hpddm_levels_1_pc_type gasm -successive_solves
315: test:
316: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
317: suffix: fgmres_geneo_20_p_2
318: nsize: 4
319: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_eps_nev 20 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_type fgmres -pc_hpddm_coarse_mat_type {{baij sbaij}shared output} -pc_hpddm_log_separate {{false true}shared output} -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
321: testset:
322: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
323: output_file: output/ex76_fgmres_geneo_20_p_2.out
324: nsize: 4
325: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_eps_nev 20 -pc_hpddm_levels_2_p 2 -pc_hpddm_levels_2_mat_type {{baij sbaij}shared output} -pc_hpddm_levels_2_eps_nev {{5 20}shared output} -pc_hpddm_levels_2_sub_pc_type cholesky -pc_hpddm_levels_2_ksp_type gmres -ksp_type fgmres -pc_hpddm_coarse_mat_type {{baij sbaij}shared output} -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
326: test:
327: suffix: fgmres_geneo_20_p_2_geneo
328: args: -mat_type {{aij sbaij}shared output}
329: test:
330: suffix: fgmres_geneo_20_p_2_geneo_algebraic
331: args: -pc_hpddm_levels_2_st_pc_type mat
332: # PCHPDDM + KSPHPDDM test to exercise multilevel + multiple RHS in one go
333: test:
334: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
335: suffix: fgmres_geneo_20_p_2_geneo_rhs
336: output_file: output/ex76_fgmres_geneo_20_p_2.out
337: # for -pc_hpddm_coarse_correction additive
338: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 37/Linear solve converged due to CONVERGED_RTOL iterations 25/g"
339: nsize: 4
340: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_eps_nev 20 -pc_hpddm_levels_2_p 2 -pc_hpddm_levels_2_mat_type baij -pc_hpddm_levels_2_eps_nev 5 -pc_hpddm_levels_2_sub_pc_type cholesky -pc_hpddm_levels_2_ksp_max_it 10 -pc_hpddm_levels_2_ksp_type hpddm -pc_hpddm_levels_2_ksp_hpddm_type gmres -ksp_type hpddm -ksp_hpddm_variant flexible -pc_hpddm_coarse_mat_type baij -mat_type aij -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO -rhs 4 -pc_hpddm_coarse_correction {{additive deflated balanced}shared output}
342: testset:
343: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) mumps defined(PETSC_HAVE_OPENMP_SUPPORT)
344: filter: grep -E -e "Linear solve" -e " executing" | sed -e "s/MPI = 1/MPI = 2/g" -e "s/OMP = 1/OMP = 2/g"
345: nsize: 4
346: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_eps_nev 15 -pc_hpddm_levels_1_st_pc_type cholesky -pc_hpddm_coarse_p {{1 2}shared output} -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO -pc_hpddm_coarse_pc_factor_mat_solver_type mumps -pc_hpddm_coarse_mat_mumps_icntl_4 2 -pc_hpddm_coarse_mat_mumps_use_omp_threads {{1 2}shared output}
347: test:
348: suffix: geneo_mumps_use_omp_threads_1
349: output_file: output/ex76_geneo_mumps_use_omp_threads.out
350: args: -pc_hpddm_coarse_mat_type {{baij sbaij}shared output}
351: test:
352: suffix: geneo_mumps_use_omp_threads_2
353: output_file: output/ex76_geneo_mumps_use_omp_threads.out
354: args: -pc_hpddm_coarse_mat_type aij -pc_hpddm_levels_1_eps_threshold 0.3 -pc_hpddm_coarse_pc_type cholesky -pc_hpddm_coarse_mat_chop 1e-12
356: testset: # converge really poorly because of a tiny -pc_hpddm_levels_1_eps_threshold, but needed for proper code coverage where some subdomains don't call EPSSolve()
357: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
358: nsize: 4
359: args: -ksp_converged_reason -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_eps_threshold 0.005 -pc_hpddm_levels_1_eps_use_inertia -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO -pc_hpddm_coarse_pc_type cholesky -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_define_subdomains -pc_hpddm_has_neumann -ksp_rtol 0.9
360: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1/Linear solve converged due to CONVERGED_RTOL iterations 141/g"
361: test:
362: suffix: inertia_petsc
363: output_file: output/ex76_1.out
364: args: -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type petsc
365: test:
366: suffix: inertia_mumps
367: output_file: output/ex76_1.out
368: requires: mumps
370: test:
371: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
372: suffix: reuse_symbolic
373: output_file: output/ex77_preonly.out
374: nsize: 4
375: args: -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type cholesky -pc_hpddm_levels_1_eps_nev 20 -rhs 4 -pc_hpddm_coarse_correction {{additive deflated balanced}shared output} -ksp_pc_side {{left right}shared output} -ksp_max_it 20 -ksp_type hpddm -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO -pc_hpddm_define_subdomains -ksp_error_if_not_converged
377: TEST*/