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;
21: PetscFunctionBeginUser;
22: PetscCall(PetscInitialize(&argc, &args, NULL, help));
23: PetscCall(PetscLogDefaultBegin());
24: PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD, &size));
25: PetscCheck(size == 4, PETSC_COMM_WORLD, PETSC_ERR_USER, "This example requires 4 processes");
26: PetscCall(PetscOptionsGetInt(NULL, NULL, "-rhs", &N, NULL));
27: PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &rank));
28: PetscCall(MatCreate(PETSC_COMM_WORLD, &A));
29: PetscCall(MatCreate(PETSC_COMM_SELF, &aux));
30: PetscCall(ISCreate(PETSC_COMM_SELF, &is));
31: PetscCall(PetscStrncpy(dir, ".", sizeof(dir)));
32: PetscCall(PetscOptionsGetString(NULL, NULL, "-load_dir", dir, sizeof(dir), NULL));
33: /* loading matrices */
34: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/sizes_%d_%d.dat", dir, rank, size));
35: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
36: PetscCall(ISCreate(PETSC_COMM_SELF, &sizes));
37: PetscCall(ISLoad(sizes, viewer));
38: PetscCall(ISGetIndices(sizes, &idx));
39: PetscCall(MatSetSizes(A, idx[0], idx[1], idx[2], idx[3]));
40: PetscCall(MatSetUp(A));
41: PetscCall(ISRestoreIndices(sizes, &idx));
42: PetscCall(ISDestroy(&sizes));
43: PetscCall(PetscViewerDestroy(&viewer));
44: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/A.dat", dir));
45: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD, name, FILE_MODE_READ, &viewer));
46: PetscCall(MatLoad(A, viewer));
47: PetscCall(PetscViewerDestroy(&viewer));
48: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/is_%d_%d.dat", dir, rank, size));
49: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
50: PetscCall(ISLoad(is, viewer));
51: PetscCall(ISSetBlockSize(is, 2));
52: PetscCall(PetscViewerDestroy(&viewer));
53: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/Neumann_%d_%d.dat", dir, rank, size));
54: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
55: PetscCall(MatLoad(aux, viewer));
56: PetscCall(PetscViewerDestroy(&viewer));
57: flg = PETSC_FALSE;
58: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_levels_1_st_share_sub_ksp", &flg, &set));
59: if (flg) { /* PETSc LU/Cholesky is struggling numerically for bs > 1 */
60: /* only set the proper bs for the geneo_share_* tests, 1 otherwise */
61: PetscCall(MatSetBlockSizesFromMats(aux, A, A));
62: share = PETSC_BOOL3_TRUE;
63: } else if (set) share = PETSC_BOOL3_FALSE;
64: PetscCall(MatSetOption(A, MAT_SYMMETRIC, PETSC_TRUE));
65: PetscCall(MatSetOption(aux, MAT_SYMMETRIC, PETSC_TRUE));
66: /* ready for testing */
67: PetscOptionsBegin(PETSC_COMM_WORLD, "", "", "");
68: PetscCall(PetscStrncpy(type, MATAIJ, sizeof(type)));
69: PetscCall(PetscOptionsFList("-mat_type", "Matrix type", "MatSetType", MatList, type, type, 256, &flg));
70: PetscOptionsEnd();
71: PetscCall(MatConvert(A, type, MAT_INPLACE_MATRIX, &A));
72: PetscCall(MatConvert(aux, type, MAT_INPLACE_MATRIX, &aux));
73: PetscCall(KSPCreate(PETSC_COMM_WORLD, &ksp));
74: PetscCall(KSPSetOperators(ksp, A, A));
75: PetscCall(KSPGetPC(ksp, &pc));
76: PetscCall(PCSetType(pc, PCHPDDM));
77: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
78: flg = PETSC_FALSE;
79: PetscCall(PetscOptionsGetBool(NULL, NULL, "-reset", &flg, NULL));
80: if (flg) {
81: PetscCall(PetscOptionsSetValue(NULL, "-pc_hpddm_block_splitting", "true"));
82: PetscCall(PCSetFromOptions(pc));
83: PetscCall(PCSetUp(pc));
84: PetscCall(PetscOptionsClearValue(NULL, "-pc_hpddm_block_splitting"));
85: }
86: PetscCall(PCHPDDMSetAuxiliaryMat(pc, is, aux, NULL, NULL));
87: PetscCall(PCHPDDMHasNeumannMat(pc, PETSC_FALSE)); /* PETSC_TRUE is fine as well, just testing */
88: if (share == PETSC_BOOL3_UNKNOWN) PetscCall(PCHPDDMSetSTShareSubKSP(pc, PetscBool3ToBool(share)));
89: flg = PETSC_FALSE;
90: PetscCall(PetscOptionsGetBool(NULL, NULL, "-set_rhs", &flg, NULL));
91: if (flg) { /* user-provided RHS for concurrent generalized eigenvalue problems */
92: Mat a, c, P; /* usually assembled automatically in PCHPDDM, this is solely for testing PCHPDDMSetRHSMat() */
93: PetscInt rstart, rend, location;
94: PetscCall(MatDuplicate(aux, MAT_DO_NOT_COPY_VALUES, &B)); /* duplicate so that MatStructure is SAME_NONZERO_PATTERN */
95: PetscCall(MatGetDiagonalBlock(A, &a));
96: PetscCall(MatGetOwnershipRange(A, &rstart, &rend));
97: PetscCall(ISGetLocalSize(is, &m));
98: PetscCall(MatCreateSeqAIJ(PETSC_COMM_SELF, rend - rstart, m, 1, NULL, &P));
99: for (m = rstart; m < rend; ++m) {
100: PetscCall(ISLocate(is, m, &location));
101: PetscCheck(location >= 0, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "IS of the auxiliary Mat does not include all local rows of A");
102: PetscCall(MatSetValue(P, m - rstart, location, 1.0, INSERT_VALUES));
103: }
104: PetscCall(MatAssemblyBegin(P, MAT_FINAL_ASSEMBLY));
105: PetscCall(MatAssemblyEnd(P, MAT_FINAL_ASSEMBLY));
106: PetscCall(PetscObjectTypeCompare((PetscObject)a, MATSEQAIJ, &flg));
107: if (flg) PetscCall(MatPtAP(a, P, MAT_INITIAL_MATRIX, 1.0, &X)); /* MatPtAP() is used to extend diagonal blocks with zeros on the overlap */
108: else { /* workaround for MatPtAP() limitations with some types */ PetscCall(MatConvert(a, MATSEQAIJ, MAT_INITIAL_MATRIX, &c));
109: PetscCall(MatPtAP(c, P, MAT_INITIAL_MATRIX, 1.0, &X));
110: PetscCall(MatDestroy(&c));
111: }
112: PetscCall(MatDestroy(&P));
113: PetscCall(MatAXPY(B, 1.0, X, SUBSET_NONZERO_PATTERN));
114: PetscCall(MatDestroy(&X));
115: PetscCall(MatSetOption(B, MAT_SYMMETRIC, PETSC_TRUE));
116: PetscCall(PCHPDDMSetRHSMat(pc, B));
117: PetscCall(MatDestroy(&B));
118: }
119: #else
120: (void)share;
121: #endif
122: PetscCall(MatDestroy(&aux));
123: PetscCall(KSPSetFromOptions(ksp));
124: PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCASM, &flg));
125: if (flg) {
126: flg = PETSC_FALSE;
127: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_define_subdomains", &flg, NULL));
128: if (flg) {
129: IS rows;
130: PetscCall(MatGetOwnershipIS(A, &rows, NULL));
131: PetscCall(PCASMSetLocalSubdomains(pc, 1, &is, &rows));
132: PetscCall(ISDestroy(&rows));
133: }
134: }
135: PetscCall(ISDestroy(&is));
136: PetscCall(MatCreateVecs(A, NULL, &b));
137: PetscCall(VecSet(b, 1.0));
138: PetscCall(KSPSolve(ksp, b, b));
139: PetscCall(VecGetLocalSize(b, &m));
140: PetscCall(VecDestroy(&b));
141: if (N > 1) {
142: KSPType type;
143: PetscCall(PetscOptionsClearValue(NULL, "-ksp_converged_reason"));
144: PetscCall(KSPSetFromOptions(ksp));
145: PetscCall(MatCreateDense(PETSC_COMM_WORLD, m, PETSC_DECIDE, PETSC_DECIDE, N, NULL, &B));
146: PetscCall(MatCreateDense(PETSC_COMM_WORLD, m, PETSC_DECIDE, PETSC_DECIDE, N, NULL, &X));
147: PetscCall(MatSetRandom(B, NULL));
148: /* this is algorithmically optimal in the sense that blocks of vectors are coarsened or interpolated using matrix--matrix operations */
149: /* PCHPDDM however heavily relies on MPI[S]BAIJ format for which there is no efficient MatProduct implementation */
150: PetscCall(KSPMatSolve(ksp, B, X));
151: PetscCall(KSPGetType(ksp, &type));
152: PetscCall(PetscStrcmp(type, KSPHPDDM, &flg));
153: #if defined(PETSC_HAVE_HPDDM)
154: if (flg) {
155: PetscReal norm;
156: KSPHPDDMType type;
157: PetscCall(KSPHPDDMGetType(ksp, &type));
158: if (type == KSP_HPDDM_TYPE_PREONLY || type == KSP_HPDDM_TYPE_CG || type == KSP_HPDDM_TYPE_GMRES || type == KSP_HPDDM_TYPE_GCRODR) {
159: Mat C;
160: PetscCall(MatDuplicate(X, MAT_DO_NOT_COPY_VALUES, &C));
161: PetscCall(KSPSetMatSolveBatchSize(ksp, 1));
162: PetscCall(KSPMatSolve(ksp, B, C));
163: PetscCall(MatAYPX(C, -1.0, X, SAME_NONZERO_PATTERN));
164: PetscCall(MatNorm(C, NORM_INFINITY, &norm));
165: PetscCall(MatDestroy(&C));
166: 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]);
167: }
168: }
169: #endif
170: PetscCall(MatDestroy(&X));
171: PetscCall(MatDestroy(&B));
172: }
173: PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCHPDDM, &flg));
174: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
175: if (flg) PetscCall(PCHPDDMGetSTShareSubKSP(pc, &flg));
176: #endif
177: if (flg && PetscDefined(USE_LOG)) {
178: PetscCall(PetscOptionsHasName(NULL, NULL, "-pc_hpddm_harmonic_overlap", &flg));
179: if (!flg) {
180: PetscLogEvent event;
181: PetscEventPerfInfo info1, info2;
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: }
196: #if defined(PETSC_HAVE_HPDDM) && defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)
197: if (N == 1) {
198: flg = PETSC_FALSE;
199: PetscCall(PetscOptionsGetBool(NULL, NULL, "-successive_solves", &flg, NULL));
200: if (flg) {
201: KSPConvergedReason reason[2];
202: PetscInt iterations[3];
203: PetscCall(KSPGetConvergedReason(ksp, reason));
204: PetscCall(KSPGetTotalIterations(ksp, iterations));
205: PetscCall(PetscOptionsClearValue(NULL, "-ksp_converged_reason"));
206: flg = PETSC_FALSE;
207: PetscCall(PetscOptionsGetBool(NULL, NULL, "-pc_hpddm_block_splitting", &flg, NULL));
208: if (!flg) {
209: PetscCall(MatCreate(PETSC_COMM_SELF, &aux));
210: PetscCall(ISCreate(PETSC_COMM_SELF, &is));
211: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/is_%d_%d.dat", dir, rank, size));
212: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
213: PetscCall(ISLoad(is, viewer));
214: PetscCall(ISSetBlockSize(is, 2));
215: PetscCall(PetscViewerDestroy(&viewer));
216: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/Neumann_%d_%d.dat", dir, rank, size));
217: PetscCall(PetscViewerBinaryOpen(PETSC_COMM_SELF, name, FILE_MODE_READ, &viewer));
218: PetscCall(MatLoad(aux, viewer));
219: PetscCall(PetscViewerDestroy(&viewer));
220: PetscCall(MatSetBlockSizesFromMats(aux, A, A));
221: PetscCall(MatSetOption(aux, MAT_SYMMETRIC, PETSC_TRUE));
222: PetscCall(MatConvert(aux, type, MAT_INPLACE_MATRIX, &aux));
223: }
224: PetscCall(MatCreateVecs(A, NULL, &b));
225: PetscCall(PetscObjectStateIncrease((PetscObject)A));
226: if (!flg) PetscCall(PCHPDDMSetAuxiliaryMat(pc, NULL, aux, NULL, NULL));
227: PetscCall(VecSet(b, 1.0));
228: PetscCall(KSPSolve(ksp, b, b));
229: PetscCall(KSPGetConvergedReason(ksp, reason + 1));
230: PetscCall(KSPGetTotalIterations(ksp, iterations + 1));
231: iterations[1] -= iterations[0];
232: 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]);
233: PetscCall(PetscObjectStateIncrease((PetscObject)A));
234: if (!flg) PetscCall(PCHPDDMSetAuxiliaryMat(pc, is, aux, NULL, NULL));
235: PetscCall(PCSetFromOptions(pc));
236: PetscCall(VecSet(b, 1.0));
237: PetscCall(KSPSolve(ksp, b, b));
238: PetscCall(KSPGetConvergedReason(ksp, reason + 1));
239: PetscCall(KSPGetTotalIterations(ksp, iterations + 2));
240: iterations[2] -= iterations[0] + iterations[1];
241: 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]);
242: PetscCall(VecDestroy(&b));
243: PetscCall(ISDestroy(&is));
244: PetscCall(MatDestroy(&aux));
245: }
246: }
247: PetscCall(PetscOptionsGetBool(NULL, NULL, "-viewer", &flg, NULL));
248: if (flg) {
249: PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCHPDDM, &flg));
250: if (flg) {
251: PetscCall(PetscStrncpy(dir, "XXXXXX", sizeof(dir)));
252: if (rank == 0) PetscCall(PetscMkdtemp(dir));
253: PetscCallMPI(MPI_Bcast(dir, 6, MPI_CHAR, 0, PETSC_COMM_WORLD));
254: for (PetscInt i = 0; i < 2; ++i) {
255: PetscCall(PetscSNPrintf(name, sizeof(name), "%s/%s", dir, (i == 0 ? "A" : "A.dat")));
256: PetscCall(PetscViewerASCIIOpen(PETSC_COMM_WORLD, name, &viewer));
257: PetscCall(PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_INFO_DETAIL));
258: PetscCall(PCView(pc, viewer));
259: PetscCall(PetscViewerPopFormat(viewer));
260: PetscCall(PetscViewerDestroy(&viewer));
261: }
262: PetscCallMPI(MPI_Barrier(PETSC_COMM_WORLD));
263: if (rank == 0) PetscCall(PetscRMTree(dir));
264: }
265: }
266: #endif
267: PetscCall(KSPDestroy(&ksp));
268: PetscCall(MatDestroy(&A));
269: PetscCall(PetscFinalize());
270: return 0;
271: }
273: /*TEST
275: test:
276: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
277: nsize: 4
278: 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
280: testset:
281: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
282: suffix: define_subdomains
283: nsize: 4
284: args: -ksp_rtol 1e-3 -ksp_converged_reason -pc_hpddm_define_subdomains -options_left no -load_dir ${DATAFILESPATH}/matrices/hpddm/GENEO
285: test:
286: args: -pc_type {{asm hpddm}shared output} -pc_hpddm_coarse_sub_pc_type lu -sub_pc_type lu -viewer
287: test:
288: args: -pc_type hpddm -pc_hpddm_levels_1_st_pc_type cholesky -pc_hpddm_levels_1_eps_nev 5 -pc_hpddm_coarse_sub_pc_type lu -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_coarse_correction none
290: testset:
291: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
292: nsize: 4
293: 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
294: test:
295: suffix: geneo
296: 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}
297: test:
298: suffix: geneo_block_splitting
299: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-15.out
300: 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"
301: 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
302: test:
303: suffix: geneo_share
304: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-5.out
305: 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}
306: test:
307: suffix: harmonic_overlap_1_define_false
308: output_file: output/ex76_geneo_share.out
309: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
310: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_pc_type lu -pc_hpddm_levels_1_eps_pc_type lu -pc_hpddm_define_subdomains false -pc_hpddm_levels_1_pc_type asm -pc_hpddm_levels_1_pc_asm_overlap 2 -mat_type baij
311: test:
312: suffix: harmonic_overlap_1
313: output_file: output/ex76_geneo_share.out
314: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
315: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_pc_type lu -pc_hpddm_levels_1_eps_pc_type lu -mat_type baij
316: test:
317: suffix: harmonic_overlap_1_share_petsc
318: output_file: output/ex76_geneo_share.out
319: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
320: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_pc_type lu -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type petsc -pc_hpddm_levels_1_eps_pc_type lu -mat_type baij
321: test:
322: requires: mumps
323: suffix: harmonic_overlap_1_share_mumps
324: output_file: output/ex76_geneo_share.out
325: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
326: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type mumps
327: test:
328: requires: mumps
329: suffix: harmonic_overlap_1_share_mumps_not_set_explicitly
330: output_file: output/ex76_geneo_share.out
331: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1[0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
332: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_eps_mat_type baij
333: test:
334: requires: mkl_pardiso
335: suffix: harmonic_overlap_1_share_mkl_pardiso
336: output_file: output/ex76_geneo_share.out
337: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations [12][0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
338: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_eps_mat_type shell -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type mkl_pardiso
339: test:
340: requires: mkl_pardiso !mumps
341: suffix: harmonic_overlap_1_share_mkl_pardiso_no_set_explicitly
342: output_file: output/ex76_geneo_share.out
343: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations [12][0-3]/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
344: args: -pc_hpddm_harmonic_overlap 1 -pc_hpddm_levels_1_eps_nev 30 -pc_hpddm_levels_1_eps_relative_threshold 1e+1 -pc_hpddm_levels_1_st_share_sub_ksp -pc_hpddm_levels_1_eps_mat_type shell
345: test:
346: suffix: harmonic_overlap_2_relative_threshold
347: output_file: output/ex76_geneo_share.out
348: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 9/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
349: args: -pc_hpddm_harmonic_overlap 2 -pc_hpddm_levels_1_svd_nsv 15 -pc_hpddm_levels_1_svd_relative_threshold 1e-1 -pc_hpddm_levels_1_st_share_sub_ksp -mat_type sbaij
350: test:
351: suffix: harmonic_overlap_2
352: output_file: output/ex76_geneo_share.out
353: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 9/Linear solve converged due to CONVERGED_RTOL iterations 15/g"
354: args: -pc_hpddm_harmonic_overlap 2 -pc_hpddm_levels_1_svd_nsv 12 -pc_hpddm_levels_1_st_share_sub_ksp -mat_type sbaij
356: testset:
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 -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
360: test:
361: suffix: geneo_share_cholesky
362: output_file: output/ex76_geneo_share.out
363: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
364: 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
365: test:
366: suffix: geneo_share_cholesky_matstructure
367: output_file: output/ex76_geneo_share.out
368: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
369: 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}
370: test:
371: requires: mumps
372: suffix: geneo_share_lu
373: output_file: output/ex76_geneo_share.out
374: # extra -pc_factor_mat_solver_type mumps needed to avoid failures with PETSc LU
375: 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}
376: test:
377: requires: mumps
378: suffix: geneo_share_lu_matstructure
379: output_file: output/ex76_geneo_share.out
380: # extra -pc_factor_mat_solver_type mumps needed to avoid failures with PETSc LU
381: 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
382: test:
383: suffix: geneo_share_not_asm
384: output_file: output/ex76_geneo_pc_hpddm_levels_1_eps_nev-5.out
385: # extra -pc_hpddm_levels_1_eps_gen_non_hermitian needed to avoid failures with PETSc Cholesky
386: 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
388: test:
389: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
390: suffix: fgmres_geneo_20_p_2
391: nsize: 4
392: 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
394: testset:
395: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
396: output_file: output/ex76_fgmres_geneo_20_p_2.out
397: nsize: 4
398: 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
399: test:
400: suffix: fgmres_geneo_20_p_2_geneo
401: args: -mat_type {{aij sbaij}shared output}
402: test:
403: suffix: fgmres_geneo_20_p_2_geneo_algebraic
404: args: -pc_hpddm_levels_2_st_pc_type mat
405: # PCHPDDM + KSPHPDDM test to exercise multilevel + multiple RHS in one go
406: test:
407: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
408: suffix: fgmres_geneo_20_p_2_geneo_rhs
409: output_file: output/ex76_fgmres_geneo_20_p_2.out
410: # for -pc_hpddm_coarse_correction additive
411: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 37/Linear solve converged due to CONVERGED_RTOL iterations 25/g"
412: nsize: 4
413: 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}
415: testset:
416: 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)
417: filter: grep -E -e "Linear solve" -e " executing" | sed -e "s/MPI = 1/MPI = 2/g" -e "s/OMP = 1/OMP = 2/g"
418: nsize: 4
419: 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}
420: test:
421: suffix: geneo_mumps_use_omp_threads_1
422: output_file: output/ex76_geneo_mumps_use_omp_threads.out
423: args: -pc_hpddm_coarse_mat_type {{baij sbaij}shared output}
424: test:
425: suffix: geneo_mumps_use_omp_threads_2
426: output_file: output/ex76_geneo_mumps_use_omp_threads.out
427: args: -pc_hpddm_coarse_mat_type aij -pc_hpddm_levels_1_eps_threshold 0.4 -pc_hpddm_coarse_pc_type cholesky -pc_hpddm_coarse_mat_filter 1e-12
429: 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()
430: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
431: nsize: 4
432: 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_levels_1_st_share_sub_ksp -pc_hpddm_define_subdomains -pc_hpddm_has_neumann -ksp_rtol 0.9
433: filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 1/Linear solve converged due to CONVERGED_RTOL iterations 141/g"
434: test:
435: suffix: inertia_petsc
436: output_file: output/ex76_1.out
437: args: -pc_hpddm_levels_1_sub_pc_factor_mat_solver_type petsc
438: test:
439: suffix: inertia_mumps
440: output_file: output/ex76_1.out
441: requires: mumps
443: test:
444: requires: hpddm slepc datafilespath double !complex !defined(PETSC_USE_64BIT_INDICES) defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
445: suffix: reuse_symbolic
446: output_file: output/ex77_preonly.out
447: nsize: 4
448: 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
450: TEST*/