Lab Assignment 3 - Write A Program For Parallel Vector Addition by Using Multithreading
Lab Assignment 3 - Write A Program For Parallel Vector Addition by Using Multithreading
Assignment No 3
Objective: Write a program for parallel vector addition by using multithreading.
The complexity of vector addition is O(N) and the execution time depends on the vector length.
In this assignment you will learn how to pass and return values from a thread and how logically
work can be divided into multiple threads to be performed in parallel and reduce total
execution time. You need do device some logic for load balancing.
Submit a word file containing all code, output snapshots and the comparison table and graph.
-------------------------------------------------------------------------------------------------------------------------------
Input:
1. Vector Length: N (to be used to create and initialize 3 vectors)
2. No of Threads: T
Processing: Determine the execution time of vector addition with various values of T and N
given in the table.
T0 = get clock cycle/system time
Perform V1 = V2 + V3 with load balancing among T threads.
T1 = get clock cycle/system time
Time elapsed = T1 – T0
Output: Time elapsed - Tables show the comparison
5
10
15
20
25
30