Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If we decide to physically divide a data structure among the threads, that is , if we decide to make various members local to individual

If we decide to physically divide a data structure among the threads, that is,
if we decide to make various members local to individual threads, we need to
consider at least three issues:
a. How are the members of the data structure used by the individual threads?
b. Where and how is the data structure initialized?
c. Where and how is the data structure used after its members are computed?
We briefly looked at the first issue in the matrix-vector multiplication function.
We saw that the entire vector x was used by all of the threads, so it seemed
pretty clear that it should be shared. However, for both the matrix A and the
product vector y, just looking at (a) seemed to suggest that A and y should
have their components distributed among the threads. Lets take a closer look
at this.
What would we have to do in order to divide A and y among the threads?
Dividing y wouldnt be difficulteach thread could allocate a block of memory
that could be used for storing its assigned components. Presumably, we could
do the same for Aeach thread could allocate a block of memory for storing
4.13 Exercises 201
its assigned rows. Modify the matrix-vector multiplication program so that
it distributes both of these data structures. Can you schedule the input and
output so that the threads can read in A and print out y? How does distributing
A and y affect the run-time of the matrix-vector multiplication? (Dont include
input or output in your run-time.)

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

2. When is the job to be completed?

Answered: 1 week ago

Question

LO6 Describe how individual pay rates are set.

Answered: 1 week ago