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

[local-worker-mgr] Force using 'spawn' for process creation #307

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

mtrofin
Copy link
Collaborator

@mtrofin mtrofin commented Oct 17, 2023

It turns out tflite conversion uses under the hood numexpr. Numexpr spawns a bunch of threads at module init. So if the main process converts a model, then forks and the resulting processes try converting a model, too, the state the forked processes work on appears like having been initialized. They hang waiting for results.

Using spawn and not forkserver because the latter still runs this risk. Spawning may be slower, but in the grand schema of things (training time), slightly larger init time is not that problematic.

It turns out tflite conversion uses under the hood numexpr. Numexpr
spawns a bunch of threads at module init. So if the main process
converts a model, then forks and the resulting processes try converting
a model, too, the state the forked processes work on appears like having
been initialized. They hang waiting for results.

Using `spawn` and not `forkserver` because the latter still runs this
risk. Spawning may be slower, but in the grand schema of things
(training time), slightly larger init time is not that problematic.
@mtrofin mtrofin merged commit 25c5254 into google:main Oct 18, 2023
15 checks passed
@mtrofin mtrofin deleted the spawn branch October 18, 2023 04:00
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.

None yet

2 participants