Question: these question from Introduction to Parallel Computing, Second Edition By Ananth Grama, Anshul Gupta, George Karypis, Vipin Kumar chapter 6 :please dont use copy and
these question from "Introduction to Parallel Computing, Second Edition By Ananth Grama, Anshul Gupta, George Karypis, Vipin Kumar" chapter 6
:please dont use copy and paste from another answer:
6.6 Show how the row-wise matrix-vector multiplication program (Program 6.4) needs to be changed so that it will work correctly in cases in which the dimension of the matrix does not have to be a multiple of the number of processes. 
Program 6.4 Row-wise Matrix-Vector Multiplication 1 2 RowMatrixVectorMultiply(int n, double ta, double *b, double *x, MPI_Comm comm) int i, ji int nlocal; double *fb; int npes, myrank; MPI_Status status; /* Number of locally stored rows of A */ /* will point to a buffer that stores the entire vector i COo / + Get information about the communicator +/ MPI_Comm_size (comm, enpes); MPI_Comm_rank (comm, cmyrank); 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 /* Allocate the memory that will store the entire vector b */ fb = (double *) malloc(n*sizeof(double)); nlocal = npes; /* Gather the entire vector b on each processor using MPI'S ALLGATHER operat MPI_Allgather(b, nlocal, MPI_DOUBLE, fb, nlocal, MPI_DOUBLE, comm); /* Perform the matrix-vector multiplication involving the locally stored suk for (i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
