Computer Science > QUESTIONS & ANSWERS > University of California, BerkeleyCS 61C61chw10. (All)
Q1 Parallelism Principles 7 Points The Hamming distance between two bitstrings of equal length is the number of locations in which the bits differ. For example, hamming(0b1011101, 0b1001001) == 2 ... . Consider the following Hamming distance code: uint32_t hamming(uint32_t x, uint32_t y) { uint32_t mask, ham_dist = 0; #pragma omp for for (int i = 0; i <= 31; i++) { mask = 1 << i; if ((y & mask) != (x & mask)) { ham_dist++; } } return ham_dist; } Q1.1 Shared/Private Variables 4 Points For each variable below, decide whether it SHOULD be "shared" or "private" among threads. Do not mark a variable as private if it can be safely shared. x y mask shared private shared private9/11/2020 View Submission | Gradescope https://www.gradescope.com/courses/92697/assignments/512318/submissions/40847486 2/24 i Q 1.2 Data Race 2 Points Is a data race on ham_dist possible? Make sure you can explain why or why not. If yes, think about how to fix the code. Based on your answer above, which variables could be incorrect as a result of the data race? Q1.3 False Sharing 1 Point shared private shared private Yes No x y m ask i h am_dist None of the above. There was no data race. [Show More]
Last updated: 3 years ago
Preview 1 out of 24 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 25, 2021
Number of pages
24
Written in
All
This document has been written for:
Uploaded
Apr 25, 2021
Downloads
0
Views
71
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·