Skip to content

Example of using cudaStreamAddCallback #309

@wensimin

Description

@wensimin

I try to register a callback on a stream, and the following code reports an error

def stream_over(*argv):
    print(f"over !")

 cudart.cudaStreamAddCallback(stream, stream_over, None, 0)
nvidia-dev-1  |   cudart.cudaStreamAddCallback(stream._stream, stream_over, None, 0)
nvidia-dev-1  |   File "cuda/bindings/runtime.pyx", line 15344, in cuda.bindings.runtime.cudaStreamAddCallback
nvidia-dev-1  |   File "cuda/bindings/runtime.pyx", line 4054, in cuda.bindings.runtime.cudaStreamCallback_t.__cinit__
nvidia-dev-1  | TypeError: an integer is required

In the documentation I found this class cudaStreamCallback_t,but I don't know how to use it correctly
Any help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions