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

Remove need for newDynamicLibraryFunc #111

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

klueska
Copy link
Contributor

@klueska klueska commented Apr 4, 2024

With the introduction of the refcount we no longer need to set library.dl to nil to track when it is loaded or unloaded. Instead we can use the refcount directly.

@klueska klueska requested a review from elezar April 4, 2024 12:31
}

libnvml.dl = dl.New(o.path, o.flags)
Copy link
Member

Choose a reason for hiding this comment

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

Note that libnvml still has a path member. Should we set that to o.path here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Ideally we would drop it, but it's used in error messages and there is no way to pull it out of the dl field since it is an interface and not a concrete type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

newDynamicLibrary: func(path string, flags int) dynamicLibrary {
return dl.New(path, flags)
},
path: defaultNvmlLibraryName,
Copy link
Member

Choose a reason for hiding this comment

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

Question about the path member below.

With the introduction of the refcount we no longer need to set library.dl to
nil to track when it is loaded or unloaded. Instead we can use the refcount
directly.

Signed-off-by: Kevin Klues <[email protected]>
@klueska klueska merged commit 65a28b0 into NVIDIA:main Apr 8, 2024
4 checks passed
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.

2 participants