<s> from __future__ import absolute_import , print_function <EOL> import numpy as np <EOL> from numba import cuda <EOL> from numba . cuda . testing import unittest <EOL> class TestCudaEvent ( unittest . TestCase ) : <EOL> def test_event_elapsed ( self ) : <EOL> N = <NUM_LIT:32> <EOL> dary = cuda . device_array ( N , dtype = np . double ) <EOL> evtstart = cuda . event ( ) <EOL> evtend = cuda . event ( ) <EOL> evtstart . record ( ) <EOL> cuda . to_device ( np . arange ( N ) , to = dary ) <EOL> evtend . record ( ) <EOL> evtend . wait ( ) <EOL> evtend . synchronize ( ) <EOL> evtstart . elapsed_time ( evtend ) <EOL> def test_event_elapsed_stream ( self ) : <EOL> N = <NUM_LIT:32> <EOL> stream = cuda . stream ( ) <EOL> dary = cuda . device_array ( N , dtype = np . double ) <EOL> evtstart = cuda . event ( ) <EOL> evtend = cuda . event ( ) <EOL> evtstart . record ( stream = stream ) <EOL> cuda . to_device ( np . arange ( N ) , to = dary , stream = stream ) <EOL> evtend . record ( stream = stream ) <EOL> evtend . wait ( stream = stream ) <EOL> evtend . synchronize ( ) <EOL> evtstart . elapsed_time ( evtend ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
