From cde52e415638534fdd0bee2439c5b939acff2158 Mon Sep 17 00:00:00 2001 From: WickedJack99 Date: Sun, 29 Jun 2025 20:58:10 +0200 Subject: [PATCH] . --- lab12/exc4/jacobi.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lab12/exc4/jacobi.cpp b/lab12/exc4/jacobi.cpp index 98638f2..b5960e9 100644 --- a/lab12/exc4/jacobi.cpp +++ b/lab12/exc4/jacobi.cpp @@ -229,11 +229,9 @@ Jacobi::Result Jacobi::run(const Matrix &init, double eps, int maxNumIter) const int numRows = phi[0].rows(); const int numCols = phi[0].cols(); - if (is_first_on_node_) - { - MPI_Aint size = numCols * 2 * sizeof(double) + sizeof(SharedmemStates); - MPI_Win_allocate_shared(size, sizeof(char), MPI_INFO_NULL, shm_comm_, &baseptr_, &win_); - } + MPI_Aint size = is_first_on_node_ ? (numCols * 2 * sizeof(double) + sizeof(SharedmemStates)) : 0; + + MPI_Win_allocate_shared(size, sizeof(char), MPI_INFO_NULL, shm_comm_, &baseptr_, &win_); int nIter = 0; double dist = std::numeric_limits::max();