Skip to content

Commit

Permalink
Update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Routhleck committed Dec 12, 2023
1 parent 66724b1 commit b5c5e35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
heter_data = bm.as_jax(rng.random(csr_indices.shape))
weight = heter_data

groundtruth = bm.as_jax(vector, dtype=float) @ bm.as_jax(dense)
# groundtruth = bm.as_jax(vector, dtype=float) @ bm.as_jax(dense)



Expand Down Expand Up @@ -261,6 +261,8 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
return taichi_aot_time1, taichi_aot_time2, taichi_aot_time3, taichi_aot_time4, taichi_aot_time5,\
brainpy_time1, brainpy_time2, brainpy_time3, brainpy_time4, brainpy_time5, speedup

PATH = os.path.dirname(os.path.abspath(__file__))

# init dataframe
df = pd.DataFrame(columns=['s', 'p', 'backend', 'values type', 'events type', 'transpose',
'taichi aot time1(ms)', 'taichi aot time2(ms)', 'taichi aot time3(ms)', 'taichi aot time4(ms)', 'taichi aot time5(ms)',
Expand All @@ -279,7 +281,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
df.loc[df.shape[0]] = [_s, _p, 'cpu', _values_type, _events_type, _transpose,
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
df.to_csv('event_csrmv_cpu.csv', index=False)
df.to_csv(f'{PATH}/event_csrmv_cpu.csv', index=False)

if (bm.get_platform() == 'gpu'):
for _s in s:
Expand All @@ -293,7 +295,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
df.loc[df.shape[0]] = [_s, _p, 'gpu', _values_type, _events_type, transpose,
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
df.to_csv('event_csrmv_gpu.csv', index=False)
df.to_csv(f'{PATH}/event_csrmv_gpu.csv', index=False)

# if (bm.get_platform() == 'gpu'):
# for _s in s:
Expand Down
8 changes: 4 additions & 4 deletions brainpy/_src/math/sparse/tests/csrmv_taichi_VS_csrmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
return taichi_aot_time1, taichi_aot_time2, taichi_aot_time3, taichi_aot_time4, taichi_aot_time5,\
brainpy_time1, brainpy_time2, brainpy_time3, brainpy_time4, brainpy_time5, speedup

bm.set_platform('cpu')
block_dim = 64
PATH = os.path.dirname(os.path.abspath(__file__))

# init dataframe
df = pd.DataFrame(columns=['s', 'p', 'backend', 'values type', 'events type', 'transpose',
'taichi aot time1(ms)', 'taichi aot time2(ms)', 'taichi aot time3(ms)', 'taichi aot time4(ms)', 'taichi aot time5(ms)',
Expand All @@ -270,7 +270,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
df.loc[df.shape[0]] = [_s, _p, 'cpu', _values_type, _events_type, _transpose,
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
df.to_csv('event_csrmv_cpu.csv', index=False)
df.to_csv(f'{PATH}/event_csrmv_cpu.csv', index=False)

if (bm.get_platform() == 'gpu'):
for _s in s:
Expand All @@ -284,7 +284,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
df.loc[df.shape[0]] = [_s, _p, 'gpu', _values_type, _events_type, transpose,
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
df.to_csv('event_csrmv_gpu.csv', index=False)
df.to_csv(f'{PATH}/event_csrmv_gpu.csv', index=False)

# if (bm.get_platform() == 'gpu'):
# for _s in s:
Expand Down

0 comments on commit b5c5e35

Please sign in to comment.