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.7 Consider the column-wise implementation of matrix-vector product (Program 6.5). An alternate implementation will be to use MPI_Allreduce to perform the required reduction operation and then have each process copy the locally stored elements of vector x from the vector fx. What will be the cost of this implementation? Another implementation can be to perform p single-node reduction operations using a different process as the root. What will be the cost of this implementation?
Program 6.5 Column-wise Matrix-Vector Multiplication 123"sore 4 5 6 7 8 9 ColMatrixVectorMultiply(int n, double ta, double *b, double **, MPI_Comm comm.) { int i, ji int nlocal; double *px; double *fx; int npes, myrank; MPI_Status status; 10 11 12 13 /* Get identity and size information from the communicator */ MPI_Comm_size (comm, Enpes); MPI_Comm_rank (comm, Smyrank); 14 15 nlocal = npes; 16 17 18 /* Allocate memory for arrays storing intermediate results. */ px = (double *) malloc (n*sizeof(double)); fx = (double *) malloc (n*sizeof(double)); 19 20 21 22 23 /* Compute the partial-dot products that correspond to the local columns of for (i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started