﻿ 并行计算考试代做 并行计算考试代考 – 天才代写

# 并行计算考试代做 并行计算考试代考

2023-11-26 09:49 星期日 所属： CS代写 浏览：92

## (60 minutes)

• This exam contains 5 questions with a total of 20 points.
• If you have to make assumptions to continue solving a problem, state your assumptions clearly.

### 1.

Assume we have the following task graph. A task can be thought of as function/procedure. Every task is labeled with its run time on a core. An arrow from a task to another means that the first task generates data needed by the second one. Do not make any assumptions regarding cache misses, coherence, etc. Just assume that the given runtimes took all these factors into account.

a. [2 points] What is the smallest number of cores needed to get the best performance? Explain.

b. [1 point] Based on the number of cores you picked in part (a) above, what is the total run time?

c. [2 points] If we use 9 cores, what will be the efficiency? You don’t need to write the final number if you don’t have a calculator.

d. [2 points] What is the span for the above graph? what is the work?

e. [1 point] What is the parallelism?

f. [1 point] What does the number you calculated in (d) mean?

### 2.[2 points]   并行计算考试代做

We have studied Amdahl’s law in class. Suppose that the fraction of the sequential part of your program if 50% and we have two cores. What is the best action to get better performance: trying to reduce the sequential part to 25%? or keeping it at 50% but use 4 cores instead of 2? Show clearly all the steps.

### 3.[2 points]

Suppose you have an MPI program and a sequential program. State two reasons that can make the MPI running with one process slower than the sequential code.

a. [2 points] State two overheads of coherence?

b. [1 point] If two parallel threads (i.e sharing memory) try to update two different variables, can this cause coherence overhead? Justify.

c. [1 point] As the number of processes in MPI increases, does this make coherence overhead more severe? Explain.

### 5.[3 points]   并行计算考试代做

Suppose we have the following code snippet to be executed by three processes.

```switch(rank) {
case 0:
MPI_Bcast(x, count, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Send(y, count, MPI_INT, 1, 0, MPI_COMM_WORLD);
break;
case 1:
MPI_Recv(x, count, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD,
status);
MPI_Bcast(y, count, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Recv(x, count, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD,
status);
break;
case 2:
MPI_Send(x, count, MPI_INT, 1, 0, MPI_COMM_WORLD);
MPI_Bcast(y, count, MPI_INT, 0, MPI_COMM_WORLD);
break;
}```

Fill in the blanks in the following table with the values of the variables x nand y for each process.

 Process 0 Process 1 Process 2 x 7 9 y 8