Open main menu

CDOT Wiki β

Changes

GPU621/Analyzing False Sharing

1,114 bytes added, 10:23, 23 November 2022
no edit summary
=Group Members=
<br />
# [mailto:rleong4@myseneca.ca?subject=GPU621 Ryan Leong]
# [mailto:yppadsala@myseneca.ca?subject=GPU621 Yash Padsala]
# [mailto:sgpatel22@myseneca.ca?subject=GPU621 Shani Patel]
= '''Example Of A False Sharing''' =
 
In this program code, we can see that at the beginning of the main function we declare a vector numbers and initialize it from 0 to 100. We can also see in the main function that the code is divided into two main blocks. The first block is the Thread block, which is executed concurrently using multiple threads. While the second block is the Serial block, it is executed concurrently using normal serial logic.
 
The main purpose of the sumUp function is to calculate the sum of odd elements or even elements based on the data in the first vector argument in the argument list. Also, the sum will be recorded in the corresponding position of the second vector argument using the int argument as the index.
 
Which block of code do you feel will take less time?
 
Theoretically on a multicore machine it should be the Thread code block that is faster, right? But the result is.
118
edits