Skip to content

Conversation

tjohnson31415
Copy link
Collaborator

@tjohnson31415 tjohnson31415 commented Sep 26, 2025

Description

A couple of improvements related to setting threading based on cpu count:

  • add VLLM_SPYRE_NUM_CPUS configuration to set the cpu count and skip the detection steps
    • this is useful if detection is not working but you want just 1 configuration to set and to still have vllm-spyre scale by the worker count
  • adds psutil as another way to auto-detect CPUs by counting "physical" cores only instead of logical cores
    • in multi-threaded CPU bottlenecks, using logical cores may be inefficient
    • cpu detection is meant to be best-effort so I didn't add psutil as a dependency (though it does currently come in through the accelerate sub-dependency of the fp8 extras package)

Related Issues

#483

Copy link

👋 Hi! Thank you for contributing to vLLM support on Spyre.
Just a reminder: Make sure that your code passes all the linting checks, otherwise your PR won't be able to be merged. To do so, first install the linting requirements, then run format.sh and commit the changes. This can be done with uv directly:

uv sync --frozen --group lint --active --inexact

Or this can be done with pip:

uv pip compile --group lint > requirements-lint.txt
pip install -r requirements-lint.txt
bash format.sh

Now you are good to go 🚀

f"Detected {cpu_count} CPUs from " \
"psutil.cpu_count(logical=False)"
except ImportError:
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we log here saying that psutil can be used if it's installed?

I'm also not opposed to adding it as a dependency, it seems very well maintained

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is well maintained, but is also OS-dependent compiled code. We could list out all of the platform_systems it does support, but 🤷. I wish there was a configuration like "try to install by default but don't stop the install if unable" 😅

I'll add a log message indicating the option to install it though!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, perhaps that's a better option since we have to support non x86 platforms.

@maxdebayser
Copy link
Collaborator

bot:test

@tjohnson31415
Copy link
Collaborator Author

The spyre-ci failure was unrelated to my changes. It was fixed in #491, so I rebased this PR on main.

@tjohnson31415
Copy link
Collaborator Author

bot:test

@tjohnson31415 tjohnson31415 merged commit c94276c into main Oct 3, 2025
20 checks passed
@tjohnson31415 tjohnson31415 deleted the thread-updates branch October 3, 2025 14:59
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.

3 participants