Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions