From aee43fd65803dddf69d5262cb2ae714fcea67427 Mon Sep 17 00:00:00 2001 From: bbod Date: Sun, 29 Mar 2020 19:24:56 -0600 Subject: [PATCH] test --- HW10/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/HW10/main.cpp b/HW10/main.cpp index 3b5485a..d3f174d 100644 --- a/HW10/main.cpp +++ b/HW10/main.cpp @@ -35,13 +35,15 @@ int main(int argc, char* argv[]) matrix[i].resize(citiesSize); } } - MPI_Bcast(&(matrix[0][0]), citiesSize*citiesSize, MPI_DOUBLE, 0, MPI_COMM_WORLD); - + for(int i = 0; i < citiesSize; i++) { + MPI_Bcast(&(matrix[0][i]), citiesSize, MPI_DOUBLE, 0, MPI_COMM_WORLD); + } if(rank){ std::cout << "Process "<< rank << " has value " << citiesSize << " as size of city" << std::endl; - for(int i = 0; i < citiesSize; i++){ - for(int j = 0; j < citiesSize; j++) { - std::cout<<"Process " << rank << " has value " << matrix[i][j] << " at postion" << "(" << i << "," << j << ")" << std::endl; + for(int i = 0; i < citiesSize; i++) { + for (int j = 0; j < citiesSize; j++) { + std::cout << "Process " << rank << " has value " << matrix[i][j] << " at postion" + << "(" << i << "," << j << ")" << std::endl; } } }