-
Notifications
You must be signed in to change notification settings - Fork 67
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
Remove panic during NVML shutdown #70
base: main
Are you sure you want to change the base?
Conversation
@klueska Could you please make a review for this PR? |
Signed-off-by: Alexandr Bagirov <[email protected]>
3f08a14
to
8b477ac
Compare
@alexbagirov would implementing
We could even make these the default implementations -- although the downside is that we lose the reason for the panic in this case. Adding some global error that can be queried by a client (similar to Note that this kind of wrapper can be implemented at client side without modifying the bindings. My major concern with modifying the function signatures is that this goes against the intent of having this package be bindings of the NVML API. |
I am not in favor of having Init() and Shutdown() return an additional error paramater (as @elezar suggests it goes against the nature of these being 1:1 bindings of the C-based library). That said, I would be fine doing away with the panic in favor of returning NVML_ERROR_UNKNOWN. Some information is obviously lost there, but I think it will be rare that this ever returns an error anyway. |
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.
Since this change was originally proposed there have been a number of changes. We have reworked how the library is represented internally.
I think what I would like to see is extending the Library
interface to include a GetErrors() map[string]error
or GetLastError() error
function that can be called instead of the panic. We would then set the error accordingly instead of panicing. We could add a top-level Option to allow users to revert to the existing behaviour (WithPanicOnShutdownErrors(bool)
).
I could make these changes at some point in the future, but my capacity is currently limited. Would you be able to make these changes?
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.
Hi @alexbagirov
Since the basic ask is covered by #107, would you be willing to update this PR to implement something as described in #70 (review)?
We're using
go-nvml
in production and have concerns about receiving apanic()
during NVML shutdown - this can kill other services depending on the library.This PR removes this
panic()
, although I'm not sure which approach is better. My proposal is to return both Return and error where Return corresponds tonvml.Init()
andnvml.Shutdown()
calls, error corresponds todlOpen()
anddlClose()
.