From 4581a62126367b6e65ce5568c0e2f6cb236aff70 Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 31 May 2025 15:32:01 +0200 Subject: [PATCH] gather result matrix --- lab10/jacobi/jacobi_mpi.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lab10/jacobi/jacobi_mpi.cpp b/lab10/jacobi/jacobi_mpi.cpp index c3cfd88..0974cd6 100644 --- a/lab10/jacobi/jacobi_mpi.cpp +++ b/lab10/jacobi/jacobi_mpi.cpp @@ -160,5 +160,10 @@ Jacobi::Result JacobiMPI::run(const Matrix &init, double epsilon, std::swap(t0, t1); } + Matrix result = Matrix::zeros(numProc * numRows, numCols); + + MPI_Gather(&phi[t0], numRows * numCols, MPI_DOUBLE, result.data(), + numRows * numCols, MPI_DOUBLE, 0, MPI_COMM_WORLD); + return Jacobi::Result{phi[t0], dist, nIter}; }