Skip to content

Conversation

@ritvikrao
Copy link
Collaborator

To support NAMD, we need the ability for reconverse users to control the scheduler and do extra setup (aside from Cmi_startfn) on their own, if they choose. These changes re-work the thread launches to work more like old Converse, where rank 0 uses the current thread instead of launching a new thread. All cleanup occurs in ConverseExit, including comm backend cleanup. This also allows the scheduler's stop flag to be reset, allowing for repeated scheduler calls.

@ritvikrao ritvikrao marked this pull request as ready for review October 27, 2025 13:53
@ritvikrao ritvikrao requested a review from JiakunYan October 27, 2025 13:53
@JiakunYan
Copy link
Collaborator

@lvkale I’d like to loop you in to discuss this PR. Ritvik noticed that the current Charm++ code calls ConverseExit in two different ways:

  1. The ck exit handler always calls ConverseExit on all PEs.
  2. NAMD sets both usched and initret to 1, and its main thread calls ConverseExit at the very end.

Because of these two usage patterns, ConverseExit has to be implemented as a real exit function, as done in this PR. In this implementation, all worker threads with rank ≥ 1 enter an infinite loop at the end of ConverseExit, waiting to be terminated, while the rank 0 thread eventually calls exit, allowing the OS to kill all threads.

I’m not sure this is the most elegant way to handle program termination. What are your thoughts?

@lvkale
Copy link

lvkale commented Oct 30, 2025

This is a major-ish change. Would be good to get some old timers to review. Will you please tag Sam and Eric Bohm (and maybe Evan)?

@ritvikrao
Copy link
Collaborator Author

For @ericjbohm and others, I was hoping you would try these changes on NAMD and see if this works for you. I also would appreciate feedback on the design of the exit procedure (which I have to make compatible with existing Charm++).

@ritvikrao ritvikrao requested review from lvkale and stwhite91 November 2, 2025 15:16
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.

4 participants