/[escript]/release/4.0/paso/profiling/Paso_tests.cpp
ViewVC logotype

Contents of /release/4.0/paso/profiling/Paso_tests.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5379 - (show annotations)
Mon Dec 15 23:58:17 2014 UTC (5 years, 5 months ago) by jfenwick
File size: 4810 byte(s)
branching for release prep

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 /************************************************************************************/
19
20 /* Paso: interface to the direct solvers */
21
22 /************************************************************************************/
23
24 /* Author: artak@uq.edu.au */
25
26 /************************************************************************************/
27
28 #include "paso/Paso.h"
29 #include "paso/Solver.h"
30 #include "paso/SystemMatrix.h"
31 #include "paso/Options.h"
32 #include "Paso_tests.h"
33
34
35 /************************************************************************************/
36
37 void Paso_test_run(Paso_SystemMatrix* A,double* b,dim_t level)
38 {
39 paso::Options options;
40
41 if(level==1) /* Solvers only*/
42 {
43 options.setDefaults();
44 options.method=PASO_PCG;
45 options.verbose=TRUE;
46 options.preconditioner=PASO_JACOBI;
47 fprintf(stdout,"Test solver: PCG with JACOBI\n");
48 Paso_test_matrix(A,b,&options);
49
50 fprintf(stdout,"Test solver: BICGSTAB with JACOBI\n");
51 options.setDefaults();
52 A->solver=NULL;
53 options.verbose=TRUE;
54 options.method=PASO_BICGSTAB;
55 Paso_test_matrix(A,b,&options);
56
57 fprintf(stdout,"Test solver: GMRES with JACOBI\n");
58 options.setDefaults();
59 A->solver=NULL;
60 options.verbose=TRUE;
61 options.method=PASO_GMRES;
62 Paso_test_matrix(A,b,&options);
63
64 fprintf(stdout,"Test solver: PRES20 with JACOBI\n");
65 options.setDefaults();
66 A->solver=NULL;
67 options.verbose=TRUE;
68 options.method=PASO_PRES20;
69 Paso_test_matrix(A,b,&options);
70
71 fprintf(stdout,"Test solver: MINRES with JACOBI\n");
72 options.setDefaults();
73 A->solver=NULL;
74 options.verbose=TRUE;
75 options.method=PASO_MINRES;
76 Paso_test_matrix(A,b,&options);
77
78 fprintf(stdout,"Test solver: TFQMR with JACOBI\n");
79 options.setDefaults();
80 A->solver=NULL;
81 options.verbose=TRUE;
82 options.method=PASO_TFQMR;
83 Paso_test_matrix(A,b,&options);
84 }
85 else if (level==2) /* Preconditioners only with default solver*/
86 {
87 options.setDefaults();
88 options.method=PASO_DEFAULT;
89 options.verbose=TRUE;
90 options.preconditioner=PASO_JACOBI;
91 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with JACOBI\n");
92 Paso_test_matrix(A,b,&options);
93
94 options.setDefaults();
95 A->solver=NULL;
96 options.method=PASO_DEFAULT;
97 options.verbose=TRUE;
98 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with ILU\n");
99 options.preconditioner=PASO_ILU0;
100 Paso_test_matrix(A,b,&options);
101
102 options.setDefaults();
103 A->solver=NULL;
104 options.method=PASO_DEFAULT;
105 options.verbose=TRUE;
106 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with RILU\n");
107 options.preconditioner=PASO_RILU;
108 Paso_test_matrix(A,b,&options);
109
110 options.setDefaults();
111 A->solver=NULL;
112 options.method=PASO_DEFAULT;
113 options.verbose=TRUE;
114 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with GS\n");
115 options.preconditioner=PASO_GS;
116 Paso_test_matrix(A,b,&options);
117
118 options.setDefaults();
119 A->solver=NULL;
120 options.method=PASO_DEFAULT;
121 options.verbose=TRUE;
122 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with AMG\n");
123 options.preconditioner=PASO_AMG;
124 Paso_test_matrix(A,b,&options);
125
126 options.setDefaults();
127 A->solver=NULL;
128 options.method=PASO_DEFAULT;
129 options.verbose=TRUE;
130 fprintf(stdout,"Test preconditioner: PASO_DEFAULT with AMLI\n");
131 options.preconditioner=PASO_AMLI;
132 Paso_test_matrix(A,b,&options);
133 }
134 }
135
136 void Paso_test_matrix(Paso_SystemMatrix* A, double* b, Paso_Options* options ) {
137
138 dim_t n=Paso_SystemMatrix_getTotalNumRows(A);
139 double *out=new double[n];
140
141 Paso_solve(A,out,b,options);
142
143 delete[] out;
144 }
145
146 void Paso_test_data(char *fileName_p, double* b, Paso_Options* options ) {
147
148 Paso_SystemMatrix* A=NULL;
149 dim_t n=Paso_SystemMatrix_getTotalNumRows(A);
150 double *out = new double[n];
151 A=Paso_SystemMatrix_loadMM_toCSR(fileName_p);
152 Paso_solve(A,out,b,options);
153 Paso_SystemMatrix_free(A);
154 delete[] out;
155 }
156

  ViewVC Help
Powered by ViewVC 1.1.26