-
Notifications
You must be signed in to change notification settings - Fork 198
Add support for processing accelerators hardware #385
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlorenzofr I absolutely love your ambition :) And overall, the quality of your PR is outstanding, thank you!
That said, I'm going to request that you remove the filtering functionality from this PR and add the filtering functionality in a separate follow-up PR? That way I can evaluate that separately. The reason is because none of the other ghw
functions have a filter parameter so adding one just for the accelerator package would be mis-aligned.
Of course I can, I'll start making the changes and submit them in 2 different PRs. 😉 |
50b8a40
to
55dc8f3
Compare
I was thinking... this PR will detect processing accelerators hardware, but there are hardware from some vendors that are not categorized as processing accelerators, but as 3D controllers. Should we add that hardware in the default detection until the custom filters feature is added? |
@mlorenzofr Yes, absolutely. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlorenzofr thank you sir! a few suggested changes inline :)
55dc8f3
to
abffb83
Compare
I've added all the suggestions, I loved them ❤️ . Thanks a lot for the contributions. 🙏 Additionally, since we've added discovery for more hardware, I've added an additional test for Nvidia cards. |
pkg/accelerator/accelerator.go
Outdated
|
||
type Info struct { | ||
ctx *context.Context | ||
AcceleratorDevices []*AcceleratorDevice `json:"devices"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny request... let's call the field Devices
instead of AcceleratorDevices
since the "Accelerator" part is assumed.
c036151
to
58df8e5
Compare
I forgot to update the documentation, I fixed it the commit 58df8e5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! :) Thank you so much @mlorenzofr!
Signed-off-by: Manuel Lorenzo <mlorenzofr@redhat.com>
58df8e5
to
25c02a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eccezionale :)
@mlorenzofr welcome to the |
Nice work indeed! |
LOL, probably because I made a comment in Italian earlier and that triggered your notifications :P |
) | ||
|
||
func main() { | ||
accel, err := ghw.Accelerator() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to extend (maybe later?) this API to accept additive user-provided filters?
I'm referring to the wide variety of devices out there and how they present themselves on PCI bus.
By "additive" filter I mean
- users cannot rule out a device
ghw
is really sure it's an accelerator (this meansghw
must be conservative in the core logic, which I think it's good anyway) - users can opt-in devices if they know better than
ghw
for whatever reasons (maybe oldghw
version, maybe rare/custom devices)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. @mlorenzofr was going to submit a PR adding that filtering functionality. He originally added it in this PR but I asked him to separate it out into a new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect! I'll be on the lookout this time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we'll extend it, but in a different PR. @jaypipes asked to separate it from the original development so he could analyze it step by step.
Welcome back, btw 😉
This PR adds support for detection of processing accelerators to the library. Please take a look.
This fixes #383