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

add global conftest and error on unfreed cuda tensors #266

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pstjohn
Copy link
Collaborator

@pstjohn pstjohn commented Oct 7, 2024

Implements a new module-level fixture for cleaning up cuda artifacts, and moves all existing pytest fixtures to the function scope.

Comment on lines 35 to 36
if raise_on_cuda_tensor:
raise AssertionError(f"Found a CUDA tensor in memory after test: {obj_str}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Deleting the string representation of the data won't actually delete the underlying data. You have to somehow get a reference to the underlying data and free that. Ofc. if there are any other references to the data, that'd setup a potential use-after-free error. So what you'd really want to do is gather all references and delete those, then let the GC free the underlying memory after observing no more references to it.

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