MCPcopy Create free account
hub / github.com/Kaggle/docker-python / test_cuda_jit

Method test_cuda_jit

tests/test_numba.py:22–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

20
21 @gpu_test
22 def test_cuda_jit(self):
23 from numba import cuda
24
25 x = np.arange(10)
26
27 @cuda.jit
28 def increment_by_one(an_array):
29 pos = cuda.grid(1)
30 if pos < an_array.size:
31 an_array[pos] += 1
32
33 threadsperblock = 32
34 blockspergrid = (x.size + (threadsperblock - 1))
35 self.assertEqual(0, x[0])
36 increment_by_one[blockspergrid, threadsperblock](x)
37 self.assertEqual(1, x[0])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected