def _local_load_npy(filename, ddpr, comm): from distarray.localapi import load_npy if len(ddpr): dim_data = ddpr[comm.Get_rank()] else: dim_data = () return proxyize(load_npy(comm, filename, dim_data))
def test_load_nu(self): dim_data_per_rank = nu_test_data expected_indices = [dd[1]['indices'] for dd in dim_data_per_rank] la = load_npy(comm=self.comm, filename=self.output_path, dim_data=dim_data_per_rank[self.rank]) assert_equal(la, self.expected[:, expected_indices[self.rank]])
def test_load_nc(self): dim_data_per_rank = nc_test_data expected_slices = [(slice(None), slice(0, None, 2)), (slice(None), slice(1, None, 2))] la = load_npy(comm=self.comm, filename=self.output_path, dim_data=dim_data_per_rank[self.rank]) assert_equal(la, self.expected[expected_slices[self.rank]])
def test_load_bn(self): dim_data_per_rank = bn_test_data la = load_npy(comm=self.comm, filename=self.output_path, dim_data=dim_data_per_rank[self.rank]) assert_equal(la, self.expected[numpy.newaxis, self.rank])