Example #1
0
 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))
Example #2
0
 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))
Example #3
0
 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))
Example #4
0
 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))
Example #5
0
 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))
Example #6
0
 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))