def run_test(in_file): count = 0 with open(in_file, 'rb') as f: while True: try: args = pickle.load(f) except EOFError: break with nvtx.profile_range('original'): res_orig = cell_connectivity_original(*args) with nvtx.profile_range('current in hexrd'): res_current = cellConnectivity(*args) with nvtx.profile_range('numba'): res_numba = cell_connectivity_numba(*args) with nvtx.profile_range('numba_bis'): res_numba = cell_connectivity_numba(*args) assert np.allclose(res_current, res_orig) assert np.allclose(res_current, res_numba) count += 1
def test_cellcentroids(in_file): count = 0 with open(in_file, 'rb') as f: while True: try: args = pickle.load(f) except EOFError: break with nvtx.profile_range('original'): res_orig = cell_centroids_original(*args) with nvtx.profile_range('current in hexrd'): res_current = cellCentroids(*args) with nvtx.profile_range('numba1'): res_numba1 = cell_centroids_opt1(*args) with nvtx.profile_range('numba1_bis'): res_numba1 = cell_centroids_opt1(*args) with nvtx.profile_range('numba'): res_numba = cell_centroids_numba(*args) with nvtx.profile_range('numba_bis'): res_numba = cell_centroids_numba(*args) assert np.allclose(res_current, res_orig) assert np.allclose(res_current, res_numba1) assert np.allclose(res_current, res_numba) count += 1
def test_ge41rt(in_file): _colors = [ nvtx.colors.cyan, nvtx.colors.magenta, nvtx.colors.yellow, nvtx.colors.black ] count = 0 with open(in_file, 'rb') as f: while True: try: args = pickle.load(f) except EOFError: break with nvtx.profile_range('ge_41rt', color=_colors[(count * 2) % len(_colors)], payload=args[1].shape[0]): res = GE_41RT(*args) with nvtx.profile_range('ge_41rt_bis', color=_colors[(count * 2) % len(_colors)], payload=args[1].shape[0]): res = GE_41RT(*args) with nvtx.profile_range('ge_41rt_opt', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_opt = GE_41RT_opt(*args) with nvtx.profile_range('ge_41rt_newton', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton = GE_41RT_newton(*args) with nvtx.profile_range('ge_41rt_newton_numba', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba = GE_41RT_newton_numba(*args) with nvtx.profile_range('ge_41rt_newton_numba_bis', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba = GE_41RT_newton_numba(*args) with nvtx.profile_range('ge_41rt_newton_numba_full', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_bis', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_exp', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full_exp(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_exp_bis', color=_colors[(count * 2 + 1) % len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full_exp(*args) assert np.allclose(res, res_opt) assert np.allclose(res, res_newton) assert np.allclose(res, res_newton_numba) assert np.allclose(res, res_newton_numba_full) count += 1
def test_ge41rt(in_file): _colors = [nvtx.colors.cyan, nvtx.colors.magenta, nvtx.colors.yellow, nvtx.colors.black] count = 0 with open(in_file, 'rb') as f: while True: try: args = pickle.load(f) except EOFError: break with nvtx.profile_range('ge_41rt', color=_colors[(count*2)%len(_colors)], payload=args[1].shape[0]): res = GE_41RT(*args) with nvtx.profile_range('ge_41rt_bis', color=_colors[(count*2)%len(_colors)], payload=args[1].shape[0]): res = GE_41RT(*args) with nvtx.profile_range('ge_41rt_opt', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_opt = GE_41RT_opt(*args) with nvtx.profile_range('ge_41rt_newton', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton = GE_41RT_newton(*args) with nvtx.profile_range('ge_41rt_newton_numba', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba = GE_41RT_newton_numba(*args) with nvtx.profile_range('ge_41rt_newton_numba_bis', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba = GE_41RT_newton_numba(*args) with nvtx.profile_range('ge_41rt_newton_numba_full', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_bis', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_exp', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full_exp(*args) with nvtx.profile_range('ge_41rt_newton_numba_full_exp_bis', color=_colors[(count*2+1)%len(_colors)], payload=args[1].shape[0]): res_newton_numba_full = GE_41RT_newton_numba_full_exp(*args) assert np.allclose(res, res_opt) assert np.allclose(res, res_newton) assert np.allclose(res, res_newton_numba) assert np.allclose(res, res_newton_numba_full) count += 1