Please fill up the below table to solve the following Parallel programming EXERC
ID: 3697642 • Letter: P
Question
Please fill up the below table to solve the following Parallel programming EXERCISE and also explain the logic:
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. Also, please explain me the logic.
Different Partitions for 14 component Vector among four Processes
Process
Block
Cyclic
Block-Cyclic
Blocksize = 2
0
1
2
3
Explanation / Answer
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 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:
processes 0 1 2
Elements x [0], x [1], x [2], x [12] x [3], x [4], x [5], x [13] x [6] x [7], x [8]
3
x [9], x [10], x [11]
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] goes to process 0, x [1] goes to the process 1, x [2] goes into the process 2 EOX [3] goes into the process 3, closing a cycle. The next cycle follows the same logic. The result is below:
processes 0 1 2
Elements x [0], x [1], x [8], x [12] x [1], x [5], x [9], x [13] x [2], x [6] x [10]
3
x [3], x [7], x [11]
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
elements x [0], x [1], x [8], x [9] x [2], x [3], x [10], x [11] x [4], x [5], x[12],
3
x [13],x [6], x [7]
Different Partitions for 14 component Vector among four Processes
Process
Block
Cyclic
Block-Cyclic
Blocksize = 2
0
x [0], x [1], x [2], x [12]
x [0], x [1], x [8], x [12]
x[0],x[1],x[8],x[9]
1
x [3], x [4], x [5], x [13]
x [1], x [5], x [9], x [13]
x[2],x[3],x[10],x[11]
2
x[6],x[7],x[8]
x [2], x [6] x [10]
x[4],x[5],x[12],x[13]
3
x[9],x[10],x[11]
x [3], x [7], x [11]
x[6],x[7]
Different Partitions for 14 component Vector among four Processes
Process
Block
Cyclic
Block-Cyclic
Blocksize = 2
0
x [0], x [1], x [2], x [12]
x [0], x [1], x [8], x [12]
x[0],x[1],x[8],x[9]
1
x [3], x [4], x [5], x [13]
x [1], x [5], x [9], x [13]
x[2],x[3],x[10],x[11]
2
x[6],x[7],x[8]
x [2], x [6] x [10]
x[4],x[5],x[12],x[13]
3
x[9],x[10],x[11]
x [3], x [7], x [11]
x[6],x[7]