Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelized the CALIC implementation #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

siddharths2710
Copy link

Filled various lines of code with #pragmas while taking care of race conditions and thread-safety.

Example:

#pragma omp parallel for private(temp) reduction(+:sum)
for (int i = 0; i < ns; i++) {
temp = pow(15.0, 0.4 * (double)(-i-1)); //prevent false sharing and double indirect addressing overhead
freqPercentage[i] = temp;
sum += temp;
}

Here the variable temp is private to every thread created to run a portion of the for loop, and is computed in parallel with other iterations. To prevent racing, all the temp values generated by the threads are added one by one to the variable sum.

Filled various lines of code with #pragmas and added -fopenmp switch in Makefile
Check out the cumulative frequency array. Redundant computations are more parallelizable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant