1

Simple enough

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

dur=start.time_till(end)
print dur

But I'm getting this error

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

This is as far as I can tell from the docs the correct usage. Anyone got any idea what I'm doing wrong?

1 Answer 1

1

Take a look at 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
Sign up to request clarification or add additional context in comments.

1 Comment

This is how is should be done. A pair of record events need to be inserted in the stream around the action being timed. Synchronizing the stream will make the host wait until the stream is idle, which also ensures both record events have been processed by the driver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.