Please fill up the below table to solve the following Parallel programming EXERC
ID: 3696764 • Letter: P
Question
Please fill up the below table to solve the following Parallel programming EXERCISE
Different Partitions for 14 component Vector among four Processes
Process
Block
Cyclic
Block-Cyclic
Blocksize = 2
0
1
2
3
EXERCISE:
Suppose comm_sz = 4 and suppose that x is a vector with n = 14 components.
a. How would the components of x be distributed among the processes in a
program that used a block distribution?
b. How would the components of x be distributed among the processes in a
program that used a cyclic distribution?
c. How would the components of x be distributed among the processes in a
program that used a block-cyclic distribution with blocksize b = 2?
You should try to make your distributions general so that they could be used
regardless of what comm_sz and n are. You should also try to make your distributions
“fair” so that if q and r are any two processes, the difference between
the number of components assigned to q and the number of components
assigned to r is as small as possible.
Note: Please fill up the above table only to solve this exercise.
Different Partitions for 14 component Vector among four Processes
Process
Block
Cyclic
Block-Cyclic
Blocksize = 2
0
1
2
3
Explanation / Answer
A)
In a block distribution, the number n of elements is divided equally and in order of the processes, if the result of the division between n and comm_sz did not rest. If we rest, we can distribute it in order between processes. In this matter, each process will get the entire division n / comm_sz = 14/4 = 3. The rest of the division is 2, then the processes 0 and 1 will receive 4 elements each and the rest will get 3. The result is below:
Processos 0 1 2 3
Elements x[0], x[1], x[2], x[12] x[3], x[4], x[5], x[13] x[6], x[7], x[8] x[9], x[10], x[11]
B)
In a cyclical distribution, the number n of elements is delivered one at a time in each process in a certain number of cycles. The element x [0] the process goes to 0, x [1] goes to the process 1, X [2] the process goes to 2 and x [3] the process goes to 3, completing a cycle. The next cycle follows the same logic. The result is below:
Processes 0 1 2 3
Elements x [0], x [1], X [8], x [12] x [1], x [5], x [9], x [13] x [2], x [6] x [10] x [3], x [7], x [11]
c)
In a block-cyclic distribution, there is a portmanteau of the block and cyclic properties. For a given b, the vector x with n elements would be divided into blocks. The number of blocks would be n / b = 14/2 = 7. If the whole division had rest, it would be distributed among the blocks always in the same order. Here's an example below:
Processes 0 1 2 3
Elements x [0], x [1], X [8], x [9] x [2], x [3], x [10], x [11] x [4], x [5], x [12], x [13] x [6] x [7]