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

Feat: added utility function to retrieve CPU index from PID #117

Merged
merged 3 commits into from
Sep 6, 2024
Merged

Feat: added utility function to retrieve CPU index from PID #117

merged 3 commits into from
Sep 6, 2024

Conversation

danielhou0515
Copy link
Collaborator

@danielhou0515 danielhou0515 commented Sep 5, 2024

Added utility function get_current_cpu_index, which optionally takes in a PID arguement. If PID arguement is not given or is "current", then get_current_cpu_index return the CPU index of the current process. Otherwise, the function returns the CPU index of the passed in PID.

Performed manual testing with taskset and checking that the correct CPU index is returned.

Added unit test with sample procfs files and CPU files to mock with.

Closes #89

Copy link
Member

@jaywonchung jaywonchung left a comment

Choose a reason for hiding this comment

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

Thanks for your work! I left a couple comments.

tests/device/cpu/test_socket_detection.py Outdated Show resolved Hide resolved
zeus/device/cpu/__init__.py Outdated Show resolved Hide resolved
zeus/device/cpu/__init__.py Show resolved Hide resolved
zeus/device/cpu/__init__.py Outdated Show resolved Hide resolved
zeus/device/cpu/__init__.py Outdated Show resolved Hide resolved
zeus/device/cpu/__init__.py Outdated Show resolved Hide resolved
tests/device/cpu/test_socket_detection.py Outdated Show resolved Hide resolved
@jaywonchung
Copy link
Member

Format/lint/test CI should pass as well. See: https://github.com/ml-energy/zeus/blob/master/CONTRIBUTING.md#process

Copy link
Member

@jaywonchung jaywonchung left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@jaywonchung jaywonchung merged commit 54e421a into ml-energy:master Sep 6, 2024
2 checks passed
@danielhou0515 danielhou0515 deleted the socketdetection branch September 6, 2024 14:33
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.

CPU socket detection for the current process
2 participants