From 7356cec4b5b80e9ce914625d39be0ac6cc1b4d86 Mon Sep 17 00:00:00 2001 From: xiyehu2 <35537592+xiyehu2@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:39:00 -0600 Subject: [PATCH] More stuff to lookat --- Python/benchmarking.py | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/Python/benchmarking.py b/Python/benchmarking.py index 0e84932..1dc36e4 100644 --- a/Python/benchmarking.py +++ b/Python/benchmarking.py @@ -6,8 +6,8 @@ import cupy as cp def test(f_idx, t_idx): - paths, off = get_rearrange_paths(f_idx, t_idx) - create_moving_array_reduced(_sig, _table_cp, paths, off) + create_moving_array_reduced(_table_cp, _sig, f_idx, t_idx) + return cp.asnumpy(_sig) def count(paths, path_table, off): @@ -24,8 +24,8 @@ def count(paths, path_table, off): return counter -data = np.load("data/table-half_31.npz", allow_pickle=True) -table = data['path_table'].item() +data = np.load("table/table-half_31_120722.npz", allow_pickle=True) +table = data['table'].item() twzr = data['wfm'].item() static_sig = data['static_sig'] target = data['target'] @@ -38,14 +38,18 @@ for key in table: _table_cp[key] = cp.array(table[key]) n_repeat = 500 -_sig = cp.array(static_sig) -times = np.zeros((nt+1,2)) -filling_ratio = np.zeros((nt+1,2)) -n_move = np.zeros((nt+1,n_repeat)) +total_t = np.zeros((nt+1, 2)) +gpu_t = np.zeros((nt+1, 2)) +cpu_t = np.zeros((nt+1, 2)) +filling_ratio = np.zeros((nt+1, 2)) +n_move = np.zeros((nt+1, 2)) for i in range(nt+1): + _sig = cp.array(static_sig) f_prob = i/nt - calc_t = np.zeros(n_repeat) + t_t = np.zeros(n_repeat) + g_t = np.zeros(n_repeat) + c_t = np.zeros(n_repeat) ratio = np.zeros(n_repeat) nm = np.zeros(n_repeat) print(i, f_prob) @@ -63,24 +67,31 @@ for i in range(nt+1): ) # stuff to save ratio[j] = f_idx.size / nt - calc_t[j] = b.gpu_times + b.cpu_times + g_t[j] = b.gpu_times + c_t[j] = b.cpu_times + t_t[j] = b.gpu_times + b.cpu_times paths, off = get_rearrange_paths(f_idx, t_idx) nm[j] = count(paths, _table_cp, off) # n_move[i,0] = np.mean(nm) # n_move[i,1] = np.var(nm) - n_move[i] = nm - times[i,0] = np.mean(calc_t) - times[i,1] = np.var(calc_t) + n_move[i,0] = np.mean(nm) + n_move[i,1] = np.var(nm) + gpu_t[i,0] = np.mean(g_t) + gpu_t[i,1] = np.var(g_t) + cpu_t[i,0] = np.mean(c_t) + cpu_t[i,1] = np.var(c_t) + total_t[i,0] = np.mean(t_t) + total_t[i,1] = np.var(t_t) filling_ratio[i,0] = np.mean(ratio) filling_ratio[i,1] = np.var(ratio) np.savez( - f"data/reduced-benchmark_{nt}-half.npz", + f"data/120722_benchmark_{nt}-half_wfm-only.npz", wfm=twzr, target=target, filling_ratio=filling_ratio, - times=times, + times=[gpu_t, cpu_t, total_t], n_move=n_move ) -- GitLab