def test_single_element_array(self): ary = np.asarray(np.uint32(1234)) arysz = ary.dtype.itemsize s, e = driver.host_memory_extents(ary) self.assertTrue(ary.ctypes.data == s) self.assertTrue(arysz == driver.host_memory_size(ary))
def test_f_contiguous_array(self): ary = np.asfortranarray(np.arange(100).reshape(2, 50)) arysz = ary.dtype.itemsize * np.prod(ary.shape) s, e = driver.host_memory_extents(ary) self.assertTrue(ary.ctypes.data == s) self.assertTrue(arysz == driver.host_memory_size(ary))
def test_c_contiguous_array(self): ary = np.arange(100) arysz = ary.dtype.itemsize * ary.size s, e = driver.host_memory_extents(ary) self.assertTrue(ary.ctypes.data == s) self.assertTrue(arysz == driver.host_memory_size(ary))