Beispiel #1
0
 def test_transpose(self):
     
     # To verify non-redundant data movement run this test with NUMBA_TRACE=1
     a = SmartArray(np.arange(16, dtype=float).reshape(4,4))
     b = SmartArray(where='gpu', shape=(4,4), dtype=float)
     c = SmartArray(where='gpu', shape=(4,4), dtype=float)
     event("initialization done")
     transpose(a, b)
     event("checkpoint")
     transpose(b, c)
     event("done")
     self.assertTrue((c.host() == a.host()).all())
Beispiel #2
0
 def test_ufunc(self):
     a = SmartArray(np.int32([42, 8, -5]))
     cfunc = jit(nopython=True)(npyufunc_usecase)
     aa = cfunc(a)
     self.assertIsInstance(aa, SmartArray)
     self.assertPreciseEqual(aa.host(), np.cos(np.sin(a.host())))