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

WASM multithreading starts 4 threads regardless of available CPU cores #4972

Closed
vladmandic opened this issue Apr 22, 2021 · 5 comments · Fixed by #5727
Closed

WASM multithreading starts 4 threads regardless of available CPU cores #4972

vladmandic opened this issue Apr 22, 2021 · 5 comments · Fixed by #5727
Assignees
Labels

Comments

@vladmandic
Copy link
Contributor

New way of calculating WASM threads seems to default to 4 regardless of number of actual CPU cores

I have Intel i7 with 6 physical cores (12 logical cores) and AFAIK intention was to use logical cores / 2,
but I end up with 4 WASM threads which is the default.

This was working fine in TFJS 3.3.0 (WASM was starting 6 threads as expected),
then WASM multithreading was broken in 3.4.0
and now it's working, but with reduced number of threads.

Environment: TFJS 3.5.0 with Edge/Chromium 90 on Windows 10 with WASM backend (SIMD and MultiThreading enabled)

@vladmandic vladmandic added the type:bug Something isn't working label Apr 22, 2021
@vladmandic
Copy link
Contributor Author

cc @mattsoulanille as this is likely related to #4957

@mattsoulanille
Copy link
Member

mattsoulanille commented Apr 23, 2021

Definitely related to #4957, but this is intentional. The wasm backend's threadpool uses logical_cores / 2 threads, but is capped to 4 threads total (so I used the same logic in the PTHREAD_POOL_SIZE flag). It's surprising to me that it was creating more than four in earlier versions.

Perhaps it shouldn't be capped at all. What do you think @lina128?

Ideally, you'd be able to control the number of threads created via a flag. This is not supported yet, but there was some discussion in #4957 about adding support.

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please @mention us if this needs more attention.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants