From c38550c8aa3448136aaa1888e349913bcb695bc6 Mon Sep 17 00:00:00 2001 From: Fabio Salvini Date: Sun, 13 Nov 2016 13:24:26 +0100 Subject: [PATCH] Misc --- mpi_line/jacobi_mpi_line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpi_line/jacobi_mpi_line.c b/mpi_line/jacobi_mpi_line.c index 2a99683..6ca8f5f 100644 --- a/mpi_line/jacobi_mpi_line.c +++ b/mpi_line/jacobi_mpi_line.c @@ -159,7 +159,7 @@ double *compute_jacobi(int n, double init_value, double threshold, borders b, in if (rank == 0) { complete_x = create_sa_matrix(n + 2, n + 2); - memcpy(complete_x, x, (rows + 1) * (n + 2) * sizeof(double)); /* rows + 2 if rank == numprocs - 1 */ + memcpy(complete_x, x, (rows + ((rank == numprocs - 1) ? 2 : 1)) * (n + 2) * sizeof(double)); rows_to_transmit = n / numprocs; receive_pos = rows + 1; for (i = 1; i < numprocs; i++) {