Skip to content

Henryh/yemen crop#270

Open
Hgherzog wants to merge 11 commits intomasterfrom
henryh/yemen-crop
Open

Henryh/yemen crop#270
Hgherzog wants to merge 11 commits intomasterfrom
henryh/yemen-crop

Conversation

@Hgherzog
Copy link
Collaborator

No description provided.

@Hgherzog Hgherzog marked this pull request as ready for review January 16, 2026 23:36
def init_mp() -> None:
"""Set start method to preload and configure forkserver preload."""
multiprocessing.set_start_method("forkserver", force=True)
multiprocessing.set_forkserver_preload(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we keep the preload, in case ? It makes it much faster if forkserver is used.

def init_mp(context: str | None = None, sharing_strategy: str | None = None) -> None:
"""Set start method for multiprocessing.

Uses RSLEARN_MULTIPROCESSING_CONTEXT if provided, else defaults to forkserver.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this could be clarified a bit. Also context does not seem like the correct name, should it be mp_start_method instead? Something like:

Args:
    mp_start_method: the multiprocessing start method to set. If not set, use the RSLEARN_MULTIPROCESSING_CONTEXT if provided. Otherwise, it defaults to forkserver.
    sharing_strategy: the torch sharing strategy to set. If not set, use the MP_SHARING_STRATEGY_ENV_VAR if provided. Otherwise, the sharing strategy is not changed.



if __name__ == "__main__":
multiprocessing.set_start_method("forkserver")
Copy link
Collaborator

Choose a reason for hiding this comment

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

init_mp should be called here since we only call it in the entrypoints, not in the main functions. Moving init_mp into the main function in rslearn_main.py could be okay too.

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.

2 participants