/[escript]/trunk/paso/src/PCG.c
ViewVC logotype

Diff of /trunk/paso/src/PCG.c

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

revision 495 by gross, Mon Feb 6 06:32:06 2006 UTC revision 584 by gross, Thu Mar 9 23:03:38 2006 UTC
# Line 52  err_t Paso_Solver_PCG( Line 52  err_t Paso_Solver_PCG(
52      double * r,      double * r,
53      double * x,      double * x,
54      dim_t *iter,      dim_t *iter,
55      double * tolerance) {      double * tolerance,
56        Paso_Performance* pp) {
57    
58    
59    /* Local variables */    /* Local variables */
# Line 90  err_t Paso_Solver_PCG( Line 91  err_t Paso_Solver_PCG(
91      #pragma omp parallel firstprivate(maxit,tol,convergeFlag,maxIterFlag,breakFlag) \      #pragma omp parallel firstprivate(maxit,tol,convergeFlag,maxIterFlag,breakFlag) \
92                                             private(tau_old,tau,beta,delta,gamma_1,gamma_2,alpha,norm_of_residual,num_iter)                                             private(tau_old,tau,beta,delta,gamma_1,gamma_2,alpha,norm_of_residual,num_iter)
93      {      {
94           Performance_startMonitor(pp,PERFORMANCE_SOLVER);
95         /* initialize data */         /* initialize data */
96         #pragma omp for private(i0) schedule(static)         #pragma omp for private(i0) schedule(static)
97         for (i0=0;i0<n;i0++) {         for (i0=0;i0<n;i0++) {
# Line 115  err_t Paso_Solver_PCG( Line 117  err_t Paso_Solver_PCG(
117             sum_5 = 0;             sum_5 = 0;
118             }             }
119             /* v=prec(r)  */             /* v=prec(r)  */
120               Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
121               Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);
122             Paso_Solver_solvePreconditioner(A,v,r);             Paso_Solver_solvePreconditioner(A,v,r);
123               Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);
124               Performance_startMonitor(pp,PERFORMANCE_SOLVER);
125             /* tau=v*r    */             /* tau=v*r    */
126             #pragma omp for private(i0) reduction(+:sum_1) schedule(static)             #pragma omp for private(i0) reduction(+:sum_1) schedule(static)
127             for (i0=0;i0<n;i0++) sum_1+=v[i0]*r[i0];             for (i0=0;i0<n;i0++) sum_1+=v[i0]*r[i0];
# Line 131  err_t Paso_Solver_PCG( Line 137  err_t Paso_Solver_PCG(
137                 for (i0=0;i0<n;i0++) p[i0]=v[i0]+beta*p[i0];                 for (i0=0;i0<n;i0++) p[i0]=v[i0]+beta*p[i0];
138             }             }
139             /* v=A*p */             /* v=A*p */
140               Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
141               Performance_startMonitor(pp,PERFORMANCE_MVM);
142         Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, p,ZERO,v);         Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, p,ZERO,v);
143               Performance_stopMonitor(pp,PERFORMANCE_MVM);
144               Performance_startMonitor(pp,PERFORMANCE_SOLVER);
145             /* delta=p*v */             /* delta=p*v */
146             #pragma omp for private(i0) reduction(+:sum_2) schedule(static)             #pragma omp for private(i0) reduction(+:sum_2) schedule(static)
147             for (i0=0;i0<n;i0++) sum_2+=v[i0]*p[i0];             for (i0=0;i0<n;i0++) sum_2+=v[i0]*p[i0];
# Line 175  err_t Paso_Solver_PCG( Line 185  err_t Paso_Solver_PCG(
185             } else if (breakFlag) {             } else if (breakFlag) {
186                 status = SOLVER_BREAKDOWN;                 status = SOLVER_BREAKDOWN;
187             }             }
188           }         }
189           Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
190      }  /* end of parallel region */      }  /* end of parallel region */
191      TMPMEMFREE(rs);      TMPMEMFREE(rs);
192      TMPMEMFREE(x2);      TMPMEMFREE(x2);

Legend:
Removed from v.495  
changed lines
  Added in v.584

  ViewVC Help
Powered by ViewVC 1.1.26