def setUp(self): if get_rank() == 0: # h5 filter test n = 11 size = (n, 13, 21, 3) A = np.random.randint(0, 120, size, np.uint8) f = h5py.File('h5_test_filter.h5', "w") f.create_dataset('test', data=A) f.close() # test_csv_cat1 data = ("2,B,SA\n" "3,A,SBC\n" "4,C,S123\n" "5,B,BCD\n") with open("csv_data_cat1.csv", "w") as f: f.write(data) # test_csv_single_dtype1 data = ("2,4.1\n" "3,3.4\n" "4,1.3\n" "5,1.1\n") with open("csv_data_dtype1.csv", "w") as f: f.write(data) # test_np_io1 n = 111 A = np.random.ranf(n) A.tofile("np_file1.dat")
def setUp(self): if get_rank() == 0: # h5 filter test n = 11 size = (n, 13, 21, 3) A = np.random.randint(0, 120, size, np.uint8) f = h5py.File('h5_test_filter.h5', "w") f.create_dataset('test', data=A) f.close()
def test_np_io3(self): def test_impl(A): if get_rank() == 0: A.tofile("np_file_3.dat") hpat_func = hpat.jit(test_impl) n = 111 A = np.random.ranf(n) hpat_func(A) if get_rank() == 0: B = np.fromfile("np_file_3.dat", np.float64) np.testing.assert_almost_equal(A, B)
def test_write_csv_parallel1(self): def test_impl(n, fname): df = pd.DataFrame({'A': np.arange(n)}) df.to_csv(fname) hpat_func = hpat.jit(test_impl) n = 111 hp_fname = 'test_write_csv1_hpat_par.csv' pd_fname = 'test_write_csv1_pd_par.csv' hpat_func(n, hp_fname) test_impl(n, pd_fname) self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) # TODO: delete files if get_rank() == 0: pd.testing.assert_frame_equal(pd.read_csv(hp_fname), pd.read_csv(pd_fname))
def test_impl(A): if get_rank() == 0: A.tofile("np_file_3.dat")