Skip to content

Example of using cudaStreamAddCallback #310

Answered by leofang
wensimin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @wensimin this is how cudaStreamAddCallback (deprecated) and cudaLaunchHostFunc are tested:

def cudart_func_stream_callback(use_host_api):
class testStruct(ctypes.Structure):
_fields_ = [
("a", ctypes.c_int),
("b", ctypes.c_int),
("c", ctypes.c_int),
]
def task_callback_host(userData):
data = testStruct.from_address(userData)
assert data.a == 1
assert data.b == 2
assert data.c == 3
return 0
def task_callback_stream(stream, status, userData):
data = testStruct.from_address(userData)
assert data.a == 1
assert data.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wensimin
Comment options

Answer selected by wensimin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #309 on December 17, 2024 18:35.