/[escript]/trunk/paso/profiling/Test.c
ViewVC logotype

Diff of /trunk/paso/profiling/Test.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2819 by artak, Tue Jun 23 06:02:26 2009 UTC revision 2820 by artak, Thu Dec 10 05:03:11 2009 UTC
# Line 10  Line 10 
10  #define PI (3.141592653589793)  #define PI (3.141592653589793)
11    
12  /*  /*
13   Usage: PasoTests -f filename [-s solver] [-p preconditioner] [-l level] [-r rhs matrix] [-c coupling parameter for AMG]   Usage: PasoTests -f filename [-s solver] [-p preconditioner] [-l level] [-r rhs matrix] [-c coarsening method] [-t threshold parameter for AMG coarsening]
14          filename - matrix to be loaded in CSR Matrix-Market format          filename - matrix to be loaded in CSR Matrix-Market format
15          solver   - PCG, GMRES, PRES20, TFQMR and MINRES          solver   - PCG, GMRES, PRES20, TFQMR and MINRES
16          preconditioner - ILU0, RILU, JACOBI, GS and AMG          preconditioner - ILU0, RILU, JACOBI, GS and AMG
# Line 19  Line 19 
19                     1 - test all solvers with default preconditioner                     1 - test all solvers with default preconditioner
20                     2 - test all preconditioners with default solver                     2 - test all preconditioners with default solver
21                     3 - compare solution obtained by using AMG and Jacobi precondioners                     3 - compare solution obtained by using AMG and Jacobi precondioners
22          rhs matrix - right hand side vector in CSR Matrix Market format.          coarsening method - YS, RS, AGG and STD.
23          coupling parameter for AMG - this is the threshold value used in AMG in courenening process. Default is 0.05.          threshold parameter for AMG - this is the threshold value used in AMG in courenening process. Default is 0.25. For YS and AGG, please, use 0.05.            
24  */  */
25    
26  double Lsup(double* x, int n) {  double Lsup(double* x, int n) {
# Line 53  int main (int argc, char *argv[]) { Line 53  int main (int argc, char *argv[]) {
53            
54      options.verbose=TRUE;      options.verbose=TRUE;
55    
56      while ((c = getopt(argc, argv, "s:p:f:r:l:c:h")) != -1) {      while ((c = getopt(argc, argv, "s:p:f:r:l:t:c:h")) != -1) {
57        switch(c) {        switch(c) {
58          case 's':          case 's':
59              solver=optarg;              solver=optarg;
# Line 87  int main (int argc, char *argv[]) { Line 87  int main (int argc, char *argv[]) {
87              else if (strcmp(prec,"AMG")==0) {              else if (strcmp(prec,"AMG")==0) {
88                  options.preconditioner=PASO_AMG;                  options.preconditioner=PASO_AMG;
89              }              }
90                else if (strcmp(prec,"AMLI")==0) {
91                    options.preconditioner=PASO_AMG;
92                }
93          break;          break;
94          case 'f':          case 'f':
95              filename = optarg;              filename = optarg;
# Line 105  int main (int argc, char *argv[]) { Line 108  int main (int argc, char *argv[]) {
108          case 'r':          case 'r':
109              rhs=optarg;              rhs=optarg;
110              if (A==NULL) {              if (A==NULL) {
111               fprintf(stderr,"Left hand side not loaded yet.\n");               fprintf(stderr,"System matrix is not loaded yet.\n");
112               break;               break;
113              }              }
114              n=Paso_SystemMatrix_getTotalNumRows(A);              n=Paso_SystemMatrix_getTotalNumRows(A);
# Line 114  int main (int argc, char *argv[]) { Line 117  int main (int argc, char *argv[]) {
117          case 'l':          case 'l':
118              level=atoi(optarg);              level=atoi(optarg);
119              break;              break;
120          case 'c':          case 't':
121              options.coarsening_threshold=atof(optarg);              options.coarsening_threshold=atof(optarg);
122            case 'c':
123                prec=optarg;
124                if (strcmp(prec,"RS")==0)
125                    options.coarsening_method=PASO_RUGE_STUEBEN_COARSENING;
126                else if (strcmp(prec,"YS")==0)
127                    options.coarsening_method=PASO_YAIR_SHAPIRA_COARSENING;
128                else if (strcmp(prec,"AGG")==0)
129                    options.coarsening_method=PASO_AGGREGATION_COARSENING;
130                else if (strcmp(prec,"STD")==0)
131                    options.coarsening_method=PASO_STANDARD_COARSENING;
132          break;          break;
133          case '?':          case '?':
134              printf("unknown arg %c\n", optopt);              printf("unknown arg %c\n", optopt);
135              break;              break;
136          case 'h':          case 'h':
137              printf("Usage: PasoTests -f filename [-s solver] [-p preconditioner] [-l level] [-r rhs matrix] [-c coupling parameter for AMG]\n");              printf("Usage: PasoTests -f filename [-s solver] [-p preconditioner] [-l level] [-r rhs vector] [-c coarsening method] [-t threshold parameter for AMG coarsening] \n");
138              printf("\t filename - matrix to be loaded in CSR Matrix-Market format\n");              printf("\t filename - matrix to be loaded in CSR Matrix-Market format\n");
139              printf("\t solver   - PCG, GMRES, PRES20, TFQMR and MINRES\n");              printf("\t solver   - PCG, GMRES, PRES20, TFQMR and MINRES\n");
140              printf("\t preconditioner - ILU0, RILU, JACOBI, GS and AMG\n");              printf("\t preconditioner - ILU0, RILU, JACOBI, GS and AMG\n");
# Line 130  int main (int argc, char *argv[]) { Line 143  int main (int argc, char *argv[]) {
143              printf("\t\t 1 - test all solvers with default preconditioner\n");                          printf("\t\t 1 - test all solvers with default preconditioner\n");            
144              printf("\t\t 2 - test all preconditioners with default solver\n");              printf("\t\t 2 - test all preconditioners with default solver\n");
145              printf("\t\t 3 - compare solution obtained by using AMG and Jacobi precondioners\n");                          printf("\t\t 3 - compare solution obtained by using AMG and Jacobi precondioners\n");            
146              printf("\trhs matrix - right hand side vector in CSR Matrix Market format.\n");              printf("\trhs vector - right hand side vector in CSR Matrix Market format.\n");
147              printf("\tcoupling parameter for AMG - this is the threshold value used in AMG in courenening process. Default is 0.05.\n");                          printf("\tcoarsening method - YS, RS, AGG and STD.\n");
148                printf("\tthreshold parameter for AMG - this is the threshold value used in AMG in courenening process. Default is 0.25. For YS and AGG, please, use 0.05.\n");            
149              break;              break;
150          }          }
151      }      }
# Line 178  int main (int argc, char *argv[]) { Line 192  int main (int argc, char *argv[]) {
192          Paso_Solver_setPreconditioner(A,&options);          Paso_Solver_setPreconditioner(A,&options);
193          Paso_Solver_solvePreconditioner(A,x,b);          Paso_Solver_solvePreconditioner(A,x,b);
194    
195    
196          for(i=0;i<n;i++) {          for(i=0;i<n;i++) {
197            error[i]=x[i]-x_ref[i];            error[i]=x[i]-x_ref[i];
198          }          }

Legend:
Removed from v.2819  
changed lines
  Added in v.2820

  ViewVC Help
Powered by ViewVC 1.1.26