def test_zeros(self): size = self.comm_size nrows = size * 3 d = Distribution.from_shape(comm=self.comm, shape=(nrows, 20)) a = localarray.zeros(d) expected = np.zeros((nrows // size, 20)) assert_array_equal(a.ndarray, expected)
def test_create_comm_with_list(self): """ Test that create_comm_with_list() works correctly. """ nodes = list(range(self.max_size)) comm = create_comm_with_list(nodes) if comm == MPI.COMM_NULL: # Only proceed when not COMM_NULL. return # Run a simple test to confirm this comm works. size = len(nodes) nrows = size * 3 d = Distribution.from_shape(comm=comm, shape=(nrows, 20)) a = zeros(d) expected = numpy.zeros((nrows // size, 20)) assert_array_equal(a.ndarray, expected) # Cleanup. comm.Free()