Removed status
This commit is contained in:
parent
054a659804
commit
072608064b
|
@ -22,7 +22,6 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
int nb = n + 2; // n plus the border
|
int nb = n + 2; // n plus the border
|
||||||
int rows, rows_to_transmit;
|
int rows, rows_to_transmit;
|
||||||
int receive_pos;
|
int receive_pos;
|
||||||
MPI_Status status;
|
|
||||||
|
|
||||||
if (rank == 0) {
|
if (rank == 0) {
|
||||||
rows = n - (n / numprocs) * (numprocs - 1);
|
rows = n - (n / numprocs) * (numprocs - 1);
|
||||||
|
@ -79,20 +78,20 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
if (rank != numprocs - 1) {
|
if (rank != numprocs - 1) {
|
||||||
// Send and receive south border
|
// Send and receive south border
|
||||||
MPI_Send(&x[IDX(nb, rows, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD);
|
MPI_Send(&x[IDX(nb, rows, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD);
|
||||||
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
}
|
}
|
||||||
if (rank != 0) {
|
if (rank != 0) {
|
||||||
// Send and receive north border
|
// Send and receive north border
|
||||||
MPI_Send(&x[IDX(nb, 1, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD);
|
MPI_Send(&x[IDX(nb, 1, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD);
|
||||||
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Receive and send north border
|
// Receive and send north border
|
||||||
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
MPI_Send(&x[IDX(nb, 1, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD);
|
MPI_Send(&x[IDX(nb, 1, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD);
|
||||||
if (rank != numprocs - 1) {
|
if (rank != numprocs - 1) {
|
||||||
// Receive and send south border
|
// Receive and send south border
|
||||||
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
MPI_Send(&x[IDX(nb, rows, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD);
|
MPI_Send(&x[IDX(nb, rows, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +110,7 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
if (i == numprocs - 1) {
|
if (i == numprocs - 1) {
|
||||||
rows_to_transmit++;
|
rows_to_transmit++;
|
||||||
}
|
}
|
||||||
MPI_Recv(&complete_x[IDX(nb, receive_pos, 0)], rows_to_transmit * (nb), MPI_DOUBLE, i, TAG_MATRIX, MPI_COMM_WORLD, &status);
|
MPI_Recv(&complete_x[IDX(nb, receive_pos, 0)], rows_to_transmit * (nb), MPI_DOUBLE, i, TAG_MATRIX, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
receive_pos += n / numprocs;
|
receive_pos += n / numprocs;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,7 +22,6 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
int nb = n + 2; // n plus the border
|
int nb = n + 2; // n plus the border
|
||||||
int rows, rows_to_transmit;
|
int rows, rows_to_transmit;
|
||||||
int receive_pos;
|
int receive_pos;
|
||||||
MPI_Status status;
|
|
||||||
MPI_Request request_north;
|
MPI_Request request_north;
|
||||||
MPI_Request request_south;
|
MPI_Request request_south;
|
||||||
|
|
||||||
|
@ -87,11 +86,11 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
x = tmp_x;
|
x = tmp_x;
|
||||||
if (rank != numprocs - 1) {
|
if (rank != numprocs - 1) {
|
||||||
// Receive south border
|
// Receive south border
|
||||||
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, rows + 1, 0)], nb, MPI_DOUBLE, rank + 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
}
|
}
|
||||||
if (rank != 0) {
|
if (rank != 0) {
|
||||||
// Receive north border
|
// Receive north border
|
||||||
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, &status);
|
MPI_Recv(&x[IDX(nb, 0, 0)], nb, MPI_DOUBLE, rank - 1, TAG_BORDER, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
}
|
}
|
||||||
LOG(printf("[Process %d/%d] max_diff: %f\n", rank, numprocs, max_diff));
|
LOG(printf("[Process %d/%d] max_diff: %f\n", rank, numprocs, max_diff));
|
||||||
MPI_Allreduce(&max_diff, &global_max_diff, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
|
MPI_Allreduce(&max_diff, &global_max_diff, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
|
||||||
|
@ -108,7 +107,7 @@ double *compute_jacobi(int rank, int numprocs, int n, double init_value, double
|
||||||
if (i == numprocs - 1) {
|
if (i == numprocs - 1) {
|
||||||
rows_to_transmit++;
|
rows_to_transmit++;
|
||||||
}
|
}
|
||||||
MPI_Recv(&complete_x[IDX(nb, receive_pos, 0)], rows_to_transmit * (nb), MPI_DOUBLE, i, TAG_MATRIX, MPI_COMM_WORLD, &status);
|
MPI_Recv(&complete_x[IDX(nb, receive_pos, 0)], rows_to_transmit * (nb), MPI_DOUBLE, i, TAG_MATRIX, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
receive_pos += n / numprocs;
|
receive_pos += n / numprocs;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user