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

Remove staged threads, immediately create thread objects #5843

Draft
wants to merge 690 commits into
base: master
Choose a base branch
from

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented Apr 11, 2022

  • flyby: more noexcept for combined_tagged_state

hkaiser and others added 30 commits January 19, 2022 19:59
Replace std::distance with parallel::detail::distance
Replace include/datapar.hpp with parallel/datapar.hpp
# Conflicts:
#	libs/core/hardware/include/hpx/hardware/cpuid/msvc.hpp
Support for data-parallelism for find algorithms
are being built as OBJECT libraries. In this case the fallback is to
build STATIC (whole-archive) libraries instead.
5727: Moving compression plugins to components directory r=hkaiser a=hkaiser

- flyby: removing obsolete #include files


Co-authored-by: Hartmut Kaiser <[email protected]>
5743: Add check for MPICH and set the correct env to suport multi-threaded r=hkaiser a=diehlpk

## Proposed Changes

  - If MPICH is used we set `export MPICH_MAX_THREAD_SAFETY=multiple` to activate multithreaded MPI.

## Any background context you want to provide?

This might solve some hanging, we experienced with MPI recently.

Note, this has to happen before `MPI_Init` is being called.

Co-authored-by: Patrick <[email protected]>
Remove obsolete files related to cpuid, etc.
Replace std::distance with parallel::detail::distance
Replace include/datapar.hpp with parallel/datapar.hpp
Support for data-parallelism for adjacent find
Workaround for CMake/Ninja generator OOM problem
wait_xxx_nothrow functions return whether one of the futures is exceptional
- flyby: more noexcept for combined_tagged_state
@hkaiser hkaiser force-pushed the no_staged_threads branch from 0db8264 to 25a961e Compare April 11, 2022 02:01
@hkaiser
Copy link
Member Author

hkaiser commented Apr 13, 2022

This might not be viable after all. All threads that are created immediately either use a cached thread object (with an allocated stack) or create a new thread object (without an associated stack) otherwise. This way, even threads that do not require immediate execution might end up with an allocated stack segment (if the thread object was retrieved from the cache).

This is prone to causing memory issues as too many threads/stacks may be created (the tests here expose exactly that problem).

For now, I don't have any fool-proof idea on how to decide whether a thread needs to run right away, so that it might benefit from being initialized from the thread object cache.

The only solution I see is more intrusive: in addition (or instead of) caching the thread objects, we will have to cache the stack segments. That would allow to minimize the number of created stack segments to the minimal number of concurrently active threads.

For now, I will convert this PR to 'daft' and get back to it after V1.8 has been released.

@hkaiser hkaiser marked this pull request as draft April 13, 2022 19:36
@hkaiser hkaiser modified the milestones: 1.8.0, 1.9.0 Apr 13, 2022
@hkaiser hkaiser modified the milestones: 1.9.0, 1.8.1 Jul 5, 2022
@gonidelis
Copy link
Contributor

What is the status of this PR? Should we push it for 1.10 instead?

@hkaiser
Copy link
Member Author

hkaiser commented Jan 31, 2023

What is the status of this PR? Should we push it for 1.10 instead?

Yes, let's move this to the next milestone.

@hkaiser hkaiser removed this from the 1.9.0 milestone Jan 31, 2023
@gonidelis gonidelis added this to the 1.10.0 milestone Feb 1, 2023
@hkaiser hkaiser modified the milestones: 1.10.0, 1.11.0 May 3, 2024
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.

10 participants