Skip to content

[BUG]: rmm.pylibrmm.stream.Stream objects are no longer hashable #2130

@TomAugspurger

Description

@TomAugspurger

Describe the bug

The Python Stream objects are no longer hashable after the change in https://github.com/rapidsai/rmm/pull/2110/files#diff-83f78faf97018ac3ad1e8b43d42eb56d0a6acc442b499a75fb04a7838301174eR127 added Stream.__eq__ but not Stream.__hash__. See https://docs.python.org/3/reference/datamodel.html#object.__hash for background.

Steps/Code to reproduce bug

from rmm.pylibrmm.stream import Stream


stream = Stream()
hash(stream)

Expected behavior

No exception.

Additional context

rapidsai/rapidsmpf#627 (comment). Streams being hashable is helpful so that they can be used in sets and keys as dictionaries, assuming streams are mutable.

The returned hash should uniquely identify the CUDA stream. Given that, I think, rmm.pylibrmm.cuda_stream.CudaStream objects are always owning, then using id(self) to get the memory address of the Python object ought to be sufficient (it'd be a different story if we had stream views in python, since they arguably should hash the same).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions