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

Fix initialization of global_num_tasks in parallel_executor #4093

Merged
merged 2 commits into from Oct 1, 2019

Conversation

msimberg
Copy link
Contributor

Fixes deadlocks typically seen in the 1d_stencil example caused by yielding while initializing a static variable. Details in commit message.

Also initializes global_num_tasks in the parallel_executor based on the number of threads in the current pool (or default pool if not on an HPX thread).

msimberg and others added 2 commits September 30, 2019 10:19
Initializing the static variable global_num_tasks with
hpx::get_os_thread_count() could lead to deadlocks when accessing the
configuration option which contains the number of OS threads is contended. In
this case the thread can be suspended while holding a lock for the static
variable. This makes the variable non-static and gets the number of threads
from the thread pool if inside an HPX thread. Otherwise it gets the number of
threads for the default pool.
Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

@msimberg msimberg merged commit 118bf2e into STEllAR-GROUP:master Oct 1, 2019
@msimberg msimberg deleted the fix-parallel-executor branch October 1, 2019 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants