File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
numba_cuda/numba/cuda/tests/cudadrv Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,38 @@ def kernel(arg):
6969 # self.assertEqual(counter, 0) # We don't have a way to explicitly
7070 # evict kernel and its modules at the moment.
7171
72+ def test_two_kernels (self ):
73+ counter = 0
74+
75+ def setup (mod , stream ):
76+ nonlocal counter
77+ counter += 1
78+
79+ def teardown (mod , stream ):
80+ nonlocal counter
81+ counter -= 1
82+
83+ lib = CUSource ("" , setup_callback = setup , teardown_callback = teardown )
84+
85+ @cuda .jit (link = [lib ])
86+ def kernel ():
87+ pass
88+
89+ @cuda .jit (link = [lib ])
90+ def kernel2 ():
91+ pass
92+
93+ kernel [1 , 1 ]()
94+ self .assertEqual (counter , 1 )
95+ kernel2 [1 , 1 ]()
96+ self .assertEqual (counter , 2 )
97+
98+ # del kernel
99+ # gc.collect()
100+ # cuda.current_context().deallocations.clear()
101+ # self.assertEqual(counter, 0) # We don't have a way to explicitly
102+ # evict kernel and its modules at the moment.
103+
72104
73105class TestModuleCallbacks (CUDATestCase ):
74106
You can’t perform that action at this time.
0 commit comments