Assignment-2.pdf

In The Name Of God
Assignment No.2 on
Multicore Programming
Dr. Hamid Sarbazi-Azad
Dr. Arash Tavakkol
Important Notes:
1. This assignment should be done individually.
2. You should write it using OpenMP.
3. The deadline for this assignment is on Thursday (30th ordibehesht), Very soon delivery (till 26th
ordibehesht ) gets 10% extra mark and a 10% penalty will be given for each one day latency. No delivery
will be accepted after 5 days.
4. Cheating will make your grade -100 !
5. Your files should contain your codes and a report that explains your work. The grading policy includes:
algorithm design, code implementation, correctness of implementation, clear comments and runtime
execution performance.
6. You should zip all your files in this format: AssignmentSeriesX_StudentID.zip .
7. You should email your assignments to [email protected] .
8. I will create a forum in CW about the assignments. If anyone has a question please ask me in the
forum.
Regards,
Sina Daraby
1. List Intersection: In this assignment you are supposed to implement a parallel version of the List
intersection algorithm and compare it to the serial version. Consider you have 𝑁 Integer lists. Each list
has 𝑀 elements. Each element in any list is within a π’“π’‚π’π’ˆπ’†. In other words we know that each number
in any list is between 0 and π’“π’‚π’π’ˆπ’†. The algorithm should calculate the intersection of all lists. In
mathematical notation it is: π’πŸ ∩ π’πŸ ∩ π’πŸ‘ … … ∩ 𝒍𝒏 . for example consider the following example:
Inputs:
𝑁 = 2 , 𝑀 = 3, π‘…π‘Žπ‘›π‘”π‘’ = 10
𝑙1 = {3,2,7}, 𝑙2 = {10,1,3}
Output:
𝑙 = {3}
First you are expected to implement a serial version of this algorithm (it is so simple). Then you should
write a parallel version. Obviously there may be more than 1 approach for implementing this algorithm
in parallel. You are free to choose your own method. Then you should compare the parallel version
speed up for various 𝑁s And 𝑀s and Threads. You should test the speed up for 𝑁 = 10,50 and for 𝑀 =
10π‘˜, 100π‘˜ and threads=8,16,32,64 .You should assume that for each configuration the value of the
π‘Ÿπ‘Žπ‘›π‘”π‘’ is equal to 𝑀. The lists should be initialize with random integer numbers (between 0 and π‘Ÿπ‘Žπ‘›π‘”π‘’).
Report files should have a brief description of parallelization method you used, and a result section.
Ex. Speedup table (the numbers are fake!)
𝑡/𝑴
10/10K
10/100k
50/10K
50/100k
#threads-----------------------------------------------------------------------------------------------------------8
2.43
3.01
3.48
3.56
16
4.1
5.1
6.1
5.1
32
9.2
8.7
9.1
9.7
64
12
13
12.9
13.1