Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- time0 = MPI_Wtime();
- for(it = 0; it < ITMAX; it++){
- eps_ = relax(rank, N, a, b, c, w, A, MAXEPS);
- if (it % 1 == 0) {
- MPI_Allreduce(&eps_, &eps, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); //sobiraem max eps, resultat u vseh
- if (rank==0){
- printf("eps=%f\n", eps);
- }
- }
- if(eps < MAXEPS) {
- break;
- }
- w = 1.0 / (1.0 - 0.25 * ro * ro * w);
- }
- time2 = MPI_Wtime() - time0;
- MPI_Reduce(&time2, &time1, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); //schitaem obshchee vremya, resultat v 0-om processe
- if(rank == 0) {
- printf("Time=%f\n", time1);
- printf("Iterations=%d\n", it);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement