gpt4 book ai didi

python - PyCUDA 内核计时错误

转载 作者:太空宇宙 更新时间:2023-11-03 19:31:22 25 4
gpt4 key购买 nike

足够简单

start=cuda.Event()
func(args,block=blockdims)
cuda.memcpy_dtoh(d,h)
end=cuda.Event()

dur=start.time_till(end)
print dur

但我收到此错误

File "gpu.py", line 161, in gpu_test
dur=start.time_till(end)
pycuda._driver.LogicError: cuEventElapsedTime failed: invalid handle

据我所知,这是 docs正确的用法。有人知道我做错了什么吗?

最佳答案

看看SimpleSpeedTest.py :

start=cuda.Event()
end=cuda.Event()

start.record() # start timing
func(args,block=blockdims)
cuda.memcpy_dtoh(d,h)
end.record() # end timing
# calculate the run length
end.synchronize()
millis = start.time_till(end)
print millis

关于python - PyCUDA 内核计时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5706192/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com