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

Default TreadPool size to number of physical cores #125963

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

malfet
Copy link
Contributor

@malfet malfet commented May 10, 2024

TODO: Some benchmarks

@malfet malfet added the topic: performance topic category label May 10, 2024
@malfet malfet requested review from albanD and janeyx99 May 10, 2024 21:10
Copy link

pytorch-bot bot commented May 10, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/125963

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Unrelated Failure

As of commit 230082a with merge base 538877d (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

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

I do believe this change is for the better but I'm not an expert and so I cannot ascertain that is always better. @malfet what's the plan on the benchmarks haha

@facebook-github-bot
Copy link
Contributor

@janeyx99 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Skylion007
Copy link
Collaborator

Will this work properly for partial CPU allocations on SLURM clusters?

@msaroufim
Copy link
Member

This might be a noop concern but was also curious how a change like this affects the performance of distributed jobs

@malfet
Copy link
Contributor Author

malfet commented May 14, 2024

Will this work properly for partial CPU allocations on SLURM clusters?

I can only hope for it :)

@Skylion007
Copy link
Collaborator

I'm just worried becaues there might be say 16 logical cores, and only 4 are available to the job meaning that the cores become over-subscribed.

@janeyx99
Copy link
Contributor

@Skylion007 that is the exact type of problem we're attempting to fix, as processors usually means threads and cores means actual cores (what we're thinking). @malfet's PR will be strictly an improvement on that front as written compared to before the change.

@gajjanag
Copy link

LGTM - tested both a hyperthreaded multicore and non hyperthreaded multicore. It gives the correct thread count now.

@sanchitintel
Copy link
Collaborator

sanchitintel commented May 15, 2024

tested both a hyperthreaded multicore and non hyperthreaded multicore. It gives the correct thread count now.

Hi @gajjanag, can you please clarify if you meant you were getting incorrect counts earlier with torch.get_num_threads?
For instance, even with HyperThreading enabled on an Intel machine, I only see physical core count with torch.get_num_threads at my end (without this patch).

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

8 participants