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

r.accumulate: Add parallelization #988

Closed
wants to merge 2 commits into from

Conversation

shreyasudaya
Copy link

OpenMP parallelization added.
To do:
Test timing and parallelization. This along with r.horizon is where I am confused about testing.

@neteler neteler added the enhancement New feature or request label Dec 7, 2023
@HuidaeCho HuidaeCho changed the title Add parallelization for r.accumulate. r.accumulate: Add parallelization Dec 7, 2023
@HuidaeCho
Copy link
Member

@shreyasudaya Have you actually compiled and tested your parallelized code? Parallelization was not in my mind at all when I first wrote this module and I'm not so sure if simply adding parallel for loops will correctly parallelize all the algorithms. Just tested this PR and I wasn't able to compile it:

calculate_lfp_iterative.c: In function ‘calculate_lfp_iterative’:
calculate_lfp_iterative.c:79:52: error: ‘j’ undeclared (first use in this function)
   79 | #pragma omp parallel for schedule(dynamic) private(j)
      |                                                    ^
calculate_lfp_iterative.c:79:52: note: each undeclared identifier is reported only once for each function it appears in

j is declared inside the for loop and isn't visible to OMP outside of it.

@HuidaeCho HuidaeCho self-assigned this Dec 7, 2023
Copy link
Member

@HuidaeCho HuidaeCho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't think it's straightforward to parallelize this module because many things are not thread-safe. One easy example is push_up(). When multiple threads try to allocate memory at the same time within trace_up(), a race condition will occur. Parallelization of any algorithms in this module would require a lot more work, if possible at all, and, unfortunately, I have to suggest closing this PR.

@petrasovaa
Copy link
Contributor

@HuidaeCho, would you have any suggestion for a different tool that could be easier to implement parallelization for? I don't think there are many low hanging fruits, but maybe v.surf.idw?

@HuidaeCho
Copy link
Member

Closing this PR.

@HuidaeCho HuidaeCho closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants