def test_flat_file_save_load_with_file_object(self): save_dnpy(self.output_path, self.larr0) with open(self.output_path, 'rb') as fp: larr1 = load_dnpy(comm=self.comm, file=fp) self.assertTrue(isinstance(larr1, LocalArray)) assert_allclose(self.larr0, larr1)
def _local_load_dnpy_names(comm, fnames): from distarray.localapi import load_dnpy fname = fnames[comm.Get_rank()] local_arr = load_dnpy(comm, fname) return proxyize(local_arr)
def test_flat_file_save_load_with_filename(self): save_dnpy(self.output_path, self.larr0) larr1 = load_dnpy(comm=self.comm, file=self.output_path) self.assertTrue(isinstance(larr1, LocalArray)) assert_allclose(self.larr0, larr1)
def _local_load_dnpy(comm, fname_base): from distarray.localapi import load_dnpy fname = "%s_%s.dnpy" % (fname_base, comm.Get_rank()) local_arr = load_dnpy(comm, fname) return proxyize(local_arr)