Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. time0 = MPI_Wtime();
  2.     for(it = 0; it < ITMAX; it++){
  3.         eps_ = relax(rank, N, a, b, c, w, A, MAXEPS);
  4.         if (it % 1 == 0) {
  5.             MPI_Allreduce(&eps_, &eps, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); //sobiraem max eps, resultat u vseh
  6.             if (rank==0){
  7.                         printf("eps=%f\n", eps);
  8.             }
  9.         }
  10.        
  11.         if(eps < MAXEPS) {
  12.             break;
  13.         }
  14.         w = 1.0 / (1.0 - 0.25 * ro * ro * w);
  15.     }
  16.     time2 = MPI_Wtime() - time0;
  17.     MPI_Reduce(&time2, &time1, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); //schitaem obshchee vremya, resultat v 0-om processe
  18.     if(rank == 0) {
  19.         printf("Time=%f\n", time1);
  20.         printf("Iterations=%d\n", it);
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement