def test_fromndarray_like(self): """Can we build an array using fromndarray_like?""" d = Distribution.from_shape(comm=self.comm, shape=(16, 16), dist=('c', 'b')) la0 = LocalArray(d, dtype='int8') la1 = localarray.fromndarray_like(la0.ndarray, la0) assert_localarrays_equal(la0, la1, check_dtype=True)
def test_copy_bn(self): distribution = Distribution.from_shape(comm=self.comm, shape=(16, 16), dist=('b', 'n')) a = LocalArray(distribution, dtype=np.int_) a.fill(11) b = a.copy() assert_localarrays_equal(a, b, check_dtype=True)
def test_view_bn(self): d = Distribution.from_shape((16, 16), dist=('b', 'n'), comm=self.comm) a = LocalArray(d, dtype=np.int32) a.fill(11) b = a.view() assert_localarrays_equal(a, b) self.assertEqual(id(a.local_data), id(b.local_data))
def test_copy_cbc(self): distribution = Distribution(self.ddpr[self.comm.Get_rank()], comm=self.comm) a = LocalArray(distribution, dtype=np.int_) a.fill(12) b = a.copy() assert_localarrays_equal(a, b, check_dtype=True)
def test_copy_cbc(self): distribution = Distribution(comm=self.comm, dim_data=self.ddpr[self.comm.Get_rank()]) a = LocalArray(distribution, dtype=np.int_) a.fill(12) b = a.copy() assert_localarrays_equal(a, b, check_dtype=True)