Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fill the blank please? a-Send b- Scatter c-Recv d-gather from mpi 4py import MPI import numpy as np comm = MPI.COMM WORLD size = comm.
Fill the blank please?
a-Send
b- Scatter
c-Recv
d-gather
from mpi 4py import MPI import numpy as np comm = MPI.COMM WORLD size = comm. Get_size() rank = comm.Get_rank() np.random.seed (5) x = np.random.rand (size) A = None if rank == 0: A = np.random.rand (size,size) print ("matrix A: " % A) print ("vector x: %s" % x) A_partition = np. empty (size, dtype='d') if size > 1: comm. (A, A_partition, root=0) y = np.dot (A_partition, x) y = comm. (y, root=0) else: y = np.dot (A,x) if rank == 0: print ("product : %s" % np.round(y,2))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