xref: /petsc/src/mat/tests/ex62.c (revision 8fb5bd83c3955fefcf33a54e3bb66920a9fa884b)
1 
2 static char help[] = "Test Matrix products for AIJ matrices\n\
3 Input arguments are:\n\
4   -fA <input_file> -fB <input_file> -fC <input_file>: file to load\n\n";
5 /* Example of usage:
6    ./ex62 -fA <A_binary> -fB <B_binary>
7    mpiexec -n 3 ./ex62 -fA medium -fB medium
8 */
9 
10 #include <petscmat.h>
11 
12 /*
13      B = A - B
14      norm = norm(B)
15 */
16 PetscErrorCode MatNormDifference(Mat A,Mat B,PetscReal *norm)
17 {
18   PetscFunctionBegin;
19   PetscCall(MatAXPY(B,-1.0,A,DIFFERENT_NONZERO_PATTERN));
20   PetscCall(MatNorm(B,NORM_FROBENIUS,norm));
21   PetscFunctionReturn(0);
22 }
23 
24 int main(int argc,char **args)
25 {
26   Mat            A,A_save,B,C,P,C1,R;
27   PetscViewer    viewer;
28   PetscMPIInt    size,rank;
29   PetscInt       i,j,*idxn,PM,PN = PETSC_DECIDE,rstart,rend;
30   PetscReal      norm;
31   PetscRandom    rdm;
32   char           file[2][PETSC_MAX_PATH_LEN] = { "", ""};
33   PetscScalar    *a,rval,alpha;
34   PetscBool      Test_MatMatMult=PETSC_TRUE,Test_MatTrMat=PETSC_TRUE,Test_MatMatTr=PETSC_TRUE;
35   PetscBool      Test_MatPtAP=PETSC_TRUE,Test_MatRARt=PETSC_TRUE,flg,seqaij,flgA,flgB;
36   MatInfo        info;
37   PetscInt       nzp  = 5; /* num of nonzeros in each row of P */
38   MatType        mattype;
39   const char     *deft = MATAIJ;
40   char           A_mattype[256], B_mattype[256];
41   PetscInt       mcheck = 10;
42 
43   PetscCall(PetscInitialize(&argc,&args,(char*)0,help));
44   PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD,&size));
45   PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD,&rank));
46 
47   /*  Load the matrices A_save and B */
48   PetscOptionsBegin(PETSC_COMM_WORLD,"","","");
49   PetscCall(PetscOptionsBool("-test_rart","Test MatRARt","",Test_MatRARt,&Test_MatRARt,NULL));
50   PetscCall(PetscOptionsInt("-PN","Number of columns of P","",PN,&PN,NULL));
51   PetscCall(PetscOptionsInt("-mcheck","Number of matmult checks","",mcheck,&mcheck,NULL));
52   PetscCall(PetscOptionsString("-fA","Path for matrix A","",file[0],file[0],sizeof(file[0]),&flg));
53   PetscCheck(flg,PETSC_COMM_WORLD,PETSC_ERR_USER_INPUT,"Must indicate a file name for matrix A with the -fA option.");
54   PetscCall(PetscOptionsString("-fB","Path for matrix B","",file[1],file[1],sizeof(file[1]),&flg));
55   PetscCall(PetscOptionsFList("-A_mat_type","Matrix type","MatSetType",MatList,deft,A_mattype,256,&flgA));
56   PetscCall(PetscOptionsFList("-B_mat_type","Matrix type","MatSetType",MatList,deft,B_mattype,256,&flgB));
57   PetscOptionsEnd();
58 
59   PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD,file[0],FILE_MODE_READ,&viewer));
60   PetscCall(MatCreate(PETSC_COMM_WORLD,&A_save));
61   PetscCall(MatLoad(A_save,viewer));
62   PetscCall(PetscViewerDestroy(&viewer));
63 
64   if (flg) {
65     PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD,file[1],FILE_MODE_READ,&viewer));
66     PetscCall(MatCreate(PETSC_COMM_WORLD,&B));
67     PetscCall(MatLoad(B,viewer));
68     PetscCall(PetscViewerDestroy(&viewer));
69   } else {
70     PetscCall(PetscObjectReference((PetscObject)A_save));
71     B = A_save;
72   }
73 
74   if (flgA) {
75     PetscCall(MatConvert(A_save,A_mattype,MAT_INPLACE_MATRIX,&A_save));
76   }
77   if (flgB) {
78     PetscCall(MatConvert(B,B_mattype,MAT_INPLACE_MATRIX,&B));
79   }
80   PetscCall(MatSetFromOptions(A_save));
81   PetscCall(MatSetFromOptions(B));
82 
83   PetscCall(MatGetType(B,&mattype));
84 
85   PetscCall(PetscMalloc(nzp*(sizeof(PetscInt)+sizeof(PetscScalar)),&idxn));
86   a    = (PetscScalar*)(idxn + nzp);
87 
88   PetscCall(PetscRandomCreate(PETSC_COMM_WORLD,&rdm));
89   PetscCall(PetscRandomSetFromOptions(rdm));
90 
91   /* 1) MatMatMult() */
92   /* ----------------*/
93   if (Test_MatMatMult) {
94     PetscCall(MatDuplicate(A_save,MAT_COPY_VALUES,&A));
95 
96     /* (1.1) Test developer API */
97     PetscCall(MatProductCreate(A,B,NULL,&C));
98     PetscCall(MatSetOptionsPrefix(C,"AB_"));
99     PetscCall(MatProductSetType(C,MATPRODUCT_AB));
100     PetscCall(MatProductSetAlgorithm(C,MATPRODUCTALGORITHMDEFAULT));
101     PetscCall(MatProductSetFill(C,PETSC_DEFAULT));
102     PetscCall(MatProductSetFromOptions(C));
103     /* we can inquire about MATOP_PRODUCTSYMBOLIC even if the destination matrix type has not been set yet */
104     PetscCall(MatHasOperation(C,MATOP_PRODUCTSYMBOLIC,&flg));
105     PetscCall(MatProductSymbolic(C));
106     PetscCall(MatProductNumeric(C));
107     PetscCall(MatMatMultEqual(A,B,C,mcheck,&flg));
108     PetscCheck(flg,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in C=A*B");
109 
110     /* Test reuse symbolic C */
111     alpha = 0.9;
112     PetscCall(MatScale(A,alpha));
113     PetscCall(MatProductNumeric(C));
114 
115     PetscCall(MatMatMultEqual(A,B,C,mcheck,&flg));
116     PetscCheck(flg,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in C=A*B");
117     PetscCall(MatDestroy(&C));
118 
119     /* (1.2) Test user driver */
120     PetscCall(MatMatMult(A,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C));
121 
122     /* Test MAT_REUSE_MATRIX - reuse symbolic C */
123     alpha = 1.0;
124     for (i=0; i<2; i++) {
125       alpha -= 0.1;
126       PetscCall(MatScale(A,alpha));
127       PetscCall(MatMatMult(A,B,MAT_REUSE_MATRIX,PETSC_DEFAULT,&C));
128     }
129     PetscCall(MatMatMultEqual(A,B,C,mcheck,&flg));
130     PetscCheck(flg,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error: MatMatMult()");
131     PetscCall(MatDestroy(&A));
132 
133     /* Test MatProductClear() */
134     PetscCall(MatProductClear(C));
135     PetscCall(MatDestroy(&C));
136 
137     /* Test MatMatMult() for dense and aij matrices */
138     PetscCall(PetscObjectTypeCompareAny((PetscObject)A,&flg,MATSEQAIJ,MATMPIAIJ,""));
139     if (flg) {
140       PetscCall(MatConvert(A_save,MATDENSE,MAT_INITIAL_MATRIX,&A));
141       PetscCall(MatMatMult(A,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C));
142       PetscCall(MatDestroy(&C));
143       PetscCall(MatDestroy(&A));
144     }
145   }
146 
147   /* Create P and R = P^T  */
148   /* --------------------- */
149   PetscCall(MatGetSize(B,&PM,NULL));
150   if (PN < 0) PN = PM/2;
151   PetscCall(MatCreate(PETSC_COMM_WORLD,&P));
152   PetscCall(MatSetSizes(P,PETSC_DECIDE,PETSC_DECIDE,PM,PN));
153   PetscCall(MatSetType(P,MATAIJ));
154   PetscCall(MatSeqAIJSetPreallocation(P,nzp,NULL));
155   PetscCall(MatMPIAIJSetPreallocation(P,nzp,NULL,nzp,NULL));
156   PetscCall(MatGetOwnershipRange(P,&rstart,&rend));
157   for (i=0; i<nzp; i++) {
158     PetscCall(PetscRandomGetValue(rdm,&a[i]));
159   }
160   for (i=rstart; i<rend; i++) {
161     for (j=0; j<nzp; j++) {
162       PetscCall(PetscRandomGetValue(rdm,&rval));
163       idxn[j] = (PetscInt)(PetscRealPart(rval)*PN);
164     }
165     PetscCall(MatSetValues(P,1,&i,nzp,idxn,a,ADD_VALUES));
166   }
167   PetscCall(MatAssemblyBegin(P,MAT_FINAL_ASSEMBLY));
168   PetscCall(MatAssemblyEnd(P,MAT_FINAL_ASSEMBLY));
169 
170   PetscCall(MatTranspose(P,MAT_INITIAL_MATRIX,&R));
171   PetscCall(MatConvert(P,mattype,MAT_INPLACE_MATRIX,&P));
172   PetscCall(MatConvert(R,mattype,MAT_INPLACE_MATRIX,&R));
173   PetscCall(MatSetFromOptions(P));
174   PetscCall(MatSetFromOptions(R));
175 
176   /* 2) MatTransposeMatMult() */
177   /* ------------------------ */
178   if (Test_MatTrMat) {
179     /* (2.1) Test developer driver C = P^T*B */
180     PetscCall(MatProductCreate(P,B,NULL,&C));
181     PetscCall(MatSetOptionsPrefix(C,"AtB_"));
182     PetscCall(MatProductSetType(C,MATPRODUCT_AtB));
183     PetscCall(MatProductSetAlgorithm(C,MATPRODUCTALGORITHMDEFAULT));
184     PetscCall(MatProductSetFill(C,PETSC_DEFAULT));
185     PetscCall(MatProductSetFromOptions(C));
186     PetscCall(MatHasOperation(C,MATOP_PRODUCTSYMBOLIC,&flg));
187     if (flg) { /* run tests if supported */
188       PetscCall(MatProductSymbolic(C)); /* equivalent to MatSetUp() */
189       PetscCall(MatSetOption(C,MAT_USE_INODES,PETSC_FALSE)); /* illustrate how to call MatSetOption() */
190       PetscCall(MatProductNumeric(C));
191       PetscCall(MatProductNumeric(C)); /* test reuse symbolic C */
192 
193       PetscCall(MatTransposeMatMultEqual(P,B,C,mcheck,&flg));
194       PetscCheck(flg,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error: developer driver C = P^T*B");
195       PetscCall(MatDestroy(&C));
196 
197       /* (2.2) Test user driver C = P^T*B */
198       PetscCall(MatTransposeMatMult(P,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C));
199       PetscCall(MatTransposeMatMult(P,B,MAT_REUSE_MATRIX,PETSC_DEFAULT,&C));
200       PetscCall(MatGetInfo(C,MAT_GLOBAL_SUM,&info));
201       PetscCall(MatProductClear(C));
202 
203       /* Compare P^T*B and R*B */
204       PetscCall(MatMatMult(R,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C1));
205       PetscCall(MatNormDifference(C,C1,&norm));
206       PetscCheck(norm <= PETSC_SMALL,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error in MatTransposeMatMult(): %g",(double)norm);
207       PetscCall(MatDestroy(&C1));
208 
209       /* Test MatDuplicate() of C=P^T*B */
210       PetscCall(MatDuplicate(C,MAT_COPY_VALUES,&C1));
211       PetscCall(MatDestroy(&C1));
212     } else {
213       PetscCall(PetscPrintf(PETSC_COMM_WORLD,"MatTransposeMatMult not supported\n"));
214     }
215     PetscCall(MatDestroy(&C));
216   }
217 
218   /* 3) MatMatTransposeMult() */
219   /* ------------------------ */
220   if (Test_MatMatTr) {
221     /* C = B*R^T */
222     PetscCall(PetscObjectBaseTypeCompare((PetscObject)B,MATSEQAIJ,&seqaij));
223     if (seqaij) {
224       PetscCall(MatMatTransposeMult(B,R,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C));
225       PetscCall(MatSetOptionsPrefix(C,"ABt_")); /* enable '-ABt_' for matrix C */
226       PetscCall(MatGetInfo(C,MAT_GLOBAL_SUM,&info));
227 
228       /* Test MAT_REUSE_MATRIX - reuse symbolic C */
229       PetscCall(MatMatTransposeMult(B,R,MAT_REUSE_MATRIX,PETSC_DEFAULT,&C));
230 
231       /* Check */
232       PetscCall(MatMatMult(B,P,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C1));
233       PetscCall(MatNormDifference(C,C1,&norm));
234       PetscCheck(norm <= PETSC_SMALL,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error in MatMatTransposeMult() %g",(double)norm);
235       PetscCall(MatDestroy(&C1));
236       PetscCall(MatDestroy(&C));
237     }
238   }
239 
240   /* 4) Test MatPtAP() */
241   /*-------------------*/
242   if (Test_MatPtAP) {
243     PetscCall(MatDuplicate(A_save,MAT_COPY_VALUES,&A));
244 
245     /* (4.1) Test developer API */
246     PetscCall(MatProductCreate(A,P,NULL,&C));
247     PetscCall(MatSetOptionsPrefix(C,"PtAP_"));
248     PetscCall(MatProductSetType(C,MATPRODUCT_PtAP));
249     PetscCall(MatProductSetAlgorithm(C,MATPRODUCTALGORITHMDEFAULT));
250     PetscCall(MatProductSetFill(C,PETSC_DEFAULT));
251     PetscCall(MatProductSetFromOptions(C));
252     PetscCall(MatProductSymbolic(C));
253     PetscCall(MatProductNumeric(C));
254     PetscCall(MatPtAPMultEqual(A,P,C,mcheck,&flg));
255     PetscCheck(flg,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error in MatProduct_PtAP");
256     PetscCall(MatProductNumeric(C)); /* reuse symbolic C */
257 
258     PetscCall(MatPtAPMultEqual(A,P,C,mcheck,&flg));
259     PetscCheck(flg,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error in MatProduct_PtAP");
260     PetscCall(MatDestroy(&C));
261 
262     /* (4.2) Test user driver */
263     PetscCall(MatPtAP(A,P,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&C));
264 
265     /* Test MAT_REUSE_MATRIX - reuse symbolic C */
266     alpha = 1.0;
267     for (i=0; i<2; i++) {
268       alpha -= 0.1;
269       PetscCall(MatScale(A,alpha));
270       PetscCall(MatPtAP(A,P,MAT_REUSE_MATRIX,PETSC_DEFAULT,&C));
271     }
272     PetscCall(MatPtAPMultEqual(A,P,C,mcheck,&flg));
273     PetscCheck(flg,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Error in MatPtAP");
274 
275     /* 5) Test MatRARt() */
276     /* ----------------- */
277     if (Test_MatRARt) {
278       Mat RARt;
279 
280       /* (5.1) Test developer driver RARt = R*A*Rt */
281       PetscCall(MatProductCreate(A,R,NULL,&RARt));
282       PetscCall(MatSetOptionsPrefix(RARt,"RARt_"));
283       PetscCall(MatProductSetType(RARt,MATPRODUCT_RARt));
284       PetscCall(MatProductSetAlgorithm(RARt,MATPRODUCTALGORITHMDEFAULT));
285       PetscCall(MatProductSetFill(RARt,PETSC_DEFAULT));
286       PetscCall(MatProductSetFromOptions(RARt));
287       PetscCall(MatHasOperation(RARt,MATOP_PRODUCTSYMBOLIC,&flg));
288       if (flg) {
289         PetscCall(MatProductSymbolic(RARt)); /* equivalent to MatSetUp() */
290         PetscCall(MatSetOption(RARt,MAT_USE_INODES,PETSC_FALSE)); /* illustrate how to call MatSetOption() */
291         PetscCall(MatProductNumeric(RARt));
292         PetscCall(MatProductNumeric(RARt)); /* test reuse symbolic RARt */
293         PetscCall(MatDestroy(&RARt));
294 
295         /* (2.2) Test user driver RARt = R*A*Rt */
296         PetscCall(MatRARt(A,R,MAT_INITIAL_MATRIX,2.0,&RARt));
297         PetscCall(MatRARt(A,R,MAT_REUSE_MATRIX,2.0,&RARt));
298 
299         PetscCall(MatNormDifference(C,RARt,&norm));
300         PetscCheck(norm <= PETSC_SMALL,PETSC_COMM_SELF,PETSC_ERR_PLIB,"|PtAP - RARt| = %g",(double)norm);
301       } else {
302         PetscCall(PetscPrintf(PETSC_COMM_WORLD,"MatRARt not supported\n"));
303       }
304       PetscCall(MatDestroy(&RARt));
305     }
306 
307     PetscCall(MatDestroy(&A));
308     PetscCall(MatDestroy(&C));
309   }
310 
311   /* Destroy objects */
312   PetscCall(PetscRandomDestroy(&rdm));
313   PetscCall(PetscFree(idxn));
314 
315   PetscCall(MatDestroy(&A_save));
316   PetscCall(MatDestroy(&B));
317   PetscCall(MatDestroy(&P));
318   PetscCall(MatDestroy(&R));
319 
320   PetscCall(PetscFinalize());
321   return 0;
322 }
323 
324 /*TEST
325    test:
326      suffix: 1
327      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
328      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium
329      output_file: output/ex62_1.out
330 
331    test:
332      suffix: 2_ab_scalable
333      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
334      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm scalable -matmatmult_via scalable -AtB_mat_product_algorithm outerproduct -mattransposematmult_via outerproduct
335      output_file: output/ex62_1.out
336 
337    test:
338      suffix: 3_ab_scalable_fast
339      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
340      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm scalable_fast -matmatmult_via scalable_fast -matmattransmult_via color
341      output_file: output/ex62_1.out
342 
343    test:
344      suffix: 4_ab_heap
345      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
346      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm heap -matmatmult_via heap -PtAP_mat_product_algorithm rap -matptap_via rap
347      output_file: output/ex62_1.out
348 
349    test:
350      suffix: 5_ab_btheap
351      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
352      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm btheap -matmatmult_via btheap -matrart_via r*art
353      output_file: output/ex62_1.out
354 
355    test:
356      suffix: 6_ab_llcondensed
357      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
358      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm llcondensed -matmatmult_via llcondensed -matrart_via coloring_rart
359      output_file: output/ex62_1.out
360 
361    test:
362      suffix: 7_ab_rowmerge
363      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
364      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm rowmerge -matmatmult_via rowmerge
365      output_file: output/ex62_1.out
366 
367    test:
368      suffix: 8_ab_hypre
369      requires: hypre datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
370      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm hypre -matmatmult_via hypre -PtAP_mat_product_algorithm hypre -matptap_via hypre
371      output_file: output/ex62_1.out
372 
373    test:
374      suffix: hypre_medium
375      nsize: {{1 3}}
376      requires: hypre datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
377      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -A_mat_type hypre -B_mat_type hypre -test_rart 0
378      output_file: output/ex62_hypre.out
379 
380    test:
381      suffix: hypre_tiny
382      nsize: {{1 3}}
383      requires: hypre !complex double !defined(PETSC_USE_64BIT_INDICES)
384      args: -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -A_mat_type hypre -B_mat_type hypre -test_rart 0
385      output_file: output/ex62_hypre.out
386 
387    test:
388      suffix: 9_mkl
389      TODO: broken MatScale?
390      requires: mkl_sparse datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
391      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -A_mat_type aijmkl -B_mat_type aijmkl
392      output_file: output/ex62_1.out
393 
394    test:
395      suffix: 10
396      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
397      nsize: 3
398      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium
399      output_file: output/ex62_1.out
400 
401    test:
402      suffix: 10_backend
403      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
404      nsize: 3
405      args: -fA ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm backend -matmatmult_via backend -AtB_mat_product_algorithm backend -mattransposematmult_via backend -PtAP_mat_product_algorithm backend -matptap_via backend
406      output_file: output/ex62_1.out
407 
408    test:
409      suffix: 11_ab_scalable
410      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
411      nsize: 3
412      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm scalable -matmatmult_via scalable -AtB_mat_product_algorithm scalable -mattransposematmult_via scalable
413      output_file: output/ex62_1.out
414 
415    test:
416      suffix: 12_ab_seqmpi
417      requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
418      nsize: 3
419      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm seqmpi -matmatmult_via seqmpi -AtB_mat_product_algorithm at*b -mattransposematmult_via at*b
420      output_file: output/ex62_1.out
421 
422    test:
423      suffix: 13_ab_hypre
424      requires: hypre datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
425      nsize: 3
426      args: -fA ${DATAFILESPATH}/matrices/medium -fB ${DATAFILESPATH}/matrices/medium -AB_mat_product_algorithm hypre -matmatmult_via hypre -PtAP_mat_product_algorithm hypre -matptap_via hypre
427      output_file: output/ex62_1.out
428 
429    test:
430      suffix: 14_seqaij
431      requires: !complex double !defined(PETSC_USE_64BIT_INDICES)
432      args: -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system
433      output_file: output/ex62_1.out
434 
435    test:
436      suffix: 14_seqaijcusparse
437      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
438      args: -A_mat_type aijcusparse -B_mat_type aijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system
439      output_file: output/ex62_1.out
440 
441    test:
442      suffix: 14_seqaijcusparse_cpu
443      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
444      args: -A_mat_type aijcusparse -B_mat_type aijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -AB_mat_product_algorithm_backend_cpu -matmatmult_backend_cpu -PtAP_mat_product_algorithm_backend_cpu -matptap_backend_cpu -RARt_mat_product_algorithm_backend_cpu -matrart_backend_cpu
445      output_file: output/ex62_1.out
446 
447    test:
448      suffix: 14_mpiaijcusparse_seq
449      nsize: 1
450      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
451      args: -A_mat_type mpiaijcusparse -B_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system
452      output_file: output/ex62_1.out
453 
454    test:
455      suffix: 14_mpiaijcusparse_seq_cpu
456      nsize: 1
457      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
458      args: -A_mat_type mpiaijcusparse -B_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -AB_mat_product_algorithm_backend_cpu -matmatmult_backend_cpu -PtAP_mat_product_algorithm_backend_cpu -matptap_backend_cpu -test_rart 0
459      output_file: output/ex62_1.out
460 
461    test:
462      suffix: 14_mpiaijcusparse
463      nsize: 3
464      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
465      args: -A_mat_type mpiaijcusparse -B_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system
466      output_file: output/ex62_1.out
467 
468    test:
469      suffix: 14_mpiaijcusparse_cpu
470      nsize: 3
471      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES)
472      args: -A_mat_type mpiaijcusparse -B_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -AB_mat_product_algorithm_backend_cpu -matmatmult_backend_cpu -PtAP_mat_product_algorithm_backend_cpu -matptap_backend_cpu -test_rart 0
473      output_file: output/ex62_1.out
474 
475    test:
476      nsize: {{1 3}}
477      suffix: 14_aijkokkos
478      requires: !sycl kokkos_kernels !complex double !defined(PETSC_USE_64BIT_INDICES)
479      args: -A_mat_type aijkokkos -B_mat_type aijkokkos -fA ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system -fB ${wPETSC_DIR}/share/petsc/datafiles/matrices/tiny_system
480      output_file: output/ex62_1.out
481 
482    # these tests use matrices with many zero rows
483    test:
484      suffix: 15_seqaijcusparse
485      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES) datafilespath
486      args: -A_mat_type aijcusparse -mat_form_explicit_transpose -fA ${DATAFILESPATH}/matrices/matmatmult/A4.BGriffith
487      output_file: output/ex62_1.out
488 
489    test:
490      suffix: 15_mpiaijcusparse_seq
491      nsize: 1
492      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES) datafilespath
493      args: -A_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${DATAFILESPATH}/matrices/matmatmult/A4.BGriffith
494      output_file: output/ex62_1.out
495 
496    test:
497      nsize: 3
498      suffix: 15_mpiaijcusparse
499      requires: cuda !complex double !defined(PETSC_USE_64BIT_INDICES) datafilespath
500      args: -A_mat_type mpiaijcusparse -mat_form_explicit_transpose -fA ${DATAFILESPATH}/matrices/matmatmult/A4.BGriffith
501      output_file: output/ex62_1.out
502 
503 TEST*/
504